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,
'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 = {}

View file

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

View file

@ -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:

View file

@ -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:

View file

@ -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:

View file

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

View file

@ -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() }}"

View file

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

View file

@ -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:

View file

@ -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

View file

@ -1,6 +1,6 @@
---
jellyfin_svc:
domain: media.serguzim.me
domain: "{{ all_services | service_get_domain(role_name) }}"
port: 8096
db:
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_svc:
domain: bookmarks.serguzim.me
domain: "{{ all_services | service_get_domain(role_name) }}"
port: 3000
linkwarden_env:

View file

@ -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', '.') }}"

View file

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

View file

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

View file

@ -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: |

View file

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

View file

@ -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: |

View file

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

View file

@ -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

View file

@ -1,6 +1,6 @@
---
tinytinyrss_svc:
domain: rss.serguzim.me
domain: "{{ all_services | service_get_domain(role_name) }}"
port: 80
db:
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_svc:
domain: analytics.serguzim.me
domain: "{{ all_services | service_get_domain(role_name) }}"
port: 3000
umami_env:

View file

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

View file

@ -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

View file

@ -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