Ansible: рестарт контейнеров переведён на handlers
- caddyproxy, netdata, authelia, bifrost, remembos: конфиг-задачи нотифаят handler "Restart application" вместо безусловного или условного рестарта - ansible.cfg: force_handlers, иначе упавший прогон теряет notify и рестарт, применяющий правку конфига, не случится уже никогда - authelia рестартит только authelia_app, чтобы не сбрасывать сессии в redis
This commit is contained in:
+11
-1
@@ -44,6 +44,7 @@
|
||||
owner: "{{ app_user }}"
|
||||
group: "{{ app_user }}"
|
||||
mode: "0640"
|
||||
notify: "Restart application"
|
||||
|
||||
- name: "Find all go.d plugin config files"
|
||||
ansible.builtin.find:
|
||||
@@ -60,6 +61,7 @@
|
||||
group: "{{ app_user }}"
|
||||
mode: "0640"
|
||||
loop: "{{ go_d_source_files.files }}"
|
||||
notify: "Restart application"
|
||||
|
||||
- name: "Find existing go.d config files on server"
|
||||
ansible.builtin.find:
|
||||
@@ -73,6 +75,7 @@
|
||||
state: absent
|
||||
loop: "{{ go_d_existing_files.files }}"
|
||||
when: (item.path | basename) not in (go_d_source_files.files | map(attribute='path') | map('basename') | list)
|
||||
notify: "Restart application"
|
||||
|
||||
- name: "Find all health.d config files"
|
||||
ansible.builtin.find:
|
||||
@@ -89,6 +92,7 @@
|
||||
group: "{{ app_user }}"
|
||||
mode: "0640"
|
||||
loop: "{{ health_d_source_files.files }}"
|
||||
notify: "Restart application"
|
||||
|
||||
- name: "Find existing health.d config files on server"
|
||||
ansible.builtin.find:
|
||||
@@ -102,6 +106,7 @@
|
||||
state: absent
|
||||
loop: "{{ health_d_existing_files.files }}"
|
||||
when: (item.path | basename) not in (health_d_source_files.files | map(attribute='path') | map('basename') | list)
|
||||
notify: "Restart application"
|
||||
|
||||
- name: "Copy health alarm notify config"
|
||||
ansible.builtin.template:
|
||||
@@ -110,6 +115,7 @@
|
||||
owner: "{{ app_user }}"
|
||||
group: "{{ app_user }}"
|
||||
mode: "0640"
|
||||
notify: "Restart application"
|
||||
|
||||
- name: "Grab docker group id."
|
||||
ansible.builtin.shell:
|
||||
@@ -136,7 +142,11 @@
|
||||
tags:
|
||||
- run-app
|
||||
|
||||
- name: "Restart application with docker compose"
|
||||
handlers:
|
||||
# Приложение читает конфиги только при старте, а `state: present` не
|
||||
# пересоздаёт контейнер, если docker-compose.yml не изменился, — поэтому
|
||||
# правку конфига применяет только явный рестарт.
|
||||
- name: "Restart application"
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ base_dir }}"
|
||||
state: "restarted"
|
||||
|
||||
Reference in New Issue
Block a user