Skip to content

Instantly share code, notes, and snippets.

@hughsaunders
Last active August 29, 2015 14:10
Show Gist options
  • Save hughsaunders/0d6195aab145a18ab1cb to your computer and use it in GitHub Desktop.
Save hughsaunders/0d6195aab145a18ab1cb to your computer and use it in GitHub Desktop.
---$
- hosts: localhost$
tasks:$
- debug:$
var: item$
with_nested:$
-$
-$
- 'foo'$
- 'bah'$
- [1,2,3]$
$ ansible-playbook -i inventory test.yml
PLAY [localhost] **************************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [debug ] ****************************************************************
ok: [localhost] => (item=['foo', 'bah', 1]) => {
"item": [
"foo",
"bah",
1
]
}
ok: [localhost] => (item=['foo', 'bah', 2]) => {
"item": [
"foo",
"bah",
2
]
}
ok: [localhost] => (item=['foo', 'bah', 3]) => {
"item": [
"foo",
"bah",
3
]
}
---$
- hosts: localhost$
tasks:$
- debug:$
var: item$
with_nested:$
-$
- { foo: 'bah', test: 'wibble' }$
- [1,2,3]$
$ ansible-playbook -i inventory test.yml
PLAY [localhost] **************************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [debug ] ****************************************************************
ok: [localhost] => (item=[{'test': 'wibble', 'foo': 'bah'}, 1]) => {
"item": [
{
"foo": "bah",
"test": "wibble"
},
1
]
}
ok: [localhost] => (item=[{'test': 'wibble', 'foo': 'bah'}, 2]) => {
"item": [
{
"foo": "bah",
"test": "wibble"
},
2
]
}
ok: [localhost] => (item=[{'test': 'wibble', 'foo': 'bah'}, 3]) => {
"item": [
{
"foo": "bah",
"test": "wibble"
},
3
]
}
PLAY RECAP ********************************************************************
localhost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment