【发布时间】:2016-12-17 00:28:12
【问题描述】:
我正在学习 Ansible。我有一个清理资源的剧本,我希望剧本忽略每一个错误并一直持续到最后,如果有错误,最后会失败。
我可以忽略错误
ignore_errors: yes
如果这是一项任务,我可以做类似(从 ansible 错误捕获)
- name: this command prints FAILED when it fails
command: /usr/bin/example-command -x -y -z
register: command_result
ignore_errors: True
- name: fail the play if the previous command did not succeed
fail: msg="the command failed"
when: "'FAILED' in command_result.stderr"
最后我怎么会失败?我有几项任务,我的“何时”条件是什么?
【问题讨论】: