1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-22 05:09:12 +00:00
community.general/plugins/lookup
Christoph Fiehe dae2157bb7
merge_variables: extended merge capabilities added (#11536)
* 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>
2026-03-19 22:45:44 +01:00
..
binary_file.py Add missing __future__ imports (#11567) 2026-03-11 06:42:08 +01:00
bitwarden.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
bitwarden_secrets_manager.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
cartesian.py Fix __future__ imports, __metaclass__ = type, and remove explicit UTF-8 encoding statement for Python files (#10886) 2025-10-10 19:52:04 +02:00
chef_databag.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
collection_version.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
consul_kv.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
credstash.py Use raise from in plugins (#11095) 2025-11-12 20:34:26 +01:00
cyberarkpassword.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
dependent.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
dig.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
dnstxt.py Use raise from in plugins (#11095) 2025-11-12 20:34:26 +01:00
dsv.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
etcd.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
etcd3.py Use raise from in plugins (#11095) 2025-11-12 20:34:26 +01:00
filetree.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
flattened.py Reformat everything. 2025-11-01 13:46:53 +01:00
github_app_access_token.py replace literal HTTP codes with http.HTTPStatus (#11561) 2026-03-10 22:03:55 +01:00
hiera.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
keyring.py Reformat everything. 2025-11-01 13:46:53 +01:00
lastpass.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
lmdb_kv.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
merge_variables.py merge_variables: extended merge capabilities added (#11536) 2026-03-19 22:45:44 +01:00
onepassword.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
onepassword_doc.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
onepassword_raw.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
onepassword_ssh_key.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
passwordstore.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
random_pet.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
random_string.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
random_words.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
redis.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
revbitspss.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
shelvefile.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
tss.py Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00