In Ansible, if I have a list variable with the following mixed structure:
input_items:
- mainkey: 'main.value.1'
subkey: 'subvalue_1.1'
- mainkey: 'main.value.2'
group:
- subkey: 'subvalue_2.1'
- subkey: 'subvalue_2.2'
Is there a way to transform it to a flat structure like this:
transformed:
- mainkey: 'main.value.1'
subkey: 'subvalue_1.1'
- mainkey: 'main.value.2'
subkey: 'subvalue_2.1'
- mainkey: 'main.value.2'
subkey: 'subvalue_2.2'
The idea being to allow a more compact structure to define the list, then transform it to a flat structure that is simple to feed in to a module using with_items.
I've exhausted every shape of loop, include, set_fact and jinja filter I can muster but I'm sure there must be a way.