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

80 строки
3.6 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-slack 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-slack'] }}"
  10. when: matrix_appservice_slack_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_slack_config_path }}/slack-registration.yaml,dst=/matrix-appservice-slack-registration.yaml,ro"]
  17. matrix_synapse_app_service_config_files: >
  18. {{ matrix_synapse_app_service_config_files|default([]) }}
  19. +
  20. {{ ["/matrix-appservice-slack-registration.yaml"] }}
  21. when: matrix_appservice_slack_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-slack 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 Slack 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-slack role.
  37. when: matrix_nginx_proxy_role_executed|default(False)|bool
  38. - name: Generate Matrix Appservice Slack proxying configuration for matrix-nginx-proxy
  39. set_fact:
  40. matrix_appservice_slack_matrix_nginx_proxy_configuration: |
  41. location {{ matrix_appservice_slack_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. set $backend "{{ matrix_appservice_slack_appservice_url }}:{{ matrix_appservice_slack_slack_port }}";
  46. proxy_pass $backend;
  47. {% else %}
  48. {# Generic configuration for use outside of our container setup #}
  49. proxy_pass http://127.0.0.1:{{ matrix_appservice_slack_slack_port }};
  50. {% endif %}
  51. }
  52. - name: Register Slack Appservice proxying configuration with matrix-nginx-proxy
  53. set_fact:
  54. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
  55. {{
  56. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
  57. +
  58. [matrix_appservice_slack_matrix_nginx_proxy_configuration]
  59. }}
  60. tags:
  61. - always
  62. when: matrix_appservice_slack_enabled|bool
  63. - name: Warn about reverse-proxying if matrix-nginx-proxy not used
  64. debug:
  65. msg: >-
  66. NOTE: You've enabled the Matrix Slack bridge but are not using the matrix-nginx-proxy
  67. reverse proxy.
  68. Please make sure that you're proxying the `{{ something }}`
  69. URL endpoint to the matrix-appservice-slack container.
  70. You can expose the container's port using the `matrix_appservice_slack_container_http_host_bind_port` variable.
  71. when: "matrix_appservice_slack_enabled|bool and matrix_nginx_proxy_enabled is not defined"