From a98e9f2971f48a3594e5ad5f728ce6dc2d06b2b1 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 9 Apr 2024 14:37:10 +0200 Subject: [PATCH] Create the secret only when the configuration is changed. --- handlers/main.yml | 6 ++++++ tasks/shinyproxy_docker_stack_service.yml | 10 +++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index e423ec6..922bb7f 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -8,3 +8,9 @@ community.docker.docker_swarm_service: name: "{{ shinyproxy_as_docker_stack_name }}_{{ shinyproxy_as_docker_service_name }}" state: absent + +- name: Create the secret for the application.yml file + community.docker.docker_secret: + name: "{{ shinyproxy_as_docker_stack_name }}_{{ shinyproxy_as_docker_service_name }}_application_yml" + data_src: '{{ shinyproxy_as_docker_src_dir }}/application.yml' + state: present diff --git a/tasks/shinyproxy_docker_stack_service.yml b/tasks/shinyproxy_docker_stack_service.yml index dfa9d1b..1bf7913 100644 --- a/tasks/shinyproxy_docker_stack_service.yml +++ b/tasks/shinyproxy_docker_stack_service.yml @@ -37,17 +37,13 @@ owner: root group: root mode: "0400" - notify: Stop the shinyproxy service + notify: + - Stop the shinyproxy service + - Create the secret for the application.yml file - name: shinyproxy_docker_stack_service | Flush the handlers to stop the shinyproxy service if needed ansible.builtin.meta: flush_handlers - - name: shinyproxy_docker_stack_service | Create the secret for the application.yml file - community.docker.docker_secret: - name: "{{ shinyproxy_as_docker_stack_name }}_{{ shinyproxy_as_docker_service_name }}_application_yml" - data_src: '{{ shinyproxy_as_docker_src_dir }}/application.yml' - state: present - - name: shinyproxy_docker_stack_service | Start the shinyproxy stack community.docker.docker_stack: name: '{{ shinyproxy_as_docker_stack_name }}'