Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

79 wiersze
3.7 KiB

  1. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
  2. # We don't want to fail in such cases.
  3. - name: Fail if matrix-synapse role already executed
  4. fail:
  5. msg: >-
  6. The matrix-bridge-appservice-webhooks role needs to execute before the matrix-synapse role.
  7. when: "matrix_synapse_role_executed|default(False)"
  8. - set_fact:
  9. matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-webhooks'] }}"
  10. when: matrix_appservice_webhooks_enabled|bool
  11. # If the matrix-synapse role is not used, these variables may not exist.
  12. - set_fact:
  13. matrix_synapse_container_extra_arguments: >
  14. {{ matrix_synapse_container_extra_arguments|default([]) }}
  15. +
  16. ["--mount type=bind,src={{ matrix_appservice_webhooks_config_path }}/webhooks-registration.yaml,dst=/matrix-appservice-webhooks-registration.yaml,ro"]
  17. matrix_synapse_app_service_config_files: >
  18. {{ matrix_synapse_app_service_config_files|default([]) }}
  19. +
  20. {{ ["/matrix-appservice-webhooks-registration.yaml"] }}
  21. when: matrix_appservice_webhooks_enabled|bool
  22. # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
  23. # We don't want to fail in such cases.
  24. - name: Fail if matrix-synapse role already executed
  25. fail:
  26. msg: >-
  27. The matrix-bridge-appservice-webhooks role needs to execute before the matrix-synapse role.
  28. when: "matrix_synapse_role_executed|default(False)"
  29. - block:
  30. - name: Fail if matrix-nginx-proxy role already executed
  31. fail:
  32. msg: >-
  33. Trying to append webhooks Appservice's reverse-proxying configuration to matrix-nginx-proxy,
  34. but it's pointless since the matrix-nginx-proxy role had already executed.
  35. To fix this, please change the order of roles in your plabook,
  36. so that the matrix-nginx-proxy role would run after the matrix-bridge-appservice-webhooks role.
  37. when: matrix_nginx_proxy_role_executed|default(False)|bool
  38. - name: Generate Matrix Appservice webhooks proxying configuration for matrix-nginx-proxy
  39. set_fact:
  40. matrix_appservice_webhooks_matrix_nginx_proxy_configuration: |
  41. location {{ matrix_appservice_webhooks_public_endpoint }}/ {
  42. {% if matrix_nginx_proxy_enabled|default(False) %}
  43. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  44. resolver 127.0.0.11 valid=5s;
  45. proxy_pass {{ matrix_appservice_webhooks_appservice_url }}:{{ matrix_appservice_webhooks_matrix_port }}/;
  46. {% else %}
  47. {# Generic configuration for use outside of our container setup #}
  48. proxy_pass http://127.0.0.1:{{ matrix_appservice_webhooks_matrix_port }}/;
  49. {% endif %}
  50. }
  51. - name: Register webhooks Appservice proxying configuration with matrix-nginx-proxy
  52. set_fact:
  53. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
  54. {{
  55. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
  56. +
  57. [matrix_appservice_webhooks_matrix_nginx_proxy_configuration]
  58. }}
  59. tags:
  60. - always
  61. when: matrix_appservice_webhooks_enabled|bool
  62. - name: Warn about reverse-proxying if matrix-nginx-proxy not used
  63. debug:
  64. msg: >-
  65. NOTE: You've enabled the Matrix webhooks bridge but are not using the matrix-nginx-proxy
  66. reverse proxy.
  67. Please make sure that you're proxying the `{{ matrix_appservice_webhooks_public_endpoint }}`
  68. URL endpoint to the matrix-appservice-webhooks container.
  69. You can expose the container's port using the `matrix_appservice_webhooks_container_http_host_bind_port` variable.
  70. when: "matrix_appservice_webhooks_enabled|bool and matrix_nginx_proxy_enabled is not defined"