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.
 
 

83 wiersze
3.9 KiB

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