Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

39 lines
1.3 KiB

  1. ---
  2. - name: Populate service facts
  3. service_facts:
  4. - name: Ensure any worker services are stopped
  5. service:
  6. name: "{{ item.key }}"
  7. state: stopped
  8. with_dict: "{{ ansible_facts.services|default({})|dict2items|selectattr('key', 'match', 'matrix-synapse-worker@.+\\.service')|list|items2dict }}"
  9. # As we cannot know the ports of workers removed from the enabled_list..
  10. # => .. just kill them all (FIXME?)
  11. - name: Ensure previous worker service symlinks are cleaned
  12. file:
  13. path: "{{ item.root + '/' + item.path }}"
  14. state: absent
  15. when:
  16. - not matrix_synapse_workers_enabled|bool
  17. - item.state == 'link'
  18. - item.path is match('matrix-synapse-worker@.*\\.service')
  19. with_filetree:
  20. - "{{ matrix_systemd_path }}/matrix-synapse.service.wants"
  21. - name: Ensure synapse worker base service file gets removed
  22. file:
  23. path: "{{ matrix_systemd_path }}/matrix-synapse-worker@.service"
  24. state: absent
  25. register: matrix_synapse_worker_systemd_service_result
  26. - name: Remove workers from synapse.wants list
  27. set_fact:
  28. matrix_synapse_systemd_wanted_services_list: "{{ matrix_synapse_systemd_wanted_services_list | reject('search', item) | list }}"
  29. with_items: "{{ matrix_synapse_workers_avail_list }}"
  30. - name: Ensure systemd noticed removal of worker service units
  31. service:
  32. daemon_reload: yes