`matrix_synapse_workers_generic_worker_client_server_endpoints` and
`matrix_synapse_workers_generic_worker_federation_endpoints` dropped the
non-matching entries with `difference([none])`. ansible-core implements
`difference` as `list(set(a) - set(b))`, so the result follows Python's
per-process string hash seed and comes out in a different order on every
run.
The reverse-proxy companion renders these lists as nginx `location`
blocks, so its `conf.d/matrix-synapse-reverse-proxy-companion.conf`
changed, and the companion restarted, on every run, even with nothing
else to change.
`reject('none')` drops the same entries and keeps the order of
`matrix_synapse_workers_generic_worker_endpoints`. All these locations
point to the same upstream, so routing is unchanged.
Conditional restart is enabled whenever no setup-* tag is selected, so it
also applies to runs with only start or restart tags. These runs skip
the install tasks that set each role's *_restart_necessary, so every
service whose value is false is only started. When the rule was added,
only Traefik tracked its changes this way; now most roles do, so
`just start-all` and `just start-group` restart almost nothing, contrary
to docs/just.md.
Enable conditional restart only when an install-* tag is selected and no
setup-* tag. install-* runs keep conditional restart and setup-* runs are
unchanged; runs with only start or restart tags restart their targeted
services unconditionally again. Show the restart behavior of each
standard recipe in docs/just.md and announce the change in CHANGELOG.md.
The skip list has disabled no-jinja-nesting since 2022. ansible-lint
v6.6.0 replaced that rule with jinja[invalid], and ansible-lint still
maps the old name to it, so the skip now turns off the Jinja syntax
check for tasks in roles/custom, the only path the ansible-lint hook
lints. Remove the skip.
roles/custom has no jinja[invalid] findings at this commit. A syntax
error planted in a task's arguments is reported with this change and
not without it; one planted in a role's defaults file is not reported
either way.
With conditional restart (install-* tags), the homeserver entry for
Synapse fell through to `restart_necessary: true`, and the worker
entries carried no flag at all, which systemd_service_manager also
treats as "restart". Every install-all and install-service synapse
therefore restarted Synapse and all of its workers, even when nothing
had changed. Without workers, systemd also restarted most bridges and
bots, whose units require matrix-synapse.service.
Compute matrix_synapse_restart_necessary from the tasks that install
what Synapse runs: homeserver.yaml, the initial config and signing key,
the log config, labels and systemd service, the container image (pulled,
self-built or customized), each worker's config, labels and systemd
service, and the downloaded or cloned extension modules. Workers follow
the same decision, as they read the same files.
Synapse also mounts the appservice registration files written by other
roles. Add matrix_homeserver_app_service_registration_changed in
group_vars/matrix_servers, which checks the registered result of each
task installing one of the files listed in
matrix_homeserver_container_extra_arguments_auto, so that a changed
registration still restarts Synapse and its workers. The double-puppet
role did not register its result; it does now.
The Synapse image pull and three extension downloads all registered
their result as `result`. The downloads run first, so the pull's result
overwrote theirs before the restart decision could read them; they now
use role-prefixed names.
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.