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

87 строки
4.1 KiB

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