From ad2d3c6c06a4366ef0a5b77224abc08c83be9f4c Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Sat, 28 Sep 2024 02:59:34 +0200 Subject: [PATCH] Add more service databases to terraform --- playbooks/node002.yml | 4 +-- roles/acme_dns/vars/main.yml | 4 +-- roles/healthcheck/files/Dockerfile | 3 +- roles/healthcheck/tasks/docker.yml | 6 ++-- .../docker-compose.yml.j2} | 2 -- roles/tinytinyrss/vars/main.yml | 4 +-- roles/umami/vars/main.yml | 4 +-- roles/wiki_js/vars/main.yml | 6 ++-- services.auto.tfvars | 28 ++++++++++++++++--- 9 files changed, 39 insertions(+), 22 deletions(-) rename roles/healthcheck/{files/docker-compose.yml => templates/docker-compose.yml.j2} (96%) diff --git a/playbooks/node002.yml b/playbooks/node002.yml index ae20f1f..77a3ba2 100644 --- a/playbooks/node002.yml +++ b/playbooks/node002.yml @@ -16,7 +16,7 @@ - role: acme_dns - tags: [acme-dns, certificates] + tags: [acme-dns, acme_dns, certificates] - role: authentik tags: [authentik, authentication] - role: coder @@ -72,6 +72,6 @@ - role: webhook tags: [webhook] - role: wiki_js - tags: [wiki-js] + tags: [wiki-js, wiki_js, wiki] - role: woodpecker tags: [woodpecker, ci, development] diff --git a/roles/acme_dns/vars/main.yml b/roles/acme_dns/vars/main.yml index a2b483a..3c68080 100644 --- a/roles/acme_dns/vars/main.yml +++ b/roles/acme_dns/vars/main.yml @@ -10,8 +10,8 @@ acme_dns_svc: db: host: "{{ postgres.host }}" port: "{{ postgres.port }}" - user: "{{ vault_acmedns.db.user }}" - pass: "{{ vault_acmedns.db.pass }}" + user: "{{ opentofu.postgresql_service_roles.acme_dns.name }}" + pass: "{{ opentofu.postgresql_service_roles.acme_dns.password }}" db: acme_dns acme_dns_compose: diff --git a/roles/healthcheck/files/Dockerfile b/roles/healthcheck/files/Dockerfile index de41acf..580128a 100644 --- a/roles/healthcheck/files/Dockerfile +++ b/roles/healthcheck/files/Dockerfile @@ -3,5 +3,4 @@ FROM ubuntu ENV DEBIAN_FRONTEND=noninteractive RUN apt update -y \ - && apt install -y curl dnsutils msmtp gettext-base python3-pip python3-requests \ - && pip install matrix-nio + && apt install -y curl dnsutils msmtp gettext-base python3-matrix-nio python3-requests diff --git a/roles/healthcheck/tasks/docker.yml b/roles/healthcheck/tasks/docker.yml index 626d1fd..28a677d 100644 --- a/roles/healthcheck/tasks/docker.yml +++ b/roles/healthcheck/tasks/docker.yml @@ -1,7 +1,7 @@ --- -- name: Copy the docker-compose file - ansible.builtin.copy: - src: docker-compose.yml +- name: Template the docker-compose file + ansible.builtin.template: + src: docker-compose.yml.j2 dest: "{{ (service_path, 'docker-compose.yml') | path_join }}" mode: "0644" - name: Copy the Dockerfile diff --git a/roles/healthcheck/files/docker-compose.yml b/roles/healthcheck/templates/docker-compose.yml.j2 similarity index 96% rename from roles/healthcheck/files/docker-compose.yml rename to roles/healthcheck/templates/docker-compose.yml.j2 index 2deb20d..b073224 100644 --- a/roles/healthcheck/files/docker-compose.yml +++ b/roles/healthcheck/templates/docker-compose.yml.j2 @@ -1,5 +1,3 @@ -version: "3.7" - x-common-elements: &common-elements build: diff --git a/roles/tinytinyrss/vars/main.yml b/roles/tinytinyrss/vars/main.yml index 771ef34..1523405 100644 --- a/roles/tinytinyrss/vars/main.yml +++ b/roles/tinytinyrss/vars/main.yml @@ -7,8 +7,8 @@ tinytinyrss_svc: host: "{{ postgres.host }}" port: "{{ postgres.port }}" database: tinytinyrss - user: "{{ vault_tinytinyrss.db.user }}" - pass: "{{ vault_tinytinyrss.db.pass }}" + user: "{{ opentofu.postgresql_service_roles.tinytinyrss.name }}" + pass: "{{ opentofu.postgresql_service_roles.tinytinyrss.password }}" tinytinyrss_env: TTRSS_DB_TYPE: pgsql diff --git a/roles/umami/vars/main.yml b/roles/umami/vars/main.yml index 4240443..1ac1949 100644 --- a/roles/umami/vars/main.yml +++ b/roles/umami/vars/main.yml @@ -1,7 +1,7 @@ --- umami_db_host: "{{ postgres.host }}" -umami_db_user: "{{ vault_umami.db.user }}" -umami_db_pass: "{{ vault_umami.db.pass }}" +umami_db_user: "{{ opentofu.postgresql_service_roles.umami.name }}" +umami_db_pass: "{{ opentofu.postgresql_service_roles.umami.password }}" umami_db_database: umami umami_hash_salt: "{{ vault_umami.hash_salt }}" diff --git a/roles/wiki_js/vars/main.yml b/roles/wiki_js/vars/main.yml index 04dbc5f..e424c4c 100644 --- a/roles/wiki_js/vars/main.yml +++ b/roles/wiki_js/vars/main.yml @@ -8,9 +8,9 @@ wiki_js_svc: db: host: "{{ postgres.host }}" port: "{{ postgres.port }}" - user: "{{ vault_wiki_js.db.user }}" - pass: "{{ vault_wiki_js.db.pass }}" - name: wikijs + user: "{{ opentofu.postgresql_service_roles.wiki_js.name }}" + pass: "{{ opentofu.postgresql_service_roles.wiki_js.password }}" + name: wiki_js wiki_js_env: DB_TYPE: postgres diff --git a/services.auto.tfvars b/services.auto.tfvars index 0229caf..4f7b8b1 100644 --- a/services.auto.tfvars +++ b/services.auto.tfvars @@ -1,12 +1,32 @@ services = { - "linkwarden" = { - name = "linkwarden" - bucket = true + "acme_dns" = { + name = "acme_dns" + bucket = false database = true }, "forgejo" = { name = "forgejo" bucket = true database = true - } + }, + "linkwarden" = { + name = "linkwarden" + bucket = true + database = true + }, + "tinytinyrss" = { + name = "tinytinyrss" + bucket = false + database = true + }, + "umami" = { + name = "umami" + bucket = false + database = true + }, + "wiki_js" = { + name = "wiki_js" + bucket = false + database = true + }, }