Transforming lists into dictionaries
Use theansible.builtin.items2dictfilter to transform a list into a dictionary, mapping the content intokey:valuepairs:
List data (before applying theansible.builtin.items2dictfilter):
Dictionary data (after applying theansible.builtin.items2dictfilter):
Theansible.builtin.items2dictfilter is the reverse of theansible.builtin.dict2itemsfilter.
Not all lists usekeyto designate keys andvalueto designate values. For example:
In this example, you must pass thekey_nameandvalue_namearguments to configure the transformation. For example: