Hello,
I'm trying to build a list from data in other lists by looping over lists
and using set_fact to build a new list.
----------------------------------------------
- name: "test list build"
hosts: localhost
connection: local
gather_facts: no
become: no
vars:
location_list:
site:
- portland
- miami
- chicago
item_list:
- nowhere
tasks:
- name: "create list"
set_fact:
item_list: '{{ item_list + [ "{{ item }}" ] }}'
loop: "{{ location_list.site }}"
- name: "display final item_list"
debug:
msg: "{{ item_list }}"
----------------------------------------------
I expected the list:
nowhere
portland
miami
chicago
I got:
nowhere
miami
{{ item }}
{{ item }}
Can anyone point out what I got wrong or is this just a bug?
Thanks,
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/df87f108-eeae-4228-adb9-86538aabe0fd%40googlegroups.com.