Created
September 1, 2014 12:26
-
-
Save hughsaunders/517b7a1867cb5e87e7ad 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
cb 1 (.venv) ~/git/test-playbook | |
$ ansible-playbook test.yml -i inventory/hosts | |
PLAY [test] ******************************************************************* | |
GATHERING FACTS *************************************************************** | |
ok: [localhost] | |
TASK: [debug ] **************************************************************** | |
ok: [localhost] => (item=hostvars[groups['g1'][0]]['y']) => { | |
"hostvars[groups['g1'][0]]['y']": "{{x}}", | |
"item": "hostvars[groups['g1'][0]]['y']" | |
} | |
ok: [localhost] => (item=y) => { | |
"item": "y", | |
"y": "foo" | |
} | |
PLAY RECAP ******************************************************************** | |
localhost : ok=2 changed=0 unreachable=0 failed=0 | |
cb 1 (.venv) ~/git/test-playbook | |
$ cat inventory/hosts | |
[all] | |
localhost | |
[g1] | |
localhost | |
cb 1 (.venv) ~/git/test-playbook | |
$ cat inventory/group_vars/g1.yml | |
--- | |
x: foo | |
y: "{{x}}" | |
cb 1 (.venv) ~/git/test-playbook | |
$ cat test.yml | |
--- | |
- name: test | |
hosts: localhost | |
tasks: | |
- debug: | |
var: "{{item}}" | |
with_items: | |
- hostvars[groups['g1'][0]]['y'] | |
- y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment