From 49fbdce398c0c0196759a9d98359415256b5ae0f Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sun, 26 Jan 2025 17:38:34 +0100 Subject: [PATCH] solved variable bug --- .../templates/container.yml.j2 | 1 - .../templates/oauth2-proxy-keycloak.cfg.j2 | 2 -- tasks/update-repository-with-files.yml | 18 ++++++------------ 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/roles/docker-oauth2-proxy/templates/container.yml.j2 b/roles/docker-oauth2-proxy/templates/container.yml.j2 index 7128a383..4e3f90bc 100644 --- a/roles/docker-oauth2-proxy/templates/container.yml.j2 +++ b/roles/docker-oauth2-proxy/templates/container.yml.j2 @@ -1,5 +1,4 @@ oauth2-proxy: - #image: quay.io/oauth2-proxy/oauth2-proxy:v7.8.1 image: quay.io/oauth2-proxy/oauth2-proxy:{{oauth2_version}} restart: {{docker_restart_policy}} command: --config /oauth2-proxy.cfg diff --git a/roles/docker-oauth2-proxy/templates/oauth2-proxy-keycloak.cfg.j2 b/roles/docker-oauth2-proxy/templates/oauth2-proxy-keycloak.cfg.j2 index 57ded83b..d35289da 100644 --- a/roles/docker-oauth2-proxy/templates/oauth2-proxy-keycloak.cfg.j2 +++ b/roles/docker-oauth2-proxy/templates/oauth2-proxy-keycloak.cfg.j2 @@ -10,8 +10,6 @@ whitelist_domains=[".{{primary_domain}}"] # Required t client_secret="{{oauth2_proxy_client_secret}}" client_id="{{domain}}" redirect_url="https://{{domain}}/oauth2/callback" - -# in this case oauth2-proxy is going to visit oidc_issuer_url="https://{{domain_keycloak}}/realms/{{primary_domain}}" provider="oidc" provider_display_name="Keycloak" \ No newline at end of file diff --git a/tasks/update-repository-with-files.yml b/tasks/update-repository-with-files.yml index 6d1e6991..c53b9df6 100644 --- a/tasks/update-repository-with-files.yml +++ b/tasks/update-repository-with-files.yml @@ -1,13 +1,7 @@ -- name: "Add {{oauth2_configuration_file}} to detached_files if oauth2_proxy_active is true" +- name: "Merge detached_files with oauth2_configuration_file" ansible.builtin.set_fact: - detached_files: >- - {{ - (detached_files | default([])) + - [oauth2_configuration_file] - if oauth2_configuration_file not in (detached_files | default([])) - else detached_files | default([]) - }} - when: oauth2_proxy_active | default(false) + merged_detached_files: "{{ detached_files + [oauth2_configuration_file] }}" + when: oauth2_proxy_active - name: "backup detached files" command: > @@ -15,7 +9,7 @@ args: removes: "{{docker_compose_instance_directory}}{{ item }}" become: true - loop: "{{ detached_files }}" + loop: "{{ merged_detached_files }}" - name: checkout repository ansible.builtin.shell: git checkout . @@ -38,9 +32,9 @@ args: removes: "/tmp/{{docker_compose_project_name}}-{{ item }}.backup" become: true - loop: "{{ detached_files }}" + loop: "{{ merged_detached_files }}" -- name: "copy {{ item }}" +- name: "copy {{ detached_files }} templates to server" template: src: "{{ item }}.j2" dest: "{{docker_compose_instance_directory}}{{ item }}"