Matrix Docker Ansible eploy
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

66 řádky
3.2 KiB

  1. ---
  2. - set_fact:
  3. well_known_url_matrix: "https://{{ hostname_matrix }}/.well-known/matrix/client"
  4. well_known_url_identity: "https://{{ hostname_identity }}/.well-known/matrix/client"
  5. # These well-known files may be served without a `Content-Type: application/json` header,
  6. # so we can't rely on the uri module's automatic parsing of JSON.
  7. - name: Check .well-known on the matrix hostname
  8. uri:
  9. url: "{{ well_known_url_matrix }}"
  10. follow_redirects: false
  11. return_content: true
  12. register: result_well_known_matrix
  13. ignore_errors: true
  14. - name: Fail if .well-known not working on the matrix hostname
  15. fail:
  16. msg: "Failed checking that well-known is configured at `{{ hostname_matrix }}` (checked endpoint: `{{ well_known_url_matrix }}`). Is port 443 open in your firewall? Full error: {{ result_well_known_matrix }}"
  17. when: "result_well_known_matrix.failed"
  18. - name: Parse JSON for well-known payload at the matrix hostname
  19. set_fact:
  20. well_known_matrix_payload: "{{ result_well_known_matrix.content|from_json }}"
  21. - name: Fail if .well-known not CORS-aware on the matrix hostname
  22. fail:
  23. msg: "Well-known serving for `{{ hostname_matrix }}` (checked endpoint: `{{ well_known_url_matrix }}`) is not CORS-aware. The file needs to be served with an Access-Control-Allow-Origin header set."
  24. when: "'access_control_allow_origin' not in result_well_known_matrix"
  25. - name: Report working .well-known on the matrix hostname
  26. debug:
  27. msg: "well-known is configured correctly for `{{ hostname_matrix }}` (checked endpoint: `{{ well_known_url_matrix }}`)"
  28. - name: Check .well-known on the identity hostname
  29. uri:
  30. url: "{{ well_known_url_identity }}"
  31. follow_redirects: false
  32. return_content: true
  33. register: result_well_known_identity
  34. ignore_errors: true
  35. - name: Fail if .well-known not working on the identity hostname
  36. fail:
  37. msg: "Failed checking that well-known is configured at `{{ hostname_identity }}` (checked endpoint: `{{ well_known_url_identity }}`). Is port 443 open in your firewall? Full error: {{ result_well_known_identity }}"
  38. when: "result_well_known_identity.failed"
  39. - name: Parse JSON for well-known payload at the identity hostname
  40. set_fact:
  41. well_known_identity_payload: "{{ result_well_known_identity.content|from_json }}"
  42. - name: Fail if .well-known not CORS-aware on the identity hostname
  43. fail:
  44. msg: "Well-known serving for `{{ hostname_identity }}` (checked endpoint: `{{ well_known_url_identity }}`) is not CORS-aware. The file needs to be served with an Access-Control-Allow-Origin header set. See docs/configuring-well-known.md"
  45. when: "'access_control_allow_origin' not in result_well_known_identity"
  46. # For people who manually copy the well-known file, try to detect if it's outdated
  47. - name: Fail if well-known is different on matrix hostname and identity hostname
  48. fail:
  49. msg: "The well-known files at `{{ hostname_matrix }}` and `{{ hostname_identity }}` are different. Perhaps you copied the file manually before and now it's outdated?"
  50. when: "well_known_matrix_payload != well_known_identity_payload"
  51. - name: Report working .well-known on the identity hostname
  52. debug:
  53. msg: "well-known is configured correctly for `{{ hostname_identity }}` (checked endpoint: `{{ well_known_url_identity }}`)"