2

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 :)

1 Answer 1

4

The docs are your friend:

Ansible Copy Module

Ansible Template Module

Both contain a 'backup' parameter which will automatically take a backup of a file prior to making changes.

Sign up to request clarification or add additional context in comments.

1 Comment

The search engine on their documentation isn't really good. I can't search for it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.