parameter copy module, ansible host group copy -a -m ''
the src: Specifies the source file or directory
dest: target file or directory server
backup: whether to back up
their user copied to the target server, the file or directory: owner
after copied to the target server, belongs to a group of files or directories: group
the MODE: permissions on the file or directory
- Issued a document
ansible all -m copy -a "src=/data/1.txt dest=/data/"
- Issued a directory
ansible all -m copy -a "src=/data/ dest=/usr/local/src/"
# directory will not be copied, only issued a directory of all the files in
ansible all -m copy -a "src=/data dest=/usr/local/src/"
all files in the directory and the directory # joint issued
- Automatic Backup
ansible all -m copy -a "src=/data/1.txt dest=/data/ backup=yes"
- And assign permissions to control user belongs
ansible all -m copy -a "src=/data/2.txt dest=/data/ backup=yes owner=nobody group=nobody mode=0600"