Skip to content

Instantly share code, notes, and snippets.

@omgjlk
Created May 31, 2015 05:12
Show Gist options
  • Select an option

  • Save omgjlk/cd0486f317441d351874 to your computer and use it in GitHub Desktop.

Select an option

Save omgjlk/cd0486f317441d351874 to your computer and use it in GitHub Desktop.
---
- name: thing
hosts: localhost
gather_facts: false
vars:
foo:
keys:
- 1
- 2
- 3
tasks:
- name: thing
debug:
var: foo.keys
- name: thing2
debug:
var: foo['keys']
> ansible-playbook -i mastery-hosts keys.yaml -vv
PLAY [thing] ******************************************************************
TASK: [thing] *****************************************************************
ok: [localhost] => {
"var": {
"foo.keys": "<built-in method keys of dict object at 0x7f9dc29ea360>"
}
}
TASK: [thing2] ****************************************************************
ok: [localhost] => {
"var": {
"foo['keys']": [
1,
2,
3
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment