Just for starters, with version of ansible are you using?

I'd probably be tempted to just declare "my_files" as a list, in this
particular case, it would make the playbook more readable.

I'm interested in the non-abstract use case though.



On Tue, Sep 16, 2014 at 3:41 AM, DomaNitro <[email protected]> wrote:

> Hey,
>
> I am looking to concatenate variables in an array from a with_fileglob but
> i am not sure that set_fact works with loops
>
> - hosts        : all
>   vars:
>     myfiles : ["old"]
>   tasks:
>    - name: "facts"
>      set_fact:
>        myfiles: "{{ [item] | union(myfiles) }}"
>      with_items:
>       - "new1"
>       - "new2"
>       - "new3"
>    - name: "Debug"
>      debug:
>        var=myfiles
>
> The output
>
>     "myfiles": [
>         "new3",
>         "old"
>     ]
>
> Only the last item is added. any ideas ?
>
>  --
> 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 post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/93fbd2d2-3169-4a7c-aed0-9c36e7ccc4ab%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/93fbd2d2-3169-4a7c-aed0-9c36e7ccc4ab%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgyXRK0w%2BtnrugViQciHRJXnNsqnX-Dno%3DhfUk2d%3DNZmRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to