Matrix Docker Ansible eploy
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 

88 lignes
4.2 KiB

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