Variable concatenation

Is there a way to concatenate variables?

base:

  • a
  • b
  • c

extend:

  • x
  • y
  • z

Something like this?

together:

  • “{{ base }”"
  • extend

The above gives me

“msg”: “together [[u’a’, u’b’, u’c’], u’x’, u’y’, u’z’]”

Is there a way to concatenate variables?

Since you variable contains a list you can use the union filter
https://docs.ansible.com/ansible/latest/playbooks_filters.html

But this will remove duplicates or just use +.

base:
  - a
  - b
  - c

extend:
  - x
  - y
  - z

Something like this?

together:
  - "{{ base }""
  - extend

The above gives me

    "msg": "together [[u'a', u'b', u'c'], u'x', u'y', u'z']"

{{ base | union(extend) }}

{{ base + extend }}