2020-04-10 21:44:53 +00:00
|
|
|
---
|
|
|
|
|
2020-04-19 08:16:01 +00:00
|
|
|
- name: Populate service facts
|
2022-07-18 08:22:05 +00:00
|
|
|
ansible.builtin.service_facts:
|
2020-04-19 08:16:01 +00:00
|
|
|
|
|
|
|
- name: Ensure any worker services are stopped
|
2022-07-18 07:39:08 +00:00
|
|
|
ansible.builtin.service:
|
2020-04-19 08:16:01 +00:00
|
|
|
name: "{{ item.key }}"
|
2020-04-10 21:44:53 +00:00
|
|
|
state: stopped
|
2022-07-18 08:22:05 +00:00
|
|
|
with_dict: "{{ ansible_facts.services | default({})|dict2items|selectattr('key', 'match', 'matrix-synapse-worker-.+\\.service')|list|items2dict }}"
|
2022-02-05 20:32:54 +00:00
|
|
|
when: "item.value['status'] != 'not-found'" # see https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1461
|
2020-04-10 21:44:53 +00:00
|
|
|
|
2020-12-01 21:20:27 +00:00
|
|
|
- name: Find worker configs to be cleaned
|
2022-07-18 08:22:05 +00:00
|
|
|
ansible.builtin.find:
|
2020-12-01 21:20:27 +00:00
|
|
|
path: "{{ matrix_synapse_config_dir_path }}"
|
|
|
|
patterns: "worker.*.yaml"
|
|
|
|
use_regex: true
|
2021-01-25 10:14:46 +00:00
|
|
|
register: matrix_synapse_workers_current_config_files
|
2020-12-01 21:20:27 +00:00
|
|
|
|
2021-01-25 10:14:46 +00:00
|
|
|
- name: Ensure previous worker configs are cleaned
|
2022-07-18 07:39:08 +00:00
|
|
|
ansible.builtin.file:
|
2020-12-01 21:20:27 +00:00
|
|
|
path: "{{ item.path }}"
|
2020-10-23 18:49:53 +00:00
|
|
|
state: absent
|
2021-01-25 10:14:46 +00:00
|
|
|
with_items: "{{ matrix_synapse_workers_current_config_files.files }}"
|
2020-10-23 18:49:53 +00:00
|
|
|
|
2021-01-25 10:14:46 +00:00
|
|
|
- name: Find worker systemd services to be cleaned
|
2022-07-18 08:22:05 +00:00
|
|
|
ansible.builtin.find:
|
2021-01-25 10:14:46 +00:00
|
|
|
path: "{{ matrix_systemd_path }}"
|
|
|
|
patterns: "matrix-synapse-worker.*.service"
|
|
|
|
use_regex: true
|
|
|
|
register: matrix_synapse_workers_current_systemd_services
|
2020-10-22 18:53:41 +00:00
|
|
|
|
2021-01-25 10:14:46 +00:00
|
|
|
- name: Ensure previous worker systemd services are cleaned
|
2022-07-18 07:39:08 +00:00
|
|
|
ansible.builtin.file:
|
2021-01-25 10:14:46 +00:00
|
|
|
path: "{{ item.path }}"
|
2020-10-22 18:53:41 +00:00
|
|
|
state: absent
|
2021-01-25 10:14:46 +00:00
|
|
|
with_items: "{{ matrix_synapse_workers_current_systemd_services.files }}"
|