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

70 строки
3.4 KiB

  1. ---
  2. - name: Fail if matrix-nginx-proxy role already executed
  3. ansible.builtin.fail:
  4. msg: >-
  5. Trying to append Mautrix Facebook'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-bridge-mautrix-facebook role.
  9. when: matrix_nginx_proxy_role_executed | default(False) | bool
  10. - name: Generate Mautrix Facebook proxying configuration for matrix-nginx-proxy
  11. ansible.builtin.set_fact:
  12. matrix_mautrix_facebook_matrix_nginx_proxy_configuration: |
  13. location {{ matrix_mautrix_facebook_public_endpoint }} {
  14. {% if matrix_nginx_proxy_enabled | default(False) %}
  15. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  16. resolver 127.0.0.11 valid=5s;
  17. set $backend "matrix-mautrix-facebook:29319";
  18. proxy_pass http://$backend;
  19. {% else %}
  20. {# Generic configuration for use outside of our container setup #}
  21. proxy_pass http://127.0.0.1:9008;
  22. {% endif %}
  23. }
  24. - name: Register Mautrix Facebook proxying configuration with matrix-nginx-proxy
  25. ansible.builtin.set_fact:
  26. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
  27. {{
  28. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([])
  29. +
  30. [matrix_mautrix_facebook_matrix_nginx_proxy_configuration]
  31. }}
  32. - name: Warn about reverse-proxying if matrix-nginx-proxy not used
  33. ansible.builtin.debug:
  34. msg: >-
  35. NOTE: You've enabled the Mautrix Facebook bridge but are not using the matrix-nginx-proxy
  36. reverse proxy.
  37. Please make sure that you're proxying the `{{ matrix_mautrix_facebook_public_endpoint }}`
  38. URL endpoint to the matrix-mautrix-facebook container.
  39. You can expose the container's port using the `matrix_mautrix_facebook_container_http_host_bind_port` variable.
  40. when: "not matrix_nginx_proxy_enabled | default(False) | bool"
  41. - when: matrix_mautrix_facebook_metrics_proxying_enabled | bool
  42. block:
  43. - name: Generate mautrix-facebook metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-facebook)
  44. ansible.builtin.set_fact:
  45. matrix_mautrix_facebook_nginx_metrics_configuration_block: |
  46. location /metrics/mautrix-facebook {
  47. {% if matrix_nginx_proxy_enabled | default(False) %}
  48. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  49. resolver 127.0.0.11 valid=5s;
  50. set $backend "matrix-mautrix-facebook:8000";
  51. proxy_pass http://$backend/metrics;
  52. {% else %}
  53. return 404 "matrix-nginx-proxy is disabled and no host port was bound to the container, so metrics are unavailable";
  54. {% endif %}
  55. }
  56. - name: Register mautrix-facebook metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/mautrix-facebook)
  57. ansible.builtin.set_fact:
  58. matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
  59. {{
  60. matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks | default([])
  61. +
  62. [matrix_mautrix_facebook_nginx_metrics_configuration_block]
  63. }}