Transforming dictionaries into lists
Use theansible.builtin.dict2itemsfilter to transform a dictionary into a list of items suitable forlooping:
Dictionary data (before applying theansible.builtin.dict2itemsfilter):
List data (after applying theansible.builtin.dict2itemsfilter):
Theansible.builtin.dict2itemsfilter is the reverse of theansible.builtin.items2dictfilter.
If you want to configure the names of the keys, theansible.builtin.dict2itemsfilter accepts 2 keyword arguments. Pass thekey_nameandvalue_namearguments to configure the names of the keys in the list output:
Dictionary data (before applying theansible.builtin.dict2itemsfilter):