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.
 
 

48 lines
2.0 KiB

  1. ---
  2. - name: Determine current worker configs
  3. ansible.builtin.find:
  4. path: "{{ matrix_synapse_config_dir_path }}"
  5. patterns: "worker.*.yaml"
  6. use_regex: true
  7. register: matrix_synapse_workers_current_config_files
  8. - ansible.builtin.set_fact:
  9. matrix_synapse_enabled_worker_names: "{{ matrix_synapse_workers_enabled_list | map(attribute='name') }}"
  10. # This also deletes some things which we need. They will be recreated below.
  11. - name: Ensure unnecessary worker configs are cleaned
  12. ansible.builtin.file:
  13. path: "{{ item.path }}"
  14. state: absent
  15. with_items: "{{ matrix_synapse_workers_current_config_files.files }}"
  16. when: "not ansible_check_mode and (item.path | basename | replace ('worker.', '') | replace('.yaml', '')) not in matrix_synapse_enabled_worker_names"
  17. - name: Determine current worker systemd services
  18. ansible.builtin.find:
  19. path: "{{ devture_systemd_docker_base_systemd_path }}"
  20. patterns: "matrix-synapse-worker.*.service"
  21. use_regex: true
  22. register: matrix_synapse_workers_current_systemd_services
  23. - name: Ensure unnecessary worker systemd services are stopped and disabled
  24. ansible.builtin.service:
  25. name: "{{ item.path | basename }}"
  26. state: stopped
  27. enabled: false
  28. with_items: "{{ matrix_synapse_workers_current_systemd_services.files }}"
  29. when: "not ansible_check_mode and (item.path | basename | replace('.service', '')) not in matrix_synapse_enabled_worker_names"
  30. - name: Ensure unnecessary worker systemd services are cleaned
  31. ansible.builtin.file:
  32. path: "{{ item.path }}"
  33. state: absent
  34. with_items: "{{ matrix_synapse_workers_current_systemd_services.files }}"
  35. when: "not ansible_check_mode and (item.path | basename | replace('.service', '')) not in matrix_synapse_enabled_worker_names"
  36. - name: Ensure creation of worker systemd service files and configuration files
  37. ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/util/setup_files_for_worker.yml"
  38. with_items: "{{ matrix_synapse_workers_enabled_list }}"
  39. loop_control:
  40. loop_var: matrix_synapse_worker_details