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.
 
 

56 wiersze
2.7 KiB

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