私はAnsibleを使用しています。私の不可能なプレイブックを使用して、私の不可能な役割で次のコードを使用してファイルをコピーまたは移動したいと思います。可能なファイルをコピー/移動する
- name: Backing up existing ~/.zshrc
shell: if [ -f ~/.zshrc ]; then cp ~/.zshrc{,.orig}; fi
become: true
become_user: root
when: installation|success
ただし、実行するとこのエラーが発生します。何が間違っていますか?
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":[
]
}
私は標準エラー出力は 'cp'コマンドの先が欠けて、明確にそれを言うと思います:私はローカルでコマンドを実行しようとしたとき ' CP〜/ .zshrc {。、ORIG} DESTINATION' – oryades
はしかし、それはうまく働いていました、期待どおりに私のためにファイルをコピーしました。 – dwardu