Ansible 2.0.4.0
There are about three tasks which randomly fails. The output of the fail is:
OSError: [Errno 32]
Broken pipefatal: [machine1]: FAILED! => {"failed": true, "msg": "Unexpected failure during module execution.", "stdout": ""}
Is it possible to ignore the error, if Errno 32
is in the output of the error.
- name: This task sometimes fails
shell: fail_me!
ignore_errors: "{{ when_errno32 }}"
I"m aware this is a workaround. Solving the 'real' problem could take up way more time.
You can use failed_when
to control when a task should fail in Ansible, but you cannot use ignore_errors
for a specific return code, it is a simple yes/no switch.
So in your case you can add an expression:
- name: This task sometimes fails
shell: fail_me!
register: fail_me
failed_when: "fail_me.rc != 0 and fail_me.rc != 32"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With