Matrix Docker Ansible eploy
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

42 linhas
1.4 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. - name: Fail if service isn't detected to be running
  29. fail:
  30. msg: >-
  31. {{ item }} was not detected to be running.
  32. It's possible that there's a configuration problem or another service on your server interferes with it (uses the same ports, etc.).
  33. Try running `systemctl status {{ item }}` and `systemctl -fu {{ item }}` on the server to investigate.
  34. with_items: "{{ matrix_systemd_services_list }}"
  35. when: "ansible_facts.services[item + '.service']|default(none) is none or ansible_facts.services[item + '.service'].state != 'running'"