2020-04-10 23:44:53 +02:00
|
|
|
---
|
|
|
|
|
2020-04-19 10:16:01 +02:00
|
|
|
- name: Populate service facts
|
|
|
|
service_facts:
|
|
|
|
|
|
|
|
- name: Ensure any worker services are stopped
|
2020-04-10 23:44:53 +02:00
|
|
|
service:
|
2020-04-19 10:16:01 +02:00
|
|
|
name: "{{ item.key }}"
|
2020-04-10 23:44:53 +02:00
|
|
|
state: stopped
|
2020-04-19 10:16:01 +02:00
|
|
|
with_dict: "{{ ansible_facts.services|default({})|dict2items|selectattr('key', 'match', 'matrix-synapse-worker@.+\\.service')|list|items2dict }}"
|
2020-04-10 23:44:53 +02:00
|
|
|
|
|
|
|
# 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:
|
2020-04-19 10:16:01 +02:00
|
|
|
- not matrix_synapse_workers_enabled|bool
|
2020-04-10 23:44:53 +02:00
|
|
|
- item.state == 'link'
|
2020-04-19 10:16:01 +02:00
|
|
|
- item.path is match('matrix-synapse-worker@.*\\.service')
|
2020-04-10 23:44:53 +02:00
|
|
|
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
|