mirror of https://github.com/ansible/ansible.git
Add failed_when module variable.
Implementation note: Ternery operator trick for python prior to 2.5 is used. (test and [when_true_value] or [when_false_value])[0] http://stackoverflow.com/questions/394809/ternary-conditional-operator-in-python#comment1466794_394887pull/4073/head
parent
808d9596b2
commit
2357194b39
@ -0,0 +1,15 @@
|
||||
---
|
||||
- hosts: all
|
||||
connection: local
|
||||
gather_facts: False
|
||||
|
||||
tasks:
|
||||
- action: shell exit 0
|
||||
register: exit
|
||||
failed_when: not exit.rc in [0, 1]
|
||||
- action: shell exit 1
|
||||
register: exit
|
||||
failed_when: exit.rc not in [0, 1]
|
||||
- action: shell exit 2
|
||||
register: exit
|
||||
failed_when: exit.rc not in [0, 1]
|
Loading…
Reference in New Issue