Created
August 19, 2015 13:42
-
-
Save tgerla/efa5e1ff2c04088e22f0 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
Output with --extra-vars "hosts=foo": | |
Timothys-MacBook-Pro:ansible-test tgerla$ ansible-playbook -i inventory2 test-nulty.py --extra-vars "hosts=foo" -c local | |
PLAY [foo] ******************************************************************** | |
skipping: no hosts matched | |
PLAY RECAP ******************************************************************** | |
Output with --extra-vars "hosts= foo": | |
Timothys-MacBook-Pro:ansible-test tgerla$ ansible-playbook -i inventory2 test-nulty.py --extra-vars "hosts= foo" -c local | |
PLAY [] *********************************************************************** | |
GATHERING FACTS *************************************************************** | |
ok: [two] | |
ok: [one] | |
TASK: [debug] ***************************************************************** | |
ok: [one] => { | |
"var": { | |
"hosts": "" | |
} | |
} | |
ok: [two] => { | |
"var": { | |
"hosts": "" | |
} | |
} | |
PLAY RECAP ******************************************************************** | |
one : ok=2 changed=0 unreachable=0 failed=0 | |
two : ok=2 changed=0 unreachable=0 failed=0 |
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
I guess what's happening is that we're parsing the extra vars as: | |
hosts: <empty string> | |
foo: <empty string> | |
Instead of: | |
hosts: " foo" | |
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: "{{ hosts }}" | |
tasks: | |
- name: debug | |
debug: var=hosts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment