Reputation: 57
I am trying to copy a file (example: /home/abc.jar) from controller machine(source system) to remote server. but before copying that file, I want to take the backup of the already existed file (/home/abc.jar) on the remote server to some directory (example /home/bck/abc.jar). then copy the new file ,
How can I write the playbook for this using ansible? Thank you :)
Upvotes: 2
Views: 6547
Reputation: 3056
The docs are your friend:
Both contain a 'backup' parameter which will automatically take a backup of a file prior to making changes.
Upvotes: 4