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

74 строки
4.0 KiB

  1. ---
  2. - set_fact:
  3. well_known_url_matrix: "https://{{ matrix_server_fqn_matrix }}{{ well_known_file_check.path }}"
  4. well_known_url_identity: "https://{{ matrix_domain }}{{ well_known_file_check.path }}"
  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: none
  11. return_content: true
  12. validate_certs: "{{ well_known_file_check.validate_certs }}"
  13. headers:
  14. Origin: example.com
  15. check_mode: no
  16. register: result_well_known_matrix
  17. ignore_errors: true
  18. - name: Fail if .well-known not working on the matrix hostname
  19. fail:
  20. msg: "Failed checking that the well-known file for {{ well_known_file_check.purpose }} is configured at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ well_known_url_matrix }}`). Is port 443 open in your firewall? Full error: {{ result_well_known_matrix }}"
  21. when: "result_well_known_matrix.failed"
  22. - name: Parse JSON for well-known payload at the matrix hostname
  23. set_fact:
  24. well_known_matrix_payload: "{{ result_well_known_matrix.content|from_json }}"
  25. - name: Fail if .well-known not CORS-aware on the matrix hostname
  26. fail:
  27. msg: "The well-known file for {{ well_known_file_check.purpose }} on `{{ matrix_server_fqn_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."
  28. when: "well_known_file_check.cors and 'access_control_allow_origin' not in result_well_known_matrix"
  29. - name: Report working .well-known on the matrix hostname
  30. debug:
  31. msg: "well-known for {{ well_known_file_check.purpose }} is configured correctly for `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ well_known_url_matrix }}`)"
  32. - name: Check .well-known on the identity hostname
  33. uri:
  34. url: "{{ well_known_url_identity }}"
  35. follow_redirects: "{{ well_known_file_check.follow_redirects }}"
  36. return_content: true
  37. validate_certs: "{{ well_known_file_check.validate_certs }}"
  38. headers:
  39. Origin: example.com
  40. check_mode: no
  41. register: result_well_known_identity
  42. ignore_errors: true
  43. - name: Fail if .well-known not working on the identity hostname
  44. fail:
  45. msg: "Failed checking that the well-known file for {{ well_known_file_check.purpose }} is configured at `{{ matrix_domain }}` (checked endpoint: `{{ well_known_url_identity }}`). Is port 443 open in your firewall? Full error: {{ result_well_known_identity }}"
  46. when: "result_well_known_identity.failed"
  47. - name: Parse JSON for well-known payload at the identity hostname
  48. set_fact:
  49. well_known_identity_payload: "{{ result_well_known_identity.content|from_json }}"
  50. - name: Fail if .well-known not CORS-aware on the identity hostname
  51. fail:
  52. msg: "The well-known file for {{ well_known_file_check.purpose }} on `{{ matrix_domain }}` (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"
  53. when: "well_known_file_check.cors and 'access_control_allow_origin' not in result_well_known_identity"
  54. # For people who manually copy the well-known file, try to detect if it's outdated
  55. - name: Fail if well-known is different on matrix hostname and identity hostname
  56. fail:
  57. msg: "The well-known files for {{ well_known_file_check.purpose }} at `{{ matrix_server_fqn_matrix }}` and `{{ matrix_domain }}` are different. Perhaps you copied the file ({{ well_known_file_check.path }}) manually before and now it's outdated?"
  58. when: "well_known_matrix_payload != well_known_identity_payload"
  59. - name: Report working .well-known on the identity hostname
  60. debug:
  61. msg: "well-known for {{ well_known_file_check.purpose }} ({{ well_known_file_check.path }}) is configured correctly for `{{ matrix_domain }}` (checked endpoint: `{{ well_known_url_identity }}`)"