diff --git a/playbooks/filter_plugins/service_filters.py b/playbooks/filter_plugins/service_filters.py index 9a91455..734e62d 100644 --- a/playbooks/filter_plugins/service_filters.py +++ b/playbooks/filter_plugins/service_filters.py @@ -4,6 +4,7 @@ class FilterModule(object): 'my_service_attributes': self.my_service_attributes, 'services_to_dnscontrol': self.services_to_dnscontrol, 'services_get_backups': self.services_get_backups, + 'service_get_domain': self.service_get_domain, } def my_service_attributes(self, services, host, attribute="name"): @@ -24,6 +25,12 @@ class FilterModule(object): return result + def find_service(self, services, name): + for service in services: + if service.get("name") == name: + return service + return None + def services_get_backups(self, all_services, wanted_services): result = [] for service in all_services: @@ -32,6 +39,12 @@ class FilterModule(object): result.append(backup["name"]) return result + def service_get_domain(self, all_services, wanted_service): + if service := self.find_service(all_services, wanted_service): + if dns := service.get("dns"): + if dns_0 := dns[0]: + return dns_0.get("domain") + return None def services_to_dnscontrol(self, services): result = {} diff --git a/playbooks/roles/_TEMPLATE/vars/main.yml b/playbooks/roles/_TEMPLATE/vars/main.yml index 0bff880..8465219 100644 --- a/playbooks/roles/_TEMPLATE/vars/main.yml +++ b/playbooks/roles/_TEMPLATE/vars/main.yml @@ -1,6 +1,6 @@ --- NAME_svc: - domain: NAME.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 80 NAME_env: diff --git a/playbooks/roles/acme_dns/vars/main.yml b/playbooks/roles/acme_dns/vars/main.yml index 54492e5..f6f38bd 100644 --- a/playbooks/roles/acme_dns/vars/main.yml +++ b/playbooks/roles/acme_dns/vars/main.yml @@ -1,6 +1,6 @@ --- acme_dns_svc: - domain: "{{ acme_dns.host }}" + domain: "{{ all_services | service_get_domain(role_name) }}" port: 80 nsadmin: "{{ admin_email | regex_replace('@', '.') }}" records: diff --git a/playbooks/roles/authentik/vars/main.yml b/playbooks/roles/authentik/vars/main.yml index 8ff6788..d03b16d 100644 --- a/playbooks/roles/authentik/vars/main.yml +++ b/playbooks/roles/authentik/vars/main.yml @@ -1,6 +1,6 @@ --- authentik_svc: - domain: auth.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 9000 image_tag: 2024.8 db: diff --git a/playbooks/roles/faas/vars/main.yml b/playbooks/roles/faas/vars/main.yml index 1b1b446..52718e1 100644 --- a/playbooks/roles/faas/vars/main.yml +++ b/playbooks/roles/faas/vars/main.yml @@ -1,6 +1,6 @@ --- faas_svc: - domain: faas.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" docker_host: host.docker.internal port: 8080 extra_svcs: diff --git a/playbooks/roles/forgejo/vars/main.yml b/playbooks/roles/forgejo/vars/main.yml index 97b3510..1c01a40 100644 --- a/playbooks/roles/forgejo/vars/main.yml +++ b/playbooks/roles/forgejo/vars/main.yml @@ -1,6 +1,6 @@ --- forgejo_svc: - domain: git.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 3000 caddy_extra: | import analytics diff --git a/playbooks/roles/gatus/vars/main.yml b/playbooks/roles/gatus/vars/main.yml index 447a356..5b6660a 100644 --- a/playbooks/roles/gatus/vars/main.yml +++ b/playbooks/roles/gatus/vars/main.yml @@ -1,6 +1,6 @@ --- gatus_svc: - domain: status.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 8080 gatus_external_endpoints_backups: "{{ vault_hosts | vault_hosts_backup_to_gatus() }}" diff --git a/playbooks/roles/homebox/vars/main.yml b/playbooks/roles/homebox/vars/main.yml index 0f9ba96..1ae0a50 100644 --- a/playbooks/roles/homebox/vars/main.yml +++ b/playbooks/roles/homebox/vars/main.yml @@ -1,6 +1,6 @@ --- homebox_svc: - domain: inventory.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 7745 homebox_env: diff --git a/playbooks/roles/immich/vars/main.yml b/playbooks/roles/immich/vars/main.yml index e63186a..c967f7b 100644 --- a/playbooks/roles/immich/vars/main.yml +++ b/playbooks/roles/immich/vars/main.yml @@ -5,7 +5,7 @@ immich_db_user: "{{ vault_immich.db.user }}" immich_db_pass: "{{ vault_immich.db.pass }}" immich_svc: - domain: gallery.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 2283 version: release db: diff --git a/playbooks/roles/influxdb/vars/main.yml b/playbooks/roles/influxdb/vars/main.yml index 5d8217f..1769065 100644 --- a/playbooks/roles/influxdb/vars/main.yml +++ b/playbooks/roles/influxdb/vars/main.yml @@ -1,6 +1,6 @@ --- influxdb_svc: - domain: tick.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 8086 data_dir: /var/lib/influxdb2 diff --git a/playbooks/roles/jellyfin/vars/main.yml b/playbooks/roles/jellyfin/vars/main.yml index 321fedb..91472aa 100644 --- a/playbooks/roles/jellyfin/vars/main.yml +++ b/playbooks/roles/jellyfin/vars/main.yml @@ -1,6 +1,6 @@ --- jellyfin_svc: - domain: media.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 8096 db: host: "{{ postgres.host }}" diff --git a/playbooks/roles/linkwarden/vars/main.yml b/playbooks/roles/linkwarden/vars/main.yml index cd0b26a..220e28a 100644 --- a/playbooks/roles/linkwarden/vars/main.yml +++ b/playbooks/roles/linkwarden/vars/main.yml @@ -10,7 +10,7 @@ linkwarden_s3_accesskey: "{{ opentofu.scaleway_data.linkwarden.access_key }}" linkwarden_s3_secretkey: "{{ opentofu.scaleway_data.linkwarden.secret_key }}" linkwarden_svc: - domain: bookmarks.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 3000 linkwarden_env: diff --git a/playbooks/roles/mailcowdockerized/vars/main.yml b/playbooks/roles/mailcowdockerized/vars/main.yml index a87735f..d4194f7 100644 --- a/playbooks/roles/mailcowdockerized/vars/main.yml +++ b/playbooks/roles/mailcowdockerized/vars/main.yml @@ -1,6 +1,6 @@ --- mailcowdockerized_svc: - domain: mail.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" docker_host: host.docker.internal port: 3004 additional_domains: "{{ ['autodiscover', 'autoconfig'] | product(vault_mailcowdockerized.domains) | map('join', '.') }}" diff --git a/playbooks/roles/minio/vars/main.yml b/playbooks/roles/minio/vars/main.yml index 07d51f0..e1721c6 100644 --- a/playbooks/roles/minio/vars/main.yml +++ b/playbooks/roles/minio/vars/main.yml @@ -1,6 +1,6 @@ --- minio_svc: - domain: s3.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 9000 caddy_extra: | @nocache { diff --git a/playbooks/roles/ntfy/vars/main.yml b/playbooks/roles/ntfy/vars/main.yml index 17f9558..d5631c9 100644 --- a/playbooks/roles/ntfy/vars/main.yml +++ b/playbooks/roles/ntfy/vars/main.yml @@ -1,6 +1,6 @@ --- ntfy_svc: - domain: push.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 80 ntfy_env: diff --git a/playbooks/roles/reitanlage_oranienburg/vars/main.yml b/playbooks/roles/reitanlage_oranienburg/vars/main.yml index 8273a8f..2eaa0fb 100644 --- a/playbooks/roles/reitanlage_oranienburg/vars/main.yml +++ b/playbooks/roles/reitanlage_oranienburg/vars/main.yml @@ -1,6 +1,6 @@ --- reitanlage_oranienburg_svc: - domain: reitanlage-oranienburg.de + domain: "{{ all_services | service_get_domain(role_name) }}" www_domain: true port: 80 caddy_extra: | diff --git a/playbooks/roles/shlink/vars/main.yml b/playbooks/roles/shlink/vars/main.yml index 4c7c6d4..9c4e887 100644 --- a/playbooks/roles/shlink/vars/main.yml +++ b/playbooks/roles/shlink/vars/main.yml @@ -1,6 +1,6 @@ --- shlink_svc: - domain: msrg.cc + domain: "{{ all_services | service_get_domain(role_name) }}" additional_domains: - "emgauwa.app" port: 8080 diff --git a/playbooks/roles/synapse/vars/main.yml b/playbooks/roles/synapse/vars/main.yml index 1dc9035..d17e736 100644 --- a/playbooks/roles/synapse/vars/main.yml +++ b/playbooks/roles/synapse/vars/main.yml @@ -1,6 +1,6 @@ --- synapse_svc: - domain: matrix.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" docker_host: synapse-admin port: 80 caddy_extra: | diff --git a/playbooks/roles/tandoor/vars/main.yml b/playbooks/roles/tandoor/vars/main.yml index a9a5a11..2c73b78 100644 --- a/playbooks/roles/tandoor/vars/main.yml +++ b/playbooks/roles/tandoor/vars/main.yml @@ -1,6 +1,6 @@ --- tandoor_svc: - domain: recipes.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 80 db: host: "{{ postgres.host }}" diff --git a/playbooks/roles/teamspeak_fallback/vars/main.yml b/playbooks/roles/teamspeak_fallback/vars/main.yml index 121f2ef..1cb77ce 100644 --- a/playbooks/roles/teamspeak_fallback/vars/main.yml +++ b/playbooks/roles/teamspeak_fallback/vars/main.yml @@ -8,7 +8,7 @@ teamspeak_fallback_user: 9987 teamspeak_fallback_group: 9987 teamspeak_fallback_svc: - domain: ts.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" additional_domains: - hook.serguzim.me port: 9000 diff --git a/playbooks/roles/tinytinyrss/vars/main.yml b/playbooks/roles/tinytinyrss/vars/main.yml index 7a5dd1f..3a73fd8 100644 --- a/playbooks/roles/tinytinyrss/vars/main.yml +++ b/playbooks/roles/tinytinyrss/vars/main.yml @@ -1,6 +1,6 @@ --- tinytinyrss_svc: - domain: rss.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 80 db: host: "{{ postgres.host }}" diff --git a/playbooks/roles/umami/vars/main.yml b/playbooks/roles/umami/vars/main.yml index dbe1849..eaad8e8 100644 --- a/playbooks/roles/umami/vars/main.yml +++ b/playbooks/roles/umami/vars/main.yml @@ -9,7 +9,7 @@ umami_hash_salt: "{{ vault_umami.hash_salt }}" umami_docker_image: docker.umami.dev/umami-software/umami:postgresql-latest umami_svc: - domain: analytics.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 3000 umami_env: diff --git a/playbooks/roles/vikunja/vars/main.yml b/playbooks/roles/vikunja/vars/main.yml index e5c3c2c..f5c6848 100644 --- a/playbooks/roles/vikunja/vars/main.yml +++ b/playbooks/roles/vikunja/vars/main.yml @@ -1,6 +1,6 @@ --- vikunja_svc: - domain: todo.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 3456 db: host: "{{ postgres.host }}" diff --git a/playbooks/roles/wiki_js/vars/main.yml b/playbooks/roles/wiki_js/vars/main.yml index baa7863..91f46ff 100644 --- a/playbooks/roles/wiki_js/vars/main.yml +++ b/playbooks/roles/wiki_js/vars/main.yml @@ -1,6 +1,6 @@ --- wiki_js_svc: - domain: wiki.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 3000 caddy_extra: | import analytics diff --git a/playbooks/roles/woodpecker/vars/main.yml b/playbooks/roles/woodpecker/vars/main.yml index ce50125..96fbf3f 100644 --- a/playbooks/roles/woodpecker/vars/main.yml +++ b/playbooks/roles/woodpecker/vars/main.yml @@ -1,6 +1,6 @@ --- woodpecker_svc: - domain: ci.serguzim.me + domain: "{{ all_services | service_get_domain(role_name) }}" port: 8000 extra_svcs: - domain: agents.ci.serguzim.me