I have the following list and default variables:
my_list_complex:
- key1: val1
key2: val2
key3: val3
keyN: valN
- key1: val1
key3: val3
keyN: valN
key2: default2
key3: default3
key4: default4
I need to map my_list_complex
to apply all the defaults to it. Please note the following:
- the list of keys in complex is unbounded and unpredictable. Only the keys which have defaults and don't exist within the elements of the list should be set with default values
The expected output is:
my_list_complex_default_applied:
- key1: val1
key2: val2
key3: val3
key4: default4
keyN: valN
- key1: val1
key2: default2
key3: val3
key4: default4
keyN: valN
I've looked into combine
, map
and with_items
but I haven't succeeded in achieving the task
How would I do this with an Ansible task or role?