Skip to content

Instantly share code, notes, and snippets.

@Apsu
Last active September 15, 2015 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Apsu/69b37d6dca2658fe06fa to your computer and use it in GitHub Desktop.
Save Apsu/69b37d6dca2658fe06fa to your computer and use it in GitHub Desktop.
PLAY [Test with_items] ********************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [List with dereferencing/without nesting] *******************************
ok: [localhost] => (item=one) => {
"item": "one",
"msg": "one"
}
ok: [localhost] => (item=two) => {
"item": "two",
"msg": "two"
}
TASK: [List with dereferencing/with nesting] **********************************
ok: [localhost] => (item=one) => {
"item": "one",
"msg": "one"
}
ok: [localhost] => (item=two) => {
"item": "two",
"msg": "two"
}
TASK: [List without dereferencing/without nesting] ****************************
ok: [localhost] => (item=one) => {
"item": "one",
"msg": "one"
}
ok: [localhost] => (item=two) => {
"item": "two",
"msg": "two"
}
TASK: [List without dereferencing/with nesting] *******************************
ok: [localhost] => (item=somelist) => {
"item": "somelist",
"msg": "somelist"
}
TASK: [String with dereferencing/without nesting] *****************************
ok: [localhost] => (item=a string) => {
"item": "a string",
"msg": "a string"
}
TASK: [String with dereferencing/with nesting] ********************************
ok: [localhost] => (item=a string) => {
"item": "a string",
"msg": "a string"
}
TASK: [String without dereferencing/without nesting] **************************
ok: [localhost] => (item=a string) => {
"item": "a string",
"msg": "a string"
}
TASK: [String without dereferencing/with nesting] *****************************
ok: [localhost] => (item=somestring) => {
"item": "somestring",
"msg": "somestring"
}
PLAY [Test with_nested] *******************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [List with dereferencing/without nesting] *******************************
ok: [localhost] => (item=['one', 'two']) => {
"item": [
"one",
"two"
],
"msg": "['one', 'two']"
}
TASK: [List with dereferencing/with nesting] **********************************
ok: [localhost] => (item=['o', 'n', 'e']) => {
"item": [
"o",
"n",
"e"
],
"msg": "['o', 'n', 'e']"
}
ok: [localhost] => (item=['t', 'w', 'o']) => {
"item": [
"t",
"w",
"o"
],
"msg": "['t', 'w', 'o']"
}
TASK: [List without dereferencing/without nesting] ****************************
ok: [localhost] => (item=['one', 'two']) => {
"item": [
"one",
"two"
],
"msg": "['one', 'two']"
}
TASK: [List without dereferencing/with nesting] *******************************
ok: [localhost] => (item=['o', 'n', 'e']) => {
"item": [
"o",
"n",
"e"
],
"msg": "['o', 'n', 'e']"
}
ok: [localhost] => (item=['t', 'w', 'o']) => {
"item": [
"t",
"w",
"o"
],
"msg": "['t', 'w', 'o']"
}
TASK: [String with dereferencing/without nesting] *****************************
ok: [localhost] => (item=[u'a', u' ', u's', u't', u'r', u'i', u'n', u'g']) => {
"item": [
"a",
" ",
"s",
"t",
"r",
"i",
"n",
"g"
],
"msg": "[u'a', u' ', u's', u't', u'r', u'i', u'n', u'g']"
}
TASK: [String with dereferencing/with nesting] ********************************
ok: [localhost] => (item=[u'a', u' ', u's', u't', u'r', u'i', u'n', u'g']) => {
"item": [
"a",
" ",
"s",
"t",
"r",
"i",
"n",
"g"
],
"msg": "[u'a', u' ', u's', u't', u'r', u'i', u'n', u'g']"
}
TASK: [String without dereferencing/without nesting] **************************
ok: [localhost] => (item=[u'a', u' ', u's', u't', u'r', u'i', u'n', u'g']) => {
"item": [
"a",
" ",
"s",
"t",
"r",
"i",
"n",
"g"
],
"msg": "[u'a', u' ', u's', u't', u'r', u'i', u'n', u'g']"
}
TASK: [String without dereferencing/with nesting] *****************************
ok: [localhost] => (item=[u'a', u' ', u's', u't', u'r', u'i', u'n', u'g']) => {
"item": [
"a",
" ",
"s",
"t",
"r",
"i",
"n",
"g"
],
"msg": "[u'a', u' ', u's', u't', u'r', u'i', u'n', u'g']"
}
PLAY RECAP ********************************************************************
localhost : ok=18 changed=0 unreachable=0 failed=0
- name: Test with_items
hosts: localhost
connection: local
vars:
somelist:
- "one"
- "two"
somestring: "a string"
tasks:
- name : List with dereferencing/without nesting
debug: msg="{{item}}"
with_items: "{{somelist}}"
- name : List with dereferencing/with nesting
debug: msg="{{item}}"
with_items:
- "{{somelist}}"
- name : List without dereferencing/without nesting
debug: msg="{{item}}"
with_items: somelist
- name : List without dereferencing/with nesting
debug: msg="{{item}}"
with_items:
- somelist
- name : String with dereferencing/without nesting
debug: msg="{{item}}"
with_items: "{{somestring}}"
- name : String with dereferencing/with nesting
debug: msg="{{item}}"
with_items:
- "{{somestring}}"
- name : String without dereferencing/without nesting
debug: msg="{{item}}"
with_items: somestring
- name : String without dereferencing/with nesting
debug: msg="{{item}}"
with_items:
- somestring
- name: Test with_nested
hosts: localhost
connection: local
vars:
somelist:
- "one"
- "two"
somestring: "a string"
tasks:
- name : List with dereferencing/without nesting
debug: msg="{{item}}"
with_nested: "{{somelist}}"
- name : List with dereferencing/with nesting
debug: msg="{{item}}"
with_nested:
- "{{somelist}}"
- name : List without dereferencing/without nesting
debug: msg="{{item}}"
with_nested: somelist
- name : List without dereferencing/with nesting
debug: msg="{{item}}"
with_nested:
- somelist
- name : String with dereferencing/without nesting
debug: msg="{{item}}"
with_nested: "{{somestring}}"
- name : String with dereferencing/with nesting
debug: msg="{{item}}"
with_nested:
- "{{somestring}}"
- name : String without dereferencing/without nesting
debug: msg="{{item}}"
with_nested: somestring
- name : String without dereferencing/with nesting
debug: msg="{{item}}"
with_nested:
- somestring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment