matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/workers/setup_uninstall.yml
Marcel Partap 353bc7c362 Add initial support for synapse workers
· needs documentation; no checks yet for port clashes or typos in worker name
· according to https://github.com/matrix-org/synapse/wiki/Workers-setup-with-nginx#results
  about 90% of requests go to the synchrotron endpoint
· thus, the synchrotron worker is especially suited to be load-balanced
· most of the other workers are documented to support only a single instance
· https://github.com/matrix-org/synapse/blob/master/docs/workers.md
2020-04-19 19:05:03 +02:00

35 lines
1.2 KiB
YAML

---
- name: Ensure individual worker services are stopped
service:
name: "matrix-synapse-worker@{{ item.worker }}:{{ item.port }}.service"
state: stopped
with_items: "{{ matrix_synapse_workers_enabled_list }}"
# As we cannot know the ports of workers removed from the enabled_list..
# => .. just kill them all (FIXME?)
- name: Ensure previous worker service symlinks are cleaned
file:
path: "{{ item.root + '/' + item.path }}"
state: absent
when:
- item.state == 'link'
- item.path is match('matrix-synapse-worker@*.service')
with_filetree:
- "{{ matrix_systemd_path }}/matrix-synapse.service.wants"
- name: Ensure synapse worker base service file gets removed
file:
path: "{{ matrix_systemd_path }}/matrix-synapse-worker@.service"
state: absent
register: matrix_synapse_worker_systemd_service_result
- name: Remove workers from synapse.wants list
set_fact:
matrix_synapse_systemd_wanted_services_list: "{{ matrix_synapse_systemd_wanted_services_list | reject('search', item) | list }}"
with_items: "{{ matrix_synapse_workers_avail_list }}"
- name: Ensure systemd noticed removal of worker service units
service:
daemon_reload: yes