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
|
2021-01-25 11:14:46 +01: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
|
|
|
|
2020-12-01 22:20:27 +01:00
|
|
|
- name: Find worker configs to be cleaned
|
|
|
|
find:
|
|
|
|
path: "{{ matrix_synapse_config_dir_path }}"
|
|
|
|
patterns: "worker.*.yaml"
|
|
|
|
use_regex: true
|
2021-01-25 11:14:46 +01:00
|
|
|
register: matrix_synapse_workers_current_config_files
|
2020-12-01 22:20:27 +01:00
|
|
|
|
2021-01-25 11:14:46 +01:00
|
|
|
- name: Ensure previous worker configs are cleaned
|
2020-10-23 20:49:53 +02:00
|
|
|
file:
|
2020-12-01 22:20:27 +01:00
|
|
|
path: "{{ item.path }}"
|
2020-10-23 20:49:53 +02:00
|
|
|
state: absent
|
2021-01-25 11:14:46 +01:00
|
|
|
with_items: "{{ matrix_synapse_workers_current_config_files.files }}"
|
2020-10-23 20:49:53 +02:00
|
|
|
|
2021-01-25 11:14:46 +01:00
|
|
|
- name: Find worker systemd services to be cleaned
|
|
|
|
find:
|
|
|
|
path: "{{ matrix_systemd_path }}"
|
|
|
|
patterns: "matrix-synapse-worker.*.service"
|
|
|
|
use_regex: true
|
|
|
|
register: matrix_synapse_workers_current_systemd_services
|
2020-10-22 20:53:41 +02:00
|
|
|
|
2021-01-25 11:14:46 +01:00
|
|
|
- name: Ensure previous worker systemd services are cleaned
|
2020-10-22 20:53:41 +02:00
|
|
|
file:
|
2021-01-25 11:14:46 +01:00
|
|
|
path: "{{ item.path }}"
|
2020-10-22 20:53:41 +02:00
|
|
|
state: absent
|
2021-01-25 11:14:46 +01:00
|
|
|
with_items: "{{ matrix_synapse_workers_current_systemd_services.files }}"
|