Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

65 wiersze
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. - block:
  6. - name: Fail if matrix-nginx-proxy role already executed
  7. ansible.builtin.fail:
  8. msg: >-
  9. Trying to append Etherpad'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-etherpad role.
  13. when: matrix_nginx_proxy_role_executed | default(False) | bool
  14. - name: Generate Etherpad proxying configuration for matrix-nginx-proxy
  15. ansible.builtin.set_fact:
  16. matrix_etherpad_matrix_nginx_proxy_configuration: |
  17. rewrite ^{{ matrix_etherpad_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_etherpad_public_endpoint }}/ permanent;
  18. location {{ matrix_etherpad_public_endpoint }}/ {
  19. {% if matrix_nginx_proxy_enabled | default(False) %}
  20. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  21. resolver 127.0.0.11 valid=5s;
  22. proxy_pass http://matrix-etherpad:9001/;
  23. {# These are proxy directives needed specifically by Etherpad #}
  24. proxy_buffering off;
  25. proxy_http_version 1.1; # recommended with keepalive connections
  26. proxy_pass_header Server;
  27. proxy_set_header Host $host;
  28. proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_proto_value }}; # for EP to set secure cookie flag when https is used
  29. # WebSocket proxying - from http://nginx.org/en/docs/http/websocket.html
  30. proxy_set_header Upgrade $http_upgrade;
  31. proxy_set_header Connection $connection_upgrade;
  32. {% else %}
  33. {# Generic configuration for use outside of our container setup #}
  34. # A good guide for setting up your Etherpad behind nginx:
  35. # https://docs.gandi.net/en/cloud/tutorials/etherpad_lite.html
  36. proxy_pass http://127.0.0.1:9001/;
  37. {% endif %}
  38. }
  39. - name: Register Etherpad proxying configuration with matrix-nginx-proxy
  40. ansible.builtin.set_fact:
  41. matrix_nginx_proxy_proxy_dimension_additional_server_configuration_blocks: |
  42. {{
  43. matrix_nginx_proxy_proxy_dimension_additional_server_configuration_blocks | default([])
  44. +
  45. [matrix_etherpad_matrix_nginx_proxy_configuration]
  46. }}
  47. tags:
  48. - always
  49. when: matrix_etherpad_enabled | bool
  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"