mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-12-27 19:38:29 +01:00
70796703d3
This switches the `docker exec` method of spawning Synapse workers inside the `matrix-synapse` container with dedicated containers for each worker. We also have dedicated systemd services for each worker, so this are now: - more consistent with everything else (we don't use systemd instantiated services anywhere) - we don't need the "parse systemd instance name into worker name + port" part - we don't need to keep track of PIDs manually - we don't need jq (less depenendencies) - workers dying would be restarted by systemd correctly, like any other service - `docker ps` shows each worker separately and we can observe resource usage
37 lines
1.1 KiB
YAML
37 lines
1.1 KiB
YAML
---
|
|
|
|
- name: Populate service facts
|
|
service_facts:
|
|
|
|
- name: Ensure any worker services are stopped
|
|
service:
|
|
name: "{{ item.key }}"
|
|
state: stopped
|
|
with_dict: "{{ ansible_facts.services|default({})|dict2items|selectattr('key', 'match', 'matrix-synapse-worker-.+\\.service')|list|items2dict }}"
|
|
|
|
- name: Find worker configs to be cleaned
|
|
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
|
|
file:
|
|
path: "{{ item.path }}"
|
|
state: absent
|
|
with_items: "{{ matrix_synapse_workers_current_config_files.files }}"
|
|
|
|
- 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
|
|
|
|
- name: Ensure previous worker systemd services are cleaned
|
|
file:
|
|
path: "{{ item.path }}"
|
|
state: absent
|
|
with_items: "{{ matrix_synapse_workers_current_systemd_services.files }}"
|