How to join values of 2 lists in ansible
Solution 1:
For example, given the lists
foo: ['1', '2', '3']
bar: ['a', 'b', 'c']
the expression below
result: "{{ foo|zip(bar)|map('join', '_')|list }}"
gives
result: [1_a, 2_b, 3_c]
For example, given the lists
foo: ['1', '2', '3']
bar: ['a', 'b', 'c']
the expression below
result: "{{ foo|zip(bar)|map('join', '_')|list }}"
gives
result: [1_a, 2_b, 3_c]