diff --git a/defaults/main.yml b/defaults/main.yml index 84f6799..f401982 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -70,6 +70,8 @@ shinyproxy_docker_privileged: 'false' shinyproxy_docker_cpu_limit: 1 shinyproxy_docker_memory_request: '1g' shinyproxy_docker_memory_limit: '2g' +# Never, IfNotPresent and Always +shinyproxy_docker_image_pull_policy: IfNotPresent shinyproxy_docker_internal_networking: 'false' shinyproxy_container_wait_time: 600000 shinyproxy_docker_loglevel: 'INFO' diff --git a/handlers/main.yml b/handlers/main.yml index 922bb7f..f5f458b 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -3,14 +3,3 @@ ansible.builtin.service: name: shinyproxy state: restarted - -- name: Stop the shinyproxy service - 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 1bf7913..1ee421f 100644 --- a/tasks/shinyproxy_docker_stack_service.yml +++ b/tasks/shinyproxy_docker_stack_service.yml @@ -37,12 +37,20 @@ owner: root group: root mode: "0400" - notify: - - Stop the shinyproxy service - - Create the secret for the application.yml file + register: shinyproxy_conf_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 | Stop the shinyproxy service + community.docker.docker_swarm_service: + name: "{{ shinyproxy_as_docker_stack_name }}_{{ shinyproxy_as_docker_service_name }}" + state: absent + when: shinyproxy_conf_file is changed # noqa: no-handler + + - 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 + when: shinyproxy_conf_file is changed # noqa: no-handler - name: shinyproxy_docker_stack_service | Start the shinyproxy stack community.docker.docker_stack: diff --git a/templates/shinyproxy-conf.yml.j2 b/templates/shinyproxy-conf.yml.j2 index 8fd14d6..ec769a4 100644 --- a/templates/shinyproxy-conf.yml.j2 +++ b/templates/shinyproxy-conf.yml.j2 @@ -48,6 +48,7 @@ proxy: container-memory-request: {{ shinyproxy_docker_memory_request }} container-memory-limit: {{ shinyproxy_docker_memory_limit }} container-cpu-limit: {{ shinyproxy_docker_cpu_limit }} + image-pull-policy: {{ shinyproxy_docker_image_pull_policy }} {% if not shinyproxy_as_docker_service %} cert-path: {{ shinyproxy_docker_certs_dir }} url: {{ shinyproxy_docker_url }}