Optimized cloudflare implementation

This commit is contained in:
2025-04-29 00:10:10 +02:00
parent 04deeef385
commit d796158c61
16 changed files with 151 additions and 48 deletions

View File

@@ -62,22 +62,28 @@
set_fact:
service_provider: "{{ defaults_service_provider | combine(service_provider | default({}, true), recursive=True) }}"
- name: Collect all domains (domains, redirect sources + www)
- name: Gather base domains (without www)
set_fact:
all_domains: >-
base_domains: >-
{{
(
(
domains.values() | flatten
+ (redirect_domain_mappings | map(attribute='source') | list)
)
+ (
domains.values() | flatten
+ (redirect_domain_mappings | map(attribute='source') | list)
) | map('regex_replace', '^(.*)$', 'www.\\1') | list
) | unique | sort
domains.values()
| flatten
+ (redirect_domain_mappings | map(attribute='source') | list)
}}
- name: Initialise all_domains as empty list
set_fact:
all_domains: []
- name: Build all_domains with base + www via loop
set_fact:
all_domains: "{{ all_domains + [ item, 'www.' ~ item ] }}"
loop: "{{ base_domains }}"
- name: Deduplicate and sort all_domains
set_fact:
all_domains: "{{ all_domains | unique | sort }}"
- name: "Merged Variables"
# Add new merged variables here
debug: