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.
 
 

69 wiersze
3.4 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_registration_container_image_self_build and matrix_registration_enabled"
  7. - set_fact:
  8. matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-registration.service'] }}"
  9. when: matrix_registration_enabled|bool
  10. - block:
  11. - name: Fail if matrix-nginx-proxy role already executed
  12. fail:
  13. msg: >-
  14. Trying to append matrix-registration's reverse-proxying configuration to matrix-nginx-proxy,
  15. but it's pointless since the matrix-nginx-proxy role had already executed.
  16. To fix this, please change the order of roles in your plabook,
  17. so that the matrix-nginx-proxy role would run after the matrix-registration role.
  18. when: matrix_nginx_proxy_role_executed|default(False)|bool
  19. - name: Generate matrix-registration proxying configuration for matrix-nginx-proxy
  20. set_fact:
  21. matrix_registration_matrix_nginx_proxy_configuration: |
  22. rewrite ^{{ matrix_registration_public_endpoint }}$ $scheme://$server_name{{ matrix_registration_public_endpoint }}/ permanent;
  23. rewrite ^{{ matrix_registration_public_endpoint }}/$ $scheme://$server_name{{ matrix_registration_public_endpoint }}/register redirect;
  24. location ~ ^{{ matrix_registration_public_endpoint }}/(.*) {
  25. {% if matrix_nginx_proxy_enabled|default(False) %}
  26. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  27. resolver 127.0.0.11 valid=5s;
  28. set $backend "matrix-registration:5000";
  29. proxy_pass http://$backend/$1;
  30. {% else %}
  31. {# Generic configuration for use outside of our container setup #}
  32. proxy_pass http://127.0.0.1:8767/$1;
  33. {% endif %}
  34. {#
  35. Workaround matrix-registration serving the background image at /static
  36. (see https://github.com/ZerataX/matrix-registration/issues/47)
  37. #}
  38. sub_filter_once off;
  39. sub_filter_types text/css;
  40. sub_filter "/static/" "{{ matrix_registration_public_endpoint }}/static/";
  41. }
  42. - name: Register matrix-registration proxying configuration with matrix-nginx-proxy
  43. set_fact:
  44. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
  45. {{
  46. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
  47. +
  48. [matrix_registration_matrix_nginx_proxy_configuration]
  49. }}
  50. tags:
  51. - always
  52. when: matrix_registration_enabled|bool
  53. - name: Warn about reverse-proxying if matrix-nginx-proxy not used
  54. debug:
  55. msg: >-
  56. NOTE: You've enabled the matrix-registration tool but are not using the matrix-nginx-proxy
  57. reverse proxy.
  58. Please make sure that you're proxying the `{{ matrix_registration_public_endpoint }}`
  59. URL endpoint to the matrix-registration container.
  60. You can expose the container's port using the `matrix_registration_container_http_host_bind_port` variable.
  61. when: "matrix_registration_enabled|bool and matrix_nginx_proxy_enabled is not defined"