3
0
mirror of https://github.com/spantaleev/matrix-docker-ansible-deploy.git synced 2026-03-25 22:17:25 +00:00

Add conditional restart support to matrix-synapse-s3-storage-provider-migrate

Register env, database config, scripts, and systemd service/timer results,
compute matrix_synapse_s3_storage_provider_restart_necessary, and wire it
into group_vars/matrix_servers instead of hardcoding restart_necessary: true.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Slavi Pantaleev
2026-03-22 10:21:59 +02:00
parent 27a2b126bc
commit b3a0f52824
3 changed files with 25 additions and 1 deletions

View File

@@ -850,7 +850,7 @@ devture_systemd_service_manager_services_list_auto: |
([{
'name': 'matrix-synapse-s3-storage-provider-migrate.timer',
'priority': 5000,
'restart_necessary': true,
'restart_necessary': (matrix_synapse_s3_storage_provider_restart_necessary | bool),
'groups': ['matrix'],
}] if (matrix_synapse_enabled and matrix_synapse_ext_synapse_s3_storage_provider_enabled) else [])
+

View File

@@ -125,6 +125,17 @@ matrix_synapse_ext_s3_storage_provider_data_path: "{{ matrix_synapse_ext_s3_stor
# extra arguments to pass to s3-storage-provider script when starting Synapse container
matrix_synapse_ext_s3_storage_provider_container_arguments: []
# matrix_synapse_s3_storage_provider_restart_necessary controls whether the
# s3-storage-provider migrate timer 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 or the systemd service/timer files 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_synapse_s3_storage_provider_restart_necessary: false
matrix_synapse_container_client_api_port: 8008
# Controls the `x_forwarded` setting for the "Insecure HTTP listener (Client API)".

View File

@@ -27,12 +27,14 @@
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/env.j2"
dest: "{{ matrix_synapse_ext_s3_storage_provider_base_path }}/env"
mode: '0640'
register: matrix_synapse_s3_storage_provider_env_result
- name: Ensure s3-storage-provider database.yaml file installed
ansible.builtin.template:
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/database.yaml.j2"
dest: "{{ matrix_synapse_ext_s3_storage_provider_data_path }}/database.yaml"
mode: '0640'
register: matrix_synapse_s3_storage_provider_database_config_result
- name: Ensure s3-storage-provider scripts installed
ansible.builtin.template:
@@ -42,6 +44,7 @@
with_items:
- shell
- migrate
register: matrix_synapse_s3_storage_provider_scripts_result
- name: Ensure matrix-synapse-s3-storage-provider-migrate.service and timer are installed
ansible.builtin.template:
@@ -52,3 +55,13 @@
- matrix-synapse-s3-storage-provider-migrate.service
- matrix-synapse-s3-storage-provider-migrate.timer
register: matrix_synapse_s3_storage_provider_systemd_service_result
- name: Determine whether s3-storage-provider migrate timer needs a restart
ansible.builtin.set_fact:
matrix_synapse_s3_storage_provider_restart_necessary: >-
{{
matrix_synapse_s3_storage_provider_env_result.changed | default(false)
or matrix_synapse_s3_storage_provider_database_config_result.changed | default(false)
or matrix_synapse_s3_storage_provider_scripts_result.changed | default(false)
or matrix_synapse_s3_storage_provider_systemd_service_result.changed | default(false)
}}