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

78 строки
3.8 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_mx_puppet_slack_container_image_self_build"
  7. - set_fact:
  8. matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mx-puppet-slack.service'] }}"
  9. when: matrix_mx_puppet_slack_enabled|bool
  10. # If the matrix-synapse role is not used, these variables may not exist.
  11. - set_fact:
  12. matrix_synapse_container_extra_arguments: >
  13. {{ matrix_synapse_container_extra_arguments|default([]) }}
  14. +
  15. ["--mount type=bind,src={{ matrix_mx_puppet_slack_config_path }}/registration.yaml,dst=/matrix-mx-puppet-slack-registration.yaml,ro"]
  16. matrix_synapse_app_service_config_files: >
  17. {{ matrix_synapse_app_service_config_files|default([]) }}
  18. +
  19. {{ ["/matrix-mx-puppet-slack-registration.yaml"] }}
  20. when: matrix_mx_puppet_slack_enabled|bool
  21. - block:
  22. - name: Fail if matrix-nginx-proxy role already executed
  23. fail:
  24. msg: >-
  25. Trying to append Slack Appservice's reverse-proxying configuration to matrix-nginx-proxy,
  26. but it's pointless since the matrix-nginx-proxy role had already executed.
  27. To fix this, please change the order of roles in your plabook,
  28. so that the matrix-nginx-proxy role would run after the matrix-mx-puppet-slack role.
  29. when: matrix_nginx_proxy_role_executed|default(False)|bool
  30. - name: Generate Matrix MX Puppet Slack proxying configuration for matrix-nginx-proxy
  31. set_fact:
  32. matrix_mx_puppet_slack_matrix_nginx_proxy_configuration: |
  33. location {{ matrix_mx_puppet_slack_redirect_path }} {
  34. {% if matrix_nginx_proxy_enabled|default(False) %}
  35. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  36. resolver 127.0.0.11 valid=5s;
  37. set $backend "{{ matrix_mx_puppet_slack_appservice_address }}";
  38. proxy_pass $backend;
  39. {% else %}
  40. {# Generic configuration for use outside of our container setup #}
  41. proxy_pass http://127.0.0.1:{{ matrix_mx_puppet_slack_appservice_port }};
  42. {% endif %}
  43. }
  44. - name: Register Slack Appservice proxying configuration with matrix-nginx-proxy
  45. set_fact:
  46. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
  47. {{
  48. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
  49. +
  50. [matrix_mx_puppet_slack_matrix_nginx_proxy_configuration]
  51. }}
  52. tags:
  53. - always
  54. when: matrix_mx_puppet_slack_enabled|bool
  55. - name: Warn about reverse-proxying if matrix-nginx-proxy not used
  56. debug:
  57. msg: >-
  58. NOTE: You've enabled the Matrix Slack bridge but are not using the matrix-nginx-proxy
  59. reverse proxy.
  60. Please make sure that you're proxying the `{{ matrix_mx_puppet_slack_redirect_path }}`
  61. URL endpoint to the matrix-mx-puppet-slack container.
  62. You can expose the container's port using the `matrix_appservice_slack_container_http_host_bind_port` variable.
  63. when: "matrix_mx_puppet_slack_enabled|bool and matrix_nginx_proxy_enabled is not defined"
  64. # ansible lower than 2.8, does not support docker_image build parameters
  65. # for self building it is explicitly needed, so we rather fail here
  66. - name: Fail if running on Ansible lower than 2.8 and trying self building
  67. fail:
  68. msg: "To self build Puppet Slack image, you should usa ansible 2.8 or higher. E.g. pip contains such packages."
  69. when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mx_puppet_slack_container_image_self_build"