2020-04-10 21:44:53 +00:00
|
|
|
---
|
|
|
|
|
2020-04-19 08:16:01 +00:00
|
|
|
- name: Populate service facts
|
|
|
|
service_facts:
|
|
|
|
|
|
|
|
- name: Ensure any worker services are stopped
|
2020-04-10 21:44:53 +00:00
|
|
|
service:
|
2020-04-19 08:16:01 +00:00
|
|
|
name: "{{ item.key }}"
|
2020-04-10 21:44:53 +00:00
|
|
|
state: stopped
|
2020-04-19 08:16:01 +00:00
|
|
|
with_dict: "{{ ansible_facts.services|default({})|dict2items|selectattr('key', 'match', 'matrix-synapse-worker@.+\\.service')|list|items2dict }}"
|
2020-04-10 21:44:53 +00:00
|
|
|
|
2020-10-23 18:49:53 +00:00
|
|
|
- name: Ensure worker service symlinks are cleaned
|
2020-04-10 21:44:53 +00:00
|
|
|
file:
|
|
|
|
path: "{{ item.root + '/' + item.path }}"
|
|
|
|
state: absent
|
|
|
|
when:
|
|
|
|
- item.state == 'link'
|
2020-04-19 08:16:01 +00:00
|
|
|
- item.path is match('matrix-synapse-worker@.*\\.service')
|
2020-04-10 21:44:53 +00: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
|
|
|
|
|
2020-10-23 18:49:53 +00:00
|
|
|
- name: Ensure worker configs are cleaned
|
|
|
|
file:
|
2020-10-28 22:09:21 +00:00
|
|
|
path: "{{ item }}"
|
2020-10-23 18:49:53 +00:00
|
|
|
state: absent
|
|
|
|
with_fileglob:
|
|
|
|
- "{{ matrix_synapse_config_dir_path }}/worker.*.yaml"
|
|
|
|
|
2020-04-10 21:44:53 +00:00
|
|
|
- name: Remove workers from synapse.wants list
|
|
|
|
set_fact:
|
2020-10-28 22:09:21 +00:00
|
|
|
matrix_synapse_systemd_wanted_services_list: "{{ matrix_synapse_systemd_wanted_services_list | reject('search', '^matrix-synapse-worker@') | list }}"
|
2020-04-10 21:44:53 +00:00
|
|
|
|
|
|
|
- name: Ensure systemd noticed removal of worker service units
|
|
|
|
service:
|
|
|
|
daemon_reload: yes
|
2020-10-22 18:53:41 +00:00
|
|
|
|
|
|
|
- name: Ensure matrix-synapse-worker-write-pid script is removed
|
|
|
|
file:
|
|
|
|
path: "{{ matrix_local_bin_path }}/matrix-synapse-worker-write-pid"
|
|
|
|
state: absent
|