diff options
Diffstat (limited to 'lib/ansible/plugins/filter/combine.yml')
-rw-r--r-- | lib/ansible/plugins/filter/combine.yml | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/ansible/plugins/filter/combine.yml b/lib/ansible/plugins/filter/combine.yml new file mode 100644 index 0000000..86788f3 --- /dev/null +++ b/lib/ansible/plugins/filter/combine.yml @@ -0,0 +1,44 @@ +DOCUMENTATION: + name: combine + version_added: "2.0" + short_description: combine two dictionaries + description: + - Create a dictionary (hash/associative array) as a result of merging existing dictionaries. + positional: _input, _dicts + options: + _input: + description: First dictionary to combine. + type: dict + required: true + _dicts: # TODO: this is really an *args so not list, but list ref + description: The list of dictionaries to combine. + type: list + elements: dictionary + required: true + recursive: + description: If C(True), merge elements recursively. + type: bool + default: false + list_merge: + description: Behavior when encountering list elements. + type: str + default: replace + choices: + replace: overwrite older entries with newer ones + keep: discard newer entries + append: append newer entries to the older ones + prepend: insert newer entries in front of the older ones + append_rp: append newer entries to the older ones, overwrite duplicates + prepend_rp: insert newer entries in front of the older ones, discard duplicates + +EXAMPLES: | + + # ab => {'a':1, 'b':3, 'c': 4} + ab: {{ {'a':1, 'b':2} | combine({'b':3, 'c':4}) }} + + many: "{{ dict1 | combine(dict2, dict3, dict4) }}" + +RETURN: + _value: + description: Resulting merge of supplied dictionaries. + type: dict |