.. _copy: copy `````````````````````````````` The ``copy`` module copies a file on the local box to remote locations. .. raw:: html
parameter | required | default | choices | comments |
---|---|---|---|---|
dest | yes | Remote absolute path where the file should be copied to. | ||
src | yes | Local path to a file to copy to the remote server; can be absolute or relative. | ||
backup | no | no |
|
Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. (added in Ansible 0.7) |
others | no | all arguments accepted by the file module also work here |
Example from Ansible Playbooks
copy src=/srv/myfiles/foo.conf dest=/etc/foo.conf owner=foo group=foo mode=0644
Copy a new ntp.conf
file into place, backing up the original if it differs from the copied version
copy src=/mine/ntp.conf dest=/etc/ntp.conf owner=root group=root mode=644 backup=yes