Appending one list to another in Ansible (oneliner)

Viewed 925

I wanted to append one list to an other in Ansible. While at that, I found, that using

tasks:
    set_fact:
    my_list: "{{ my_list + my_append_list }}"

works but it requires 3 lines of code which seems to be a lot of hassle. The problem is, that using

my_list: "{{ my_list + my_append_list }}"

ends up in an infinite recursion. This type of assignment works only if a third list-name is involved (so something like my_third_list: "{{ my_list + my_append_list }}")

The question is: Is there a way how to append a list to another with a single line of code and without the use of another variable making?

Thanks in advance, P.

1 Answers
Related