Add prefix to a list items
- debug:
var: result
vars:
prefix: foo
a_list: [ "bar", "bat", "baz" ]
result: "{{ [prefix] | product(a_list) | map('join') | list }}"
Add suffix to a list items
- debug:
var: result
vars:
suffix: foo
a_list: [ "bar", "bat", "baz" ]
result: "{{ a_list | product([suffix]) | map('join') | list }}"
Add prefix and suffix to a list items
- debug:
var: result
vars:
prefix: foo1
suffix: foo2
a_list: [ "bar", "bat", "baz" ]
result: "{{ [prefix] | product(a_list) | map('join') | list | product([suffix]) | map('join') | list }}"
Credit: Nicolas Massé