Merge "Restart Mailman 3 containers when configs change"

This commit is contained in:
Zuul 2023-08-17 19:55:51 +00:00 committed by Gerrit Code Review
commit 508ebe2dfc
3 changed files with 24 additions and 0 deletions

View File

@ -7,3 +7,6 @@
service: service:
name: apache2 name: apache2
state: reloaded state: reloaded
- name: mailman restart containers
include_tasks: roles/mailman3/handlers/restart_mailman.yaml

View File

@ -0,0 +1,15 @@
- name: mailman check for running containers
command: pgrep -f uwsgi
ignore_errors: yes
register: uwsgi_pids
- name: mailman restart containers if running
# Also makes sure the containers weren't just restarted by an image update
when: uwsgi_pids.rc == 0 and "is up-to-date" in mailman_dcup.stdout
block:
- name: down containers
shell:
cmd: docker-compose -f /etc/mailman-compose/docker-compose.yaml down
- name: up containers
shell:
cmd: docker-compose -f /etc/mailman-compose/docker-compose.yaml up -d

View File

@ -43,6 +43,7 @@
owner: 100 owner: 100
group: 65533 group: 65533
mode: '0644' mode: '0644'
notify: mailman restart containers
- name: Ensure Mailman database volume directory exists - name: Ensure Mailman database volume directory exists
file: file:
@ -76,6 +77,7 @@
owner: 100 owner: 100
group: 101 group: 101
mode: '0644' mode: '0644'
notify: mailman restart containers
- name: Check for initial setup flag file - name: Check for initial setup flag file
stat: stat:
@ -100,6 +102,7 @@
owner: 100 owner: 100
group: 101 group: 101
mode: '0644' mode: '0644'
notify: mailman restart containers
- name: Copy our max_allowed_packet override config - name: Copy our max_allowed_packet override config
copy: copy:
@ -108,6 +111,7 @@
owner: 999 owner: 999
group: 999 group: 999
mode: '0644' mode: '0644'
notify: mailman restart containers
- name: Ensure /etc/mailman-compose directory - name: Ensure /etc/mailman-compose directory
file: file:
@ -120,6 +124,7 @@
src: docker-compose.yaml.j2 src: docker-compose.yaml.j2
dest: /etc/mailman-compose/docker-compose.yaml dest: /etc/mailman-compose/docker-compose.yaml
mode: '0600' mode: '0600'
notify: mailman restart containers
- name: Run docker-compose pull - name: Run docker-compose pull
shell: shell:
@ -130,6 +135,7 @@
shell: shell:
cmd: docker-compose up -d cmd: docker-compose up -d
chdir: /etc/mailman-compose/ chdir: /etc/mailman-compose/
register: mailman_dcup
- name: Run docker prune to cleanup unneeded images - name: Run docker prune to cleanup unneeded images
shell: shell: