Given the following list:
fruits:
- fruit: apple
color: red
texture: crunchy
shape: round
- fruit: grapefruit
color: yellow
taste: sour
- fruit: pear
color: yellow
How would I use the items2dict filter to change to a dictionary (below)? Problem is there is multiple, and a variable amount of values.
"{{ fruits | items2dict(key_name='fruit', value_name='??????') }}
Desired result:
fruits:
- apple:
color: red
texture: crunchy
shape: round
- grapefruit:
color: yellow
taste: sour
- pear:
color: yellow
I can't seem to find how here: https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#transforming-lists-into-dictionaries