Transform some handlers into tasks. Add the image pull policy.

This commit is contained in:
Andrea Dell'Amico 2024-04-09 15:00:33 +02:00
parent df94a67fd2
commit 9e8361dd69
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
4 changed files with 16 additions and 16 deletions

View File

@ -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'

View File

@ -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

View File

@ -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:

View File

@ -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 }}