Ansible 2.0.4.0
大约有三个随机失败的任务。失败的输出是:
OSError: [Errno 32]
Broken pipefatal: [machine1]: FAILED! => {"failed": true, "msg": "Unexpected failure during module execution.", "stdout": ""}如果Errno 32在错误的输出中,是否可以忽略该错误。
- name: This task sometimes fails
shell: fail_me!
ignore_errors: "{{ when_errno32 }}"我知道这是一个变通办法,解决‘真正’的问题可能需要更多的时间。
发布于 2017-03-08 06:09:45
在Ansible中,您可以使用failed_when来控制任务何时失败,但您不能使用ignore_errors来指定特定的返回码,它是一个简单的是/否切换。
因此,在您的示例中,可以添加一个表达式:
- name: This task sometimes fails
shell: fail_me!
register: fail_me
failed_when: "fail_me.rc != 0 and fail_me.rc != 32"发布于 2018-03-14 15:39:38
您也可以尝试使用ignore_errors。
:ignore_errors
https://stackoverflow.com/questions/42653655
复制相似问题