Skip to content

Instantly share code, notes, and snippets.

@hughsaunders
Created January 28, 2016 20:28
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 hughsaunders/91974e4f4053a81f1285 to your computer and use it in GitHub Desktop.
Save hughsaunders/91974e4f4053a81f1285 to your computer and use it in GitHub Desktop.
with_flattened expands strings as variables :(
ansible-playbook -i /tmp/inv test.yml
PLAY [localhost] **************************************************************
TASK: [with_items] ************************************************************
ok: [localhost] => (item=foo) => {
"item": "foo",
"msg": "foo"
}
TASK: [with_flattened] ********************************************************
ok: [localhost] => (item=bah) => {
"item": "bah",
"msg": "bah"
}
PLAY RECAP ********************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0
---
- hosts: localhost
gather_facts: False
vars:
foo: bah
somethings:
- "foo"
tasks:
- name: with_items
debug:
msg: "{{ item }}"
with_items: somethings
- name: with_flattened
debug:
msg: "{{ item }}"
with_flattened:
- somethings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment