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 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:
@@ -850,7 +850,7 @@ devture_systemd_service_manager_services_list_auto: |
|
|||||||
([{
|
([{
|
||||||
'name': 'matrix-synapse-s3-storage-provider-migrate.timer',
|
'name': 'matrix-synapse-s3-storage-provider-migrate.timer',
|
||||||
'priority': 5000,
|
'priority': 5000,
|
||||||
'restart_necessary': true,
|
'restart_necessary': (matrix_synapse_s3_storage_provider_restart_necessary | bool),
|
||||||
'groups': ['matrix'],
|
'groups': ['matrix'],
|
||||||
}] if (matrix_synapse_enabled and matrix_synapse_ext_synapse_s3_storage_provider_enabled) else [])
|
}] if (matrix_synapse_enabled and matrix_synapse_ext_synapse_s3_storage_provider_enabled) else [])
|
||||||
+
|
+
|
||||||
|
|||||||
@@ -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
|
# extra arguments to pass to s3-storage-provider script when starting Synapse container
|
||||||
matrix_synapse_ext_s3_storage_provider_container_arguments: []
|
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
|
matrix_synapse_container_client_api_port: 8008
|
||||||
|
|
||||||
# Controls the `x_forwarded` setting for the "Insecure HTTP listener (Client API)".
|
# Controls the `x_forwarded` setting for the "Insecure HTTP listener (Client API)".
|
||||||
|
|||||||
@@ -27,12 +27,14 @@
|
|||||||
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/env.j2"
|
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/env.j2"
|
||||||
dest: "{{ matrix_synapse_ext_s3_storage_provider_base_path }}/env"
|
dest: "{{ matrix_synapse_ext_s3_storage_provider_base_path }}/env"
|
||||||
mode: '0640'
|
mode: '0640'
|
||||||
|
register: matrix_synapse_s3_storage_provider_env_result
|
||||||
|
|
||||||
- name: Ensure s3-storage-provider database.yaml file installed
|
- name: Ensure s3-storage-provider database.yaml file installed
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/database.yaml.j2"
|
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/database.yaml.j2"
|
||||||
dest: "{{ matrix_synapse_ext_s3_storage_provider_data_path }}/database.yaml"
|
dest: "{{ matrix_synapse_ext_s3_storage_provider_data_path }}/database.yaml"
|
||||||
mode: '0640'
|
mode: '0640'
|
||||||
|
register: matrix_synapse_s3_storage_provider_database_config_result
|
||||||
|
|
||||||
- name: Ensure s3-storage-provider scripts installed
|
- name: Ensure s3-storage-provider scripts installed
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
@@ -42,6 +44,7 @@
|
|||||||
with_items:
|
with_items:
|
||||||
- shell
|
- shell
|
||||||
- migrate
|
- migrate
|
||||||
|
register: matrix_synapse_s3_storage_provider_scripts_result
|
||||||
|
|
||||||
- name: Ensure matrix-synapse-s3-storage-provider-migrate.service and timer are installed
|
- name: Ensure matrix-synapse-s3-storage-provider-migrate.service and timer are installed
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
@@ -52,3 +55,13 @@
|
|||||||
- matrix-synapse-s3-storage-provider-migrate.service
|
- matrix-synapse-s3-storage-provider-migrate.service
|
||||||
- matrix-synapse-s3-storage-provider-migrate.timer
|
- matrix-synapse-s3-storage-provider-migrate.timer
|
||||||
register: matrix_synapse_s3_storage_provider_systemd_service_result
|
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)
|
||||||
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user