Copy Files and Append Text to Remote Host - RHCE.pdf
support8872
186 views
10 slides
Oct 09, 2024
Slide 1 of 10
1
2
3
4
5
6
7
8
9
10
About This Presentation
Slides on how to copy files and append text to remote host using ansible - Part of RHCE syllabus
Size: 489.56 KB
Language: en
Added: Oct 09, 2024
Slides: 10 pages
Slide Content
Copy Files and Append Text to
Remote Hosts
●To copy the files from control node to remote hosts
●Attributes
○src: Source file to be copied
○dest: Destination directory on the remote clients
○owner: Sets the file owner to root
○group: Sets the file group to root
○mode: Sets the file permissions
●Link: copy module — Ansible Documentation
Copy Module
●Verify that remote host is reachable using ping module
Command: ansible all -m ping
Copy files to Remote Hosts
●Execute the playbook on control node
Command: ansible-playbook <file-name> . yml
●Verify if the text file is copied to the directory of the remote host
Command: ls /tmp | grep sample.txt
●Module to insert, update, or remove a block of text in a file in Ansible
●Attributes
○path: specifies the path where the file should be created
○state: create a file
○block: text which is added to the file