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

63 строки
3.0 KiB

  1. - set_fact:
  2. matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-etherpad.service'] }}"
  3. when: matrix_etherpad_enabled|bool
  4. - block:
  5. - name: Fail if matrix-nginx-proxy role already executed
  6. fail:
  7. msg: >-
  8. Trying to append Etherpad'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-etherpad role.
  12. when: matrix_nginx_proxy_role_executed|default(False)|bool
  13. - name: Generate Etherpad proxying configuration for matrix-nginx-proxy
  14. set_fact:
  15. matrix_etherpad_matrix_nginx_proxy_configuration: |
  16. rewrite ^{{ matrix_etherpad_public_endpoint }}$ $scheme://$server_name{{ matrix_etherpad_public_endpoint }}/ permanent;
  17. location {{ matrix_etherpad_public_endpoint }}/ {
  18. {% if matrix_nginx_proxy_enabled|default(False) %}
  19. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  20. resolver 127.0.0.11 valid=5s;
  21. proxy_pass http://matrix-etherpad:9001/;
  22. {# These are proxy directives needed specifically by Etherpad #}
  23. proxy_buffering off;
  24. proxy_http_version 1.1; # recommended with keepalive connections
  25. proxy_pass_header Server;
  26. proxy_set_header Host $host;
  27. proxy_set_header X-Forwarded-Proto $scheme; # for EP to set secure cookie flag when https is used
  28. # WebSocket proxying - from http://nginx.org/en/docs/http/websocket.html
  29. proxy_set_header Upgrade $http_upgrade;
  30. proxy_set_header Connection $connection_upgrade;
  31. {% else %}
  32. {# Generic configuration for use outside of our container setup #}
  33. # A good guide for setting up your Etherpad behind nginx:
  34. # https://docs.gandi.net/en/cloud/tutorials/etherpad_lite.html
  35. proxy_pass http://127.0.0.1:9001/;
  36. {% endif %}
  37. }
  38. - name: Register Etherpad proxying configuration with matrix-nginx-proxy
  39. set_fact:
  40. matrix_nginx_proxy_proxy_dimension_additional_server_configuration_blocks: |
  41. {{
  42. matrix_nginx_proxy_proxy_dimension_additional_server_configuration_blocks|default([])
  43. +
  44. [matrix_etherpad_matrix_nginx_proxy_configuration]
  45. }}
  46. tags:
  47. - always
  48. when: matrix_etherpad_enabled|bool
  49. - name: Warn about reverse-proxying if matrix-nginx-proxy not used
  50. debug:
  51. msg: >-
  52. NOTE: You've enabled the Etherpad tool but are not using the matrix-nginx-proxy
  53. reverse proxy.
  54. Please make sure that you're proxying the `{{ matrix_etherpad_public_endpoint }}`
  55. URL endpoint to the matrix-etherpad container.
  56. You can expose the container's port using the `matrix_etherpad_container_http_host_bind_port` variable.
  57. when: "matrix_etherpad_enabled|bool and matrix_nginx_proxy_enabled is not defined"