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

56 строки
2.7 KiB

  1. ---
  2. - name: Fail if matrix-nginx-proxy role already executed
  3. ansible.builtin.fail:
  4. msg: >-
  5. Trying to append Synapse Admin'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-synapse-admin role.
  9. when: matrix_nginx_proxy_role_executed | default(False) | bool
  10. - name: Generate Synapse Admin proxying configuration for matrix-nginx-proxy
  11. ansible.builtin.set_fact:
  12. matrix_synapse_admin_matrix_nginx_proxy_configuration: |
  13. rewrite ^{{ matrix_synapse_admin_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_synapse_admin_public_endpoint }}/ permanent;
  14. location ~ ^{{ matrix_synapse_admin_public_endpoint }}/(.*) {
  15. {% if matrix_nginx_proxy_enabled | default(False) %}
  16. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  17. resolver 127.0.0.11 valid=5s;
  18. set $backend "matrix-synapse-admin:80";
  19. proxy_pass http://$backend/$1;
  20. {% else %}
  21. {# Generic configuration for use outside of our container setup #}
  22. proxy_pass http://127.0.0.1:8766/$1;
  23. {% endif %}
  24. {#
  25. Workaround synapse-admin serving all assets at /static.
  26. See: https://github.com/Awesome-Technologies/synapse-admin/issues/322
  27. #}
  28. sub_filter_once off;
  29. sub_filter "/static/" "{{ matrix_synapse_admin_public_endpoint }}/static/";
  30. sub_filter "/favicon.ico" "{{ matrix_synapse_admin_public_endpoint }}/favicon.ico";
  31. sub_filter "/manifest.json" "{{ matrix_synapse_admin_public_endpoint }}/manifest.json";
  32. }
  33. - name: Register Synapse Admin 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_synapse_admin_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 Synapse Admin tool but are not using the matrix-nginx-proxy
  45. reverse proxy.
  46. Please make sure that you're proxying the `{{ matrix_synapse_admin_public_endpoint }}`
  47. URL endpoint to the matrix-synapse-admin container.
  48. You can expose the container's port using the `matrix_synapse_admin_container_http_host_bind_port` variable.
  49. when: "not matrix_nginx_proxy_enabled | default(False) | bool"