Matrix Docker Ansible eploy
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

60 řádky
3.0 KiB

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