Skip to content

Instantly share code, notes, and snippets.

@omgjlk
Created September 9, 2016 22:03
Show Gist options
  • Save omgjlk/c1bed53901466a1b57cc7fafab15abe1 to your computer and use it in GitHub Desktop.
Save omgjlk/c1bed53901466a1b57cc7fafab15abe1 to your computer and use it in GitHub Desktop.
~/src/derp> cat foo.yaml
---
- name: test
hosts: all
# gather_facts: false
connection: local
vars:
foo:
jar: no
bar:
what: red
else: untouched
tasks:
- name: foo
debug:
var: foo
- name: change a subelement
set_fact:
foo:
bar:
what: blue
- name: foo
debug:
var: foo
~/src/derp> vex urs2 ansible-playbook -i hosts foo.yaml -vv
Using /Users/jkeating/src/derp/ansible.cfg as config file
PLAYBOOK: foo.yaml *************************************************************
1 plays in foo.yaml
PLAY [test] ********************************************************************
TASK [setup] *******************************************************************
ok: [haderp]
TASK [foo] *********************************************************************
task path: /Users/jkeating/src/derp/foo.yaml:14
ok: [haderp] => {
"foo": {
"bar": {
"else": "untouched",
"what": "red"
},
"jar": false
}
}
TASK [change a subelement] *****************************************************
task path: /Users/jkeating/src/derp/foo.yaml:18
ok: [haderp] => {"ansible_facts": {"foo": {"bar": {"what": "blue"}}}, "changed": false}
TASK [foo] *********************************************************************
task path: /Users/jkeating/src/derp/foo.yaml:24
ok: [haderp] => {
"foo": {
"bar": {
"else": "untouched",
"what": "blue"
},
"jar": false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment