|
|
@ -100,10 +100,21 @@ You can also combine multiple conditions for failure. This task will fail if bot
|
|
|
|
- result.rc == 0
|
|
|
|
- result.rc == 0
|
|
|
|
- '"No such" not in result.stdout'
|
|
|
|
- '"No such" not in result.stdout'
|
|
|
|
|
|
|
|
|
|
|
|
If you want the task to fail when only one condition is satisfied, change the ``failed_when`` definition to::
|
|
|
|
If you want the task to fail when only one condition is satisfied, change the ``failed_when`` definition to::
|
|
|
|
|
|
|
|
|
|
|
|
failed_when: result.rc == 0 or "No such" not in result.stdout
|
|
|
|
failed_when: result.rc == 0 or "No such" not in result.stdout
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If you have too many conditions to fit neatly into one line, you can split it into a multi-line yaml value with ``>``::
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: example of many failed_when conditions with OR
|
|
|
|
|
|
|
|
shell: "./myBinary"
|
|
|
|
|
|
|
|
register: ret
|
|
|
|
|
|
|
|
failed_when: >
|
|
|
|
|
|
|
|
("No such file or directory" in ret.stdout) or
|
|
|
|
|
|
|
|
(ret.stderr != '') or
|
|
|
|
|
|
|
|
(ret.rc == 10)
|
|
|
|
|
|
|
|
|
|
|
|
.. _override_the_changed_result:
|
|
|
|
.. _override_the_changed_result:
|
|
|
|
|
|
|
|
|
|
|
|
Overriding The Changed Result
|
|
|
|
Overriding The Changed Result
|
|
|
|