Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 

70 строки
2.5 KiB

  1. ---
  2. - name: Ensure systemd reloaded
  3. service:
  4. daemon_reload: yes
  5. - name: Ensure Matrix services stopped
  6. service:
  7. name: "{{ item }}"
  8. state: stopped
  9. with_items: "{{ matrix_systemd_services_list }}"
  10. - name: Ensure Matrix services started
  11. service:
  12. name: "{{ item }}"
  13. enabled: yes
  14. state: started
  15. with_items: "{{ matrix_systemd_services_list }}"
  16. # If we check service state immediately, we may succeed,
  17. # because it takes some time for the service to attempt to start and actually fail.
  18. #
  19. # Waiting too long (30s) may not work for a similar reason,
  20. # as we may run into systemd's automatic restart logic retrying the service.
  21. - name: Wait a bit, so that services can start (or fail)
  22. wait_for:
  23. timeout: 5
  24. delegate_to: 127.0.0.1
  25. become: false
  26. - name: Populate service facts
  27. service_facts:
  28. when: ansible_distribution != 'Archlinux'
  29. - name: Fail if service isn't detected to be running
  30. fail:
  31. msg: >-
  32. {{ item }} was not detected to be running.
  33. It's possible that there's a configuration problem or another service on your server interferes with it (uses the same ports, etc.).
  34. Try running `systemctl status {{ item }}` and `journalctl -fu {{ item }}` on the server to investigate.
  35. with_items: "{{ matrix_systemd_services_list }}"
  36. when:
  37. - "ansible_facts.services[item + '.service']|default(none) is none or ansible_facts.services[item + '.service'].state != 'running'"
  38. - ansible_distribution != 'Archlinux'
  39. # Currently there is a bug in ansible that renders is incompatible with systemd.
  40. # service_facts is not collecting the data successfully.
  41. # Therefore iterating here manually
  42. - name: Fetch systemd information
  43. systemd:
  44. name: "{{ item }}"
  45. register: systemdstatus
  46. with_items: "{{ matrix_systemd_services_list }}"
  47. when:
  48. - ansible_distribution == 'Archlinux'
  49. - name: Fail if service isn't detected to be running
  50. fail:
  51. msg: >-
  52. {{ item.item }} was not detected to be running.
  53. It's possible that there's a configuration problem or another service on your server interferes with it (uses the same ports, etc.).
  54. Try running `systemctl status {{ item.item }}` and `journalctl -fu {{ item.item }}` on the server to investigate.
  55. with_items: "{{ systemdstatus.results }}"
  56. loop_control:
  57. label: "{{ item.name }}"
  58. when:
  59. #- "ansible_facts.services[item + '.service']|default(none) is none or ansible_facts.services[item + '.service'].state != 'running'"
  60. - "item.status['ActiveState'] != 'active'"
  61. - "ansible_distribution == 'Archlinux'"