Change roles to get domain from all_services

This commit is contained in:
Tobias Reisinger 2024-10-19 01:01:15 +02:00
parent 6ace704a46
commit bd6409bcc0
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
25 changed files with 37 additions and 24 deletions

View file

@ -4,6 +4,7 @@ class FilterModule(object):
'my_service_attributes': self.my_service_attributes, 'my_service_attributes': self.my_service_attributes,
'services_to_dnscontrol': self.services_to_dnscontrol, 'services_to_dnscontrol': self.services_to_dnscontrol,
'services_get_backups': self.services_get_backups, 'services_get_backups': self.services_get_backups,
'service_get_domain': self.service_get_domain,
} }
def my_service_attributes(self, services, host, attribute="name"): def my_service_attributes(self, services, host, attribute="name"):
@ -24,6 +25,12 @@ class FilterModule(object):
return result 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): def services_get_backups(self, all_services, wanted_services):
result = [] result = []
for service in all_services: for service in all_services:
@ -32,6 +39,12 @@ class FilterModule(object):
result.append(backup["name"]) result.append(backup["name"])
return result 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): def services_to_dnscontrol(self, services):
result = {} result = {}

View file

@ -1,6 +1,6 @@
--- ---
NAME_svc: NAME_svc:
domain: NAME.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 80 port: 80
NAME_env: NAME_env:

View file

@ -1,6 +1,6 @@
--- ---
acme_dns_svc: acme_dns_svc:
domain: "{{ acme_dns.host }}" domain: "{{ all_services | service_get_domain(role_name) }}"
port: 80 port: 80
nsadmin: "{{ admin_email | regex_replace('@', '.') }}" nsadmin: "{{ admin_email | regex_replace('@', '.') }}"
records: records:

View file

@ -1,6 +1,6 @@
--- ---
authentik_svc: authentik_svc:
domain: auth.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 9000 port: 9000
image_tag: 2024.8 image_tag: 2024.8
db: db:

View file

@ -1,6 +1,6 @@
--- ---
faas_svc: faas_svc:
domain: faas.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
docker_host: host.docker.internal docker_host: host.docker.internal
port: 8080 port: 8080
extra_svcs: extra_svcs:

View file

@ -1,6 +1,6 @@
--- ---
forgejo_svc: forgejo_svc:
domain: git.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 3000 port: 3000
caddy_extra: | caddy_extra: |
import analytics import analytics

View file

@ -1,6 +1,6 @@
--- ---
gatus_svc: gatus_svc:
domain: status.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 8080 port: 8080
gatus_external_endpoints_backups: "{{ vault_hosts | vault_hosts_backup_to_gatus() }}" gatus_external_endpoints_backups: "{{ vault_hosts | vault_hosts_backup_to_gatus() }}"

View file

@ -1,6 +1,6 @@
--- ---
homebox_svc: homebox_svc:
domain: inventory.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 7745 port: 7745
homebox_env: homebox_env:

View file

@ -5,7 +5,7 @@ immich_db_user: "{{ vault_immich.db.user }}"
immich_db_pass: "{{ vault_immich.db.pass }}" immich_db_pass: "{{ vault_immich.db.pass }}"
immich_svc: immich_svc:
domain: gallery.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 2283 port: 2283
version: release version: release
db: db:

View file

@ -1,6 +1,6 @@
--- ---
influxdb_svc: influxdb_svc:
domain: tick.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 8086 port: 8086
data_dir: /var/lib/influxdb2 data_dir: /var/lib/influxdb2

View file

@ -1,6 +1,6 @@
--- ---
jellyfin_svc: jellyfin_svc:
domain: media.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 8096 port: 8096
db: db:
host: "{{ postgres.host }}" host: "{{ postgres.host }}"

View file

@ -10,7 +10,7 @@ linkwarden_s3_accesskey: "{{ opentofu.scaleway_data.linkwarden.access_key }}"
linkwarden_s3_secretkey: "{{ opentofu.scaleway_data.linkwarden.secret_key }}" linkwarden_s3_secretkey: "{{ opentofu.scaleway_data.linkwarden.secret_key }}"
linkwarden_svc: linkwarden_svc:
domain: bookmarks.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 3000 port: 3000
linkwarden_env: linkwarden_env:

View file

@ -1,6 +1,6 @@
--- ---
mailcowdockerized_svc: mailcowdockerized_svc:
domain: mail.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
docker_host: host.docker.internal docker_host: host.docker.internal
port: 3004 port: 3004
additional_domains: "{{ ['autodiscover', 'autoconfig'] | product(vault_mailcowdockerized.domains) | map('join', '.') }}" additional_domains: "{{ ['autodiscover', 'autoconfig'] | product(vault_mailcowdockerized.domains) | map('join', '.') }}"

View file

@ -1,6 +1,6 @@
--- ---
minio_svc: minio_svc:
domain: s3.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 9000 port: 9000
caddy_extra: | caddy_extra: |
@nocache { @nocache {

View file

@ -1,6 +1,6 @@
--- ---
ntfy_svc: ntfy_svc:
domain: push.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 80 port: 80
ntfy_env: ntfy_env:

View file

@ -1,6 +1,6 @@
--- ---
reitanlage_oranienburg_svc: reitanlage_oranienburg_svc:
domain: reitanlage-oranienburg.de domain: "{{ all_services | service_get_domain(role_name) }}"
www_domain: true www_domain: true
port: 80 port: 80
caddy_extra: | caddy_extra: |

View file

@ -1,6 +1,6 @@
--- ---
shlink_svc: shlink_svc:
domain: msrg.cc domain: "{{ all_services | service_get_domain(role_name) }}"
additional_domains: additional_domains:
- "emgauwa.app" - "emgauwa.app"
port: 8080 port: 8080

View file

@ -1,6 +1,6 @@
--- ---
synapse_svc: synapse_svc:
domain: matrix.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
docker_host: synapse-admin docker_host: synapse-admin
port: 80 port: 80
caddy_extra: | caddy_extra: |

View file

@ -1,6 +1,6 @@
--- ---
tandoor_svc: tandoor_svc:
domain: recipes.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 80 port: 80
db: db:
host: "{{ postgres.host }}" host: "{{ postgres.host }}"

View file

@ -8,7 +8,7 @@ teamspeak_fallback_user: 9987
teamspeak_fallback_group: 9987 teamspeak_fallback_group: 9987
teamspeak_fallback_svc: teamspeak_fallback_svc:
domain: ts.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
additional_domains: additional_domains:
- hook.serguzim.me - hook.serguzim.me
port: 9000 port: 9000

View file

@ -1,6 +1,6 @@
--- ---
tinytinyrss_svc: tinytinyrss_svc:
domain: rss.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 80 port: 80
db: db:
host: "{{ postgres.host }}" host: "{{ postgres.host }}"

View file

@ -9,7 +9,7 @@ umami_hash_salt: "{{ vault_umami.hash_salt }}"
umami_docker_image: docker.umami.dev/umami-software/umami:postgresql-latest umami_docker_image: docker.umami.dev/umami-software/umami:postgresql-latest
umami_svc: umami_svc:
domain: analytics.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 3000 port: 3000
umami_env: umami_env:

View file

@ -1,6 +1,6 @@
--- ---
vikunja_svc: vikunja_svc:
domain: todo.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 3456 port: 3456
db: db:
host: "{{ postgres.host }}" host: "{{ postgres.host }}"

View file

@ -1,6 +1,6 @@
--- ---
wiki_js_svc: wiki_js_svc:
domain: wiki.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 3000 port: 3000
caddy_extra: | caddy_extra: |
import analytics import analytics

View file

@ -1,6 +1,6 @@
--- ---
woodpecker_svc: woodpecker_svc:
domain: ci.serguzim.me domain: "{{ all_services | service_get_domain(role_name) }}"
port: 8000 port: 8000
extra_svcs: extra_svcs:
- domain: agents.ci.serguzim.me - domain: agents.ci.serguzim.me