community / community.general / 6.6.8 / lookup / merge_variables merge variables with a certain suffix | "added in version" 6.5.0 of community.general" Authors: Roy Lenferink (@rlenferink), Mark Ettema (@m-a-r-k-e)community.general.merge_variables (6.6.8) — lookup
Install with ansible-galaxy collection install community.general:==6.6.8
collections: - name: community.general version: 6.6.8
This lookup returns the merged result of all variables in scope that match the given prefixes, suffixes, or regular expressions, optionally.
_terms: description: - Depending on the value of I(pattern_type), this is a list of prefixes, suffixes, or regular expressions that will be used to match all variables that should be merged. elements: str required: true type: list override: choices: - error - warn - ignore default: error description: - Return an error, print a warning or ignore it when a key will be overwritten. - The default behavior C(error) makes the plugin fail when a key would be overwritten. - When C(warn) and C(ignore) are used, note that it is important to know that the variables are sorted by name before being merged. Keys for later variables in this order will overwrite keys of the same name for variables earlier in this order. To avoid potential confusion, better use I(override=error) whenever possible. env: - name: ANSIBLE_MERGE_VARIABLES_OVERRIDE ini: - key: override section: merge_variables_lookup type: str pattern_type: choices: - prefix - suffix - regex default: regex description: - Change the way of searching for the specified pattern. env: - name: ANSIBLE_MERGE_VARIABLES_PATTERN_TYPE ini: - key: pattern_type section: merge_variables_lookup type: str initial_value: description: - An initial value to start with. type: raw
_raw: description: In case the search matches list items, a list will be returned. In case the search matches dicts, a dict will be returned. elements: raw type: raw