mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-22 05:09:12 +00:00
* merge_variables: extended merge capabilities added This extension gives you more control over the variable merging process of the lookup plugin `merge_variables`. It closes the gap between Puppet's Hiera merging capabilities and the limitations of Ansible's default variable plugin `host_group_vars` regarding fragment-based value definition. You can now decide which merge strategy should be applied to dicts, lists, and other types. Furthermore, you can specify a merge strategy that should be applied in case of type conflicts. The default behavior of the plugin has been preserved so that it is fully backward-compatible with the already implemented state. Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> * Update changelogs/fragments/11536-merge-variables-extended-merging-capabilities.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/lookup/merge_variables.py Co-authored-by: Felix Fontein <felix@fontein.de> * Periods added at the end of each choice description Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> * Update plugins/lookup/merge_variables.py Co-authored-by: Mark <40321020+m-a-r-k-e@users.noreply.github.com> * ref: follow project standard for choice descriptions Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> * ref: more examples added and refactoring Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> * Update plugins/lookup/merge_variables.py Co-authored-by: Felix Fontein <felix@fontein.de> * ref: some more comments to examples added Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> * fix: unused import removed Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> * ref: re-add "merge" to strategy map Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> * Update comments Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> * Specification of transformations solely as string Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> * Comments updated Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> * ref: `append_rp` and `prepend_rp` removed feat: options dict for list transformations re-added feat: allow setting `keep` for dedup transformation with possible values: `first` (default) and `last` Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> * ref: improve options documentation Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> * ref: documentation improved, avoiding words like newer or older in merge description Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> * Update plugins/lookup/merge_variables.py Co-authored-by: Felix Fontein <felix@fontein.de> * ref: "prio" replaced by "dict" Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> * feat: two integration tests added Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> --------- Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de> Co-authored-by: Fiehe Christoph <c.fiehe@eurodata.de> Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Mark <40321020+m-a-r-k-e@users.noreply.github.com>
59 lines
1.1 KiB
YAML
59 lines
1.1 KiB
YAML
---
|
|
# Copyright (c) 2020, Thales Netherlands
|
|
# Copyright (c) 2021, Ansible Project
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
testlist_initial_value: "{{ testlist2 }}"
|
|
testlist1__merge_list:
|
|
- item1
|
|
testlist2:
|
|
- item2
|
|
testlist3__merge_list:
|
|
- item3
|
|
|
|
testdict1__merge_dict:
|
|
item1: test
|
|
list_item:
|
|
- test1
|
|
testdict2__merge_dict:
|
|
item2: test
|
|
list_item:
|
|
- test2
|
|
|
|
testdict3__test:
|
|
a:
|
|
a:
|
|
x: low_value
|
|
y: low_value
|
|
list:
|
|
- low_value
|
|
b:
|
|
- 1
|
|
- 1
|
|
- 2
|
|
- 3
|
|
testdict4__test:
|
|
a:
|
|
a:
|
|
y: high_value
|
|
z: high_value
|
|
list:
|
|
- high_value
|
|
b:
|
|
- 3
|
|
- 4
|
|
- 4
|
|
- "5": value
|
|
|
|
override_warn_init:
|
|
key_to_override: Initial value
|
|
override__override_warn:
|
|
key_to_override: Override value
|
|
|
|
override_error_init:
|
|
key_to_override: Initial value
|
|
override__override_error:
|
|
key_to_override: Override value
|
|
|
|
logging_output_file: /tmp/ansible-test-merge-variables # The Ansible log output is available in this file
|