synapse workers: polishing, cleansing and installation of jq dependency

This commit is contained in:
Marcel Partap
2020-10-23 20:49:53 +02:00
parent 501efee07e
commit a4125d5446
4 changed files with 44 additions and 14 deletions

View File

@ -1,8 +1,7 @@
---
# a negative when condition will not actually prevent ansible from executing loops in imported tasks!
- import_tasks: "{{ role_path }}/tasks/workers/setup_install.yml"
- include_tasks: "{{ role_path }}/tasks/workers/setup_install.yml"
when: "matrix_synapse_enabled|bool and matrix_synapse_workers_enabled|bool"
- import_tasks: "{{ role_path }}/tasks/workers/setup_uninstall.yml"
- include_tasks: "{{ role_path }}/tasks/workers/setup_uninstall.yml"
when: "not matrix_synapse_workers_enabled|bool"

View File

@ -7,12 +7,11 @@
mode: 0644
register: matrix_synapse_worker_systemd_service_result
- name: Ensure previous worker service symlinks are cleaned (FIXME)
- name: Ensure previous worker service symlinks are cleaned
file:
path: "{{ item.root + '/' + item.path }}"
state: absent
when:
- matrix_synapse_workers_enabled|bool
- item.state == 'link'
- item.path is match('matrix-synapse-worker@.*\\.service')
with_filetree:
@ -28,6 +27,13 @@
enabled: true
with_items: "{{ matrix_synapse_workers_enabled_list }}"
- name: Ensure previous worker configs are cleaned
file:
path: "{{ item }}"
state: absent
with_fileglob:
- "{{ matrix_synapse_config_dir_path }}/worker.*.yaml"
- name: Ensure creation of specific worker configs
template:
src: "{{ role_path }}/templates/synapse/worker.yaml.j2"
@ -46,3 +52,24 @@
src: "{{ role_path }}/files/usr-local-bin/matrix-synapse-worker-write-pid"
dest: "{{ matrix_local_bin_path }}/matrix-synapse-worker-write-pid"
mode: 0750
- name: Ensure jq is installed (Archlinux)
pacman:
name:
- jq
state: present
when: (ansible_distribution == 'Archlinux')
- name: Ensure jq is installed (CentOS)
yum:
name:
- jq
state: present
when: (ansible_distribution == 'CentOS')
- name: Ensure jq is installed (Debian)
apt:
name:
- jq
state: present
when: (ansible_os_family == 'Debian')

View File

@ -9,14 +9,11 @@
state: stopped
with_dict: "{{ ansible_facts.services|default({})|dict2items|selectattr('key', 'match', 'matrix-synapse-worker@.+\\.service')|list|items2dict }}"
# As we cannot know the ports of workers removed from the enabled_list..
# => .. just kill them all (FIXME?)
- name: Ensure previous worker service symlinks are cleaned
- name: Ensure worker service symlinks are cleaned
file:
path: "{{ item.root + '/' + item.path }}"
state: absent
when:
- not matrix_synapse_workers_enabled|bool
- item.state == 'link'
- item.path is match('matrix-synapse-worker@.*\\.service')
with_filetree:
@ -28,6 +25,13 @@
state: absent
register: matrix_synapse_worker_systemd_service_result
- name: Ensure worker configs are cleaned
file:
path: "{{ item.root + '/' + item.path }}"
state: absent
with_fileglob:
- "{{ matrix_synapse_config_dir_path }}/worker.*.yaml"
- name: Remove workers from synapse.wants list
set_fact:
matrix_synapse_systemd_wanted_services_list: "{{ matrix_synapse_systemd_wanted_services_list | reject('search', item) | list }}"