Thank you. I'll try the update in my actual script and see how it goes.

I can't do a join since it's not a simple list I'm really trying to turn 
into a simple list. This code seemed to demonstrate the crux of my issue 
though and I'm hoping you provided the solution I needed. 

I'm still trying to understand when  quotes and brackets should be used.

-Jason

On Friday, October 11, 2019 at 1:23:54 PM UTC-7, Jason Crabtree wrote:
>
> 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/0f930835-f7fb-488a-aa91-5561a3ba7659%40googlegroups.com.

Reply via email to