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

65 строки
3.2 KiB

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