Restart Mailman 3 containers when configs change
Add a handler for restarting Mailman 3 containers if they're up, and notify it from all of the copy tasks for configuration files. Check for the uwsgi processes that Django runs under to determine whether the containers are running. Change-Id: I73be59be773fdde100999c7872520aab1d9e2066
This commit is contained in:
parent
920afd7087
commit
eec60a2cb9
@ -7,3 +7,6 @@
|
||||
service:
|
||||
name: apache2
|
||||
state: reloaded
|
||||
|
||||
- name: mailman restart containers
|
||||
include_tasks: roles/mailman3/handlers/restart_mailman.yaml
|
||||
|
15
playbooks/roles/mailman3/handlers/restart_mailman.yaml
Normal file
15
playbooks/roles/mailman3/handlers/restart_mailman.yaml
Normal 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
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user