From 4fd118fde60f7ee5fc57e15b018599e9bb580247 Mon Sep 17 00:00:00 2001 From: Sheppy Date: Sun, 15 Jan 2023 18:33:56 +0100 Subject: [PATCH] feat: services var --- .gitignore | 1 - roles/web1/tasks/main.yaml | 9 ++++++--- templates/waitress-systemd-unit.j2 | 2 +- vars/services.yaml | 9 +++++++++ 4 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 vars/services.yaml diff --git a/.gitignore b/.gitignore index 95ad593..9fb9092 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,3 @@ files/nsca_server.conf files/async-icinga-config-dynamic.json files/async-icinga-services-dynamic.conf hosts.ini -vars/ diff --git a/roles/web1/tasks/main.yaml b/roles/web1/tasks/main.yaml index 1146b17..90a9373 100644 --- a/roles/web1/tasks/main.yaml +++ b/roles/web1/tasks/main.yaml @@ -1,3 +1,6 @@ +- name: Include service variables + include_vars: services.yaml + - name: Install python packages pip: name: @@ -86,9 +89,9 @@ dest: "/etc/systemd/system/{{ item.name }}.service" with_items: - { name : "image-factory", path : "/var/www/python-flask-picture-factory" } - - { name : "serien-ampel", path : "/var/www/serien-ampel" } - - { name : "simple-log-server", path : "/var/www/simple-log-server" } - - { name : "soundlib", path : "/var/www/soundlib-interface" } + - { name : "serien-ampel", path : "/var/www/serien-ampel" } + - { name : "simple-log-server", path : "/var/www/simple-log-server" } + - { name : "soundlib", path : "/var/www/soundlib-interface", external_oidc : true } notify: - daemon reload diff --git a/templates/waitress-systemd-unit.j2 b/templates/waitress-systemd-unit.j2 index e09dfa2..9792829 100644 --- a/templates/waitress-systemd-unit.j2 +++ b/templates/waitress-systemd-unit.j2 @@ -4,7 +4,7 @@ {% set port = services[item.name].port %} {% endif %} -{% if item.get("oidc") %} +{% if item.get("external_oidc") %} {% set port = port + 1000 %} {% endif %} diff --git a/vars/services.yaml b/vars/services.yaml new file mode 100644 index 0000000..016c17a --- /dev/null +++ b/vars/services.yaml @@ -0,0 +1,9 @@ +services: + image-factory: + port: 5000 + serien-ampel: + port: 5001 + simple-log-server: + port: 5002 + soundlib: + port: 5003