我是一名 Ansible 新手,在我的一个 playbook 中遇到了以下问题:
Ansible playbook 任务代码:
- name: Delete existing dist folder
shell: "[ -d {{ base_path }}/dist ] && rm -rf {{ base_path }}/dist"
输出:
fatal: [masked.amazonaws.com]: FAILED! => {
"changed": true,
"cmd": "[ -d /home/centos/masked/masked/dist ] && rm -rf /home/centos/masked/masked/dist",
"delta": "0:00:00.098034",
"end": "2018-09-26 20:26:06.940872",
"invocation": {
"module_args": {
"_raw_params": "[ -d /home/centos/masked/masked/dist ] && rm -rf /home/centos/masked/masked/dist",
"_uses_shell": true,
"argv": null,
"chdir": null,
"creates": null,
"executable": null,
"removes": null,
"stdin": null,
"warn": true
}
},
"msg": "non-zero return code",
"rc": 1,
"start": "2018-09-26 20:26:06.842838",
"stderr": "",
"stderr_lines": [],
"stdout": "",
"stdout_lines": []
如果我手动运行这个命令,它可以正常工作。
[ -d /home/centos/masked/masked/dist ] && rm -rf
/home/centos/masked/masked/dist
有没有人知道可能出了什么问题?
非常感谢你们的回复。
提前致谢。