Files
matrix-docker-ansible-deploy/roles/custom/matrix-synapse/tasks/init.yml
T
QEDeDandSlavi Pantaleev c909ff65bd Fix missed service restarts with Synapse workers enabled
With Synapse workers enabled, inject_worker.yml appends each worker's
service to devture_systemd_service_manager_services_list_auto with
set_fact. That templates the whole list, including every service's
restart_necessary value, when the matrix-synapse role initializes, and
the resulting fact outranks group_vars. Services whose restart flag is
set after that point are then only started, not restarted, on install-*
runs even when their configuration changed. That includes the
matrix-synapse role's own reverse-proxy companion, Goofys and S3 storage
provider timer, and the services of every later role that sets a restart
flag (Element, Grafana, Prometheus, Traefik and others).

Collect worker services in matrix_synapse_worker_systemd_services_list
and append it to the auto list in group_vars/matrix_servers, like the
other entries there, so the list stays lazy.

Include inject_worker.yml once and loop inside each task instead of
including it once per worker. With 19 workers this cuts the step from
26.2 s to 5.3 s on ansible-core 2.20.1 (controller-only, one run). Also
fix two stream-writer failure messages that referenced the undefined
`item`, and report all missing worker properties in one message.
2026-10-19 09:08:29 +03:00

30 lines
1.3 KiB
YAML

# SPDX-FileCopyrightText: 2019 - 2024 Slavi Pantaleev
# SPDX-FileCopyrightText: 2019 Dan Arnfield
# SPDX-FileCopyrightText: 2020 Horvath Gergely
# SPDX-FileCopyrightText: 2021 Aaron Raimist
# SPDX-FileCopyrightText: 2022 Marko Weltzer
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
# This validation task is here, not in validate_config.yml,
# because init.yml runs before it.
#
# validate_config.yml aims to validate the configuration based on the work we do,
# so we can't change the order.
- name: Fail when using the old (renamed) room-workers preset
ansible.builtin.fail:
msg: >-
The `room-workers` preset has been renamed to `specialized-workers`. Update your `matrix_synapse_workers_preset` variable to use the new name.
when: matrix_synapse_workers_preset == 'room-workers'
# Unless `matrix_synapse_workers_enabled_list` is explicitly defined,
# we'll generate it dynamically.
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/init.yml"
when: "matrix_synapse_workers_enabled | bool and matrix_synapse_workers_enabled_list | length == 0"
- name: Ensure workers are injected into various places
ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/util/inject_worker.yml"
when: matrix_synapse_workers_enabled | bool