Skip to content

rekey_on_member

Collection Note

This module is part of the ansible.builtin collection. To install the collection, use:

ansible-galaxy collection install ansible.builtin
Added in version 2.13.

Synopsis

  • Iterate over several iterables in parallel, producing tuples with an item from each one.

Parameters

Parameter Defaults / Choices Comments
_input
dict
required
Original dictionary.
_key
str
required
The key to rekey.
duplicates
str
Default: error
Choices: overwrite, error
How to handle duplicates.

Examples

# mydict => {'eigrp': {'state': 'enabled', 'proto': 'eigrp'}, 'ospf': {'state': 'enabled', 'proto': 'ospf'}}
 mydict: '{{ [{"proto": "eigrp", "state": "enabled"}, {"proto": "ospf", "state": "enabled"}] | rekey_on_member("proto") }}'

Return Values

Key Data Type Description Returned
_value dict The resulting dictionary.