diff --git a/playbooks/roles/mailman3/handlers/main.yaml b/playbooks/roles/mailman3/handlers/main.yaml index 18f5b3bbc9..b7b3aad496 100644 --- a/playbooks/roles/mailman3/handlers/main.yaml +++ b/playbooks/roles/mailman3/handlers/main.yaml @@ -7,3 +7,6 @@ service: name: apache2 state: reloaded + +- name: mailman restart containers + include_tasks: roles/mailman3/handlers/restart_mailman.yaml diff --git a/playbooks/roles/mailman3/handlers/restart_mailman.yaml b/playbooks/roles/mailman3/handlers/restart_mailman.yaml new file mode 100644 index 0000000000..9a8bc1b009 --- /dev/null +++ b/playbooks/roles/mailman3/handlers/restart_mailman.yaml @@ -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 diff --git a/playbooks/roles/mailman3/tasks/main.yaml b/playbooks/roles/mailman3/tasks/main.yaml index 2ec20efadc..36eba320c1 100644 --- a/playbooks/roles/mailman3/tasks/main.yaml +++ b/playbooks/roles/mailman3/tasks/main.yaml @@ -43,6 +43,7 @@ owner: 100 group: 65533 mode: '0644' + notify: mailman restart containers - name: Ensure Mailman database volume directory exists file: @@ -76,6 +77,7 @@ owner: 100 group: 101 mode: '0644' + notify: mailman restart containers - name: Check for initial setup flag file stat: @@ -100,6 +102,7 @@ owner: 100 group: 101 mode: '0644' + notify: mailman restart containers - name: Copy our max_allowed_packet override config copy: @@ -108,6 +111,7 @@ owner: 999 group: 999 mode: '0644' + notify: mailman restart containers - name: Ensure /etc/mailman-compose directory file: @@ -120,6 +124,7 @@ src: docker-compose.yaml.j2 dest: /etc/mailman-compose/docker-compose.yaml mode: '0600' + notify: mailman restart containers - name: Run docker-compose pull shell: @@ -130,6 +135,7 @@ shell: cmd: docker-compose up -d chdir: /etc/mailman-compose/ + register: mailman_dcup - name: Run docker prune to cleanup unneeded images shell: