Matrix Docker Ansible eploy
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

65 righe
3.0 KiB

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