mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-03-26 06:27:23 +00:00
Add conditional restart support to 7 roles that previously always restarted
Replace hardcoded restart_necessary: true with computed values for: conduit, continuwuity, dendrite, element-call, media-repo, appservice-kakaotalk, and wechat. Each role now registers results from config, support files, systemd service, and docker image pull tasks, then computes a restart_necessary variable from their combined .changed state. group_vars/matrix_servers is updated to reference these variables instead of hardcoding true. For dendrite, the systemd service template was also separated out of the combined support-files with_items loop so it can be independently tracked. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -153,3 +153,13 @@ matrix_element_call_config_default_server_config_m_homeserver_server_name: "{{ m
|
||||
|
||||
# Controls the livekit/livekit_service_url property in the config.json file.
|
||||
matrix_element_call_config_livekit_livekit_service_url: ""
|
||||
|
||||
# matrix_element_call_restart_necessary controls whether the service
|
||||
# will be restarted (when true) or merely started (when false) by the
|
||||
# systemd service manager role (when conditional restart is enabled).
|
||||
#
|
||||
# This value is automatically computed during installation based on whether
|
||||
# any configuration files, the systemd service file, or the container image changed.
|
||||
# The default of `false` means "no restart needed" — appropriate when the role's
|
||||
# installation tasks haven't run (e.g., due to --tags skipping them).
|
||||
matrix_element_call_restart_necessary: false
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
mode: '0640'
|
||||
owner: "{{ matrix_user_name }}"
|
||||
group: "{{ matrix_group_name }}"
|
||||
register: matrix_element_call_config_result
|
||||
|
||||
- name: Ensure Element Call container labels file is in place
|
||||
ansible.builtin.template:
|
||||
@@ -31,16 +32,17 @@
|
||||
mode: '0640'
|
||||
owner: "{{ matrix_user_name }}"
|
||||
group: "{{ matrix_group_name }}"
|
||||
register: matrix_element_call_support_files_result
|
||||
|
||||
- name: Ensure Element Call container image is pulled
|
||||
community.docker.docker_image:
|
||||
name: "{{ matrix_element_call_container_image }}"
|
||||
source: pull
|
||||
force_source: "{{ matrix_element_call_container_image_force_pull }}"
|
||||
register: element_call_image_result
|
||||
register: matrix_element_call_container_image_pull_result
|
||||
retries: "{{ devture_playbook_help_container_retries_count }}"
|
||||
delay: "{{ devture_playbook_help_container_retries_delay }}"
|
||||
until: element_call_image_result is not failed
|
||||
until: matrix_element_call_container_image_pull_result is not failed
|
||||
|
||||
- name: Ensure Element Call container network is created
|
||||
community.general.docker_network:
|
||||
@@ -54,3 +56,14 @@
|
||||
src: "{{ role_path }}/templates/systemd/matrix-element-call.service.j2"
|
||||
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-element-call.service"
|
||||
mode: '0644'
|
||||
register: matrix_element_call_systemd_service_result
|
||||
|
||||
- name: Determine whether Element Call needs a restart
|
||||
ansible.builtin.set_fact:
|
||||
matrix_element_call_restart_necessary: >-
|
||||
{{
|
||||
matrix_element_call_config_result.changed | default(false)
|
||||
or matrix_element_call_support_files_result.changed | default(false)
|
||||
or matrix_element_call_systemd_service_result.changed | default(false)
|
||||
or matrix_element_call_container_image_pull_result.changed | default(false)
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user