On Fri, 6 Mar 2020 09:15:51 -0800 (PST)
Quentin Aveno <aorio...@gmail.com> wrote:

> - name: test
>   vars:
>     test1: "test1"
>     test2:
>       - "test21"
>       - "test22"
>     test3:
>      - "{{ test1 }}"
>      - "{{ test2 }}" 
>       
>   debug:
>     msg: "{% for tt in test3 %} {{ tt }} {% endfor %}"
> 
> Is there a way to flatten the list into à list of strings with a filter ? 

Use filter "flatten". For example

    - debug:
        msg: "{{ test3|flatten }}"

should give

    "msg": [
        "test1", 
        "test21", 
        "test22"
    ]

HTH,

        -vlado

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200306235028.1f45034f%40gmail.com.

Attachment: pgpBNY9KT_45i.pgp
Description: OpenPGP digital signature

Reply via email to