I'm trying to copy files using an ansible role.
- name: Backing up existing ~/.zshrc
shell: if [ -f ~/.zshrc ]; then cp ~/.zshrc{,.orig}; fi
become: true
become_user: root
when: installation|success
However, I end up with this error:
fatal: [localhost]: FAILED! =>
{
"changed":true,
"cmd":"if [ -f ~/.zshrc ]; then cp ~/.zshrc{,.orig}; fi",
"delta":"0:00:00.002640",
"end":"2017-04-11 12:32:35.886640",
"failed":true,
"rc":1,
"start":"2017-04-11 12:32:35.884000",
"stderr":"cp: missing destination file operand after '/root/.zshrc{,.orig}'\nTry 'cp --help' for more information.",
"stderr_lines":[
"cp: missing destination file operand after '/root/.zshrc{,.orig}'",
"Try 'cp --help' for more information."
],
"stdout":"",
"stdout_lines":[
]
}