matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/synapse/workers/setup_uninstall.yml

38 lines
1.3 KiB
YAML
Raw Normal View History

---
- name: Populate service facts
2022-07-18 08:22:05 +00:00
ansible.builtin.service_facts:
- name: Ensure any worker services are stopped
ansible.builtin.service:
name: "{{ item.key }}"
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 }}"
when: "item.value['status'] != 'not-found'" # see https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1461
- name: Find worker configs to be cleaned
2022-07-18 08:22:05 +00:00
ansible.builtin.find:
path: "{{ matrix_synapse_config_dir_path }}"
patterns: "worker.*.yaml"
use_regex: true
register: matrix_synapse_workers_current_config_files
- name: Ensure previous worker configs are cleaned
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
with_items: "{{ matrix_synapse_workers_current_config_files.files }}"
- name: Find worker systemd services to be cleaned
2022-07-18 08:22:05 +00:00
ansible.builtin.find:
path: "{{ matrix_systemd_path }}"
patterns: "matrix-synapse-worker.*.service"
use_regex: true
register: matrix_synapse_workers_current_systemd_services
- name: Ensure previous worker systemd services are cleaned
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
with_items: "{{ matrix_synapse_workers_current_systemd_services.files }}"