Created
October 29, 2015 17:03
-
-
Save hughsaunders/93a067fab8ffc8dda49e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
gather_facts: False | |
tasks: | |
- shell: date | |
when: false | |
register: rvar | |
- debug: | |
msg: "Can I use an undefined var in a conditional?" | |
when: rvar.rc==0 | |
- debug: | |
msg: "Return code: {{rvar.rc}}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PLAY [all] ******************************************************************** | |
TASK: [shell date] ************************************************************ | |
skipping: [localhost] | |
TASK: [debug ] **************************************************************** | |
ok: [localhost] => { | |
"msg": "Can I use an undefined var in a conditional?" | |
} | |
TASK: [debug ] **************************************************************** | |
fatal: [localhost] => One or more undefined variables: 'dict object' has no attribute 'rc' | |
FATAL: all hosts have already failed -- aborting | |
PLAY RECAP ******************************************************************** | |
to retry, use: --limit @/home/hugh/test.retry | |
localhost : ok=1 changed=0 unreachable=1 failed=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment