From eaeab18103c4b691d585547466b1222c3c3f64f1 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 6 Feb 2025 21:18:25 +0100 Subject: [PATCH] Solved merge variable bug --- playbook.constructor.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/playbook.constructor.yml b/playbook.constructor.yml index 2c70a519..2e1ab9d5 100644 --- a/playbook.constructor.yml +++ b/playbook.constructor.yml @@ -8,14 +8,23 @@ - name: Merge domain definitions set_fact: domains: "{{ defaults_domains | combine(domains | default({}, true), recursive=True) }}" - - name: Merge redirect domain definitions + + - name: Merge redirect domain definitions into dictionary set_fact: - redirect_domain_mappings: >- + combined_mapping: >- {{ (defaults_redirect_domain_mappings | items2dict(key_name='source', value_name='target')) - | combine((redirect_domain_mappings | items2dict(key_name='source', value_name='target')), recursive=True) - | dict2items + | combine( + (redirect_domain_mappings | items2dict(key_name='source', value_name='target')), + recursive=True + ) }} + + - name: Transform combined mapping to list with source and target keys + set_fact: + redirect_domain_mappings: "{{ redirect_domain_mappings | default([]) + [ {'source': item.key, 'target': item.value} ] }}" + loop: "{{ combined_mapping | dict2items }}" + - name: Merge application definitions set_fact: applications: "{{ defaults_applications | combine(applications | default({}, true), recursive=True) }}"