3
0
mirror of https://github.com/spantaleev/matrix-docker-ansible-deploy.git synced 2026-02-28 09:53:09 +00:00

Add conditional restart support to service roles

Track config/image/systemd changes via register: directives and compute
a _restart_necessary variable for each service role, allowing the
systemd_service_manager to skip unnecessary restarts during install-* runs.

Covers 22 service roles: alertmanager-receiver, appservice-draupnir-for-all,
bridge-mautrix-wsproxy (+ syncproxy), cactus-comments, cactus-comments-client,
corporal, element-admin, ldap-registration-proxy, livekit-jwt-service, matrixto,
pantalaimon, prometheus-nginxlog-exporter, rageshake, registration, static-files,
sygnal, synapse-admin, synapse-auto-compressor, synapse-reverse-proxy-companion,
synapse-usage-exporter, and user-verification-service.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Slavi Pantaleev
2026-02-13 16:01:46 +02:00
parent 16010ff8c7
commit 0d86610cbe
43 changed files with 550 additions and 58 deletions

View File

@@ -32,10 +32,10 @@
force_source: "{{ matrix_appservice_draupnir_for_all_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_draupnir_for_all_docker_image_force_pull }}"
when: "not matrix_appservice_draupnir_for_all_container_image_self_build | bool"
register: result
register: matrix_appservice_draupnir_for_all_container_image_pull_result
retries: "{{ devture_playbook_help_container_retries_count }}"
delay: "{{ devture_playbook_help_container_retries_delay }}"
until: result is not failed
until: matrix_appservice_draupnir_for_all_container_image_pull_result is not failed
- name: Ensure Draupnir repository is present on self-build
ansible.builtin.git:
@@ -66,6 +66,7 @@
mode: 0644
owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}"
register: matrix_appservice_draupnir_for_all_appservice_config_result
- name: Ensure matrix-appservice-draupnir-for-all bot config installed
ansible.builtin.copy:
@@ -74,6 +75,7 @@
mode: 0644
owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}"
register: matrix_appservice_draupnir_for_all_bot_config_result
- name: Ensure matrix-appservice-draupnir-for-all registration.yaml installed
ansible.builtin.copy:
@@ -82,6 +84,7 @@
mode: 0644
owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}"
register: matrix_appservice_draupnir_for_all_registration_config_result
- name: Ensure matrix-appservice-draupnir-for-all container network is created
community.general.docker_network:
@@ -97,6 +100,18 @@
mode: 0644
register: matrix_appservice_draupnir_for_all_systemd_service_result
- name: Determine whether Draupnir for All needs a restart
ansible.builtin.set_fact:
matrix_appservice_draupnir_for_all_restart_necessary: >-
{{
matrix_appservice_draupnir_for_all_migration_requires_restart | default(false)
or matrix_appservice_draupnir_for_all_appservice_config_result.changed | default(false)
or matrix_appservice_draupnir_for_all_bot_config_result.changed | default(false)
or matrix_appservice_draupnir_for_all_registration_config_result.changed | default(false)
or matrix_appservice_draupnir_for_all_systemd_service_result.changed | default(false)
or matrix_appservice_draupnir_for_all_container_image_pull_result.changed | default(false)
}}
- name: Ensure matrix-appservice-draupnir-for-all.service restarted, if necessary
ansible.builtin.service:
name: "matrix-appservice-draupnir-for-all.service"