Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

43 line
2.0 KiB

  1. ---
  2. - name: Configure nginx for maubot
  3. block:
  4. - name: Generate Maubot proxying configuration for matrix-nginx-proxy
  5. ansible.builtin.set_fact:
  6. matrix_bot_maubot_matrix_nginx_proxy_configuration: |
  7. location ~ ^/(_matrix/maubot/.*) {
  8. {% if matrix_nginx_proxy_enabled | default(False) %}
  9. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  10. resolver 127.0.0.11 valid=5s;
  11. set $backend "matrix-bot-maubot:{{ matrix_bot_maubot_management_interface_port }}";
  12. proxy_pass http://$backend$request_uri;
  13. proxy_set_header Upgrade $http_upgrade;
  14. proxy_set_header Connection "upgrade";
  15. {% else %}
  16. {# Generic configuration for use outside of our container setup #}
  17. proxy_pass http://127.0.0.1:{{ matrix_bot_maubot_management_interface_port }}$request_uri;
  18. proxy_set_header Upgrade $http_upgrade;
  19. proxy_set_header Connection "upgrade";
  20. {% endif %}
  21. }
  22. when: matrix_bot_maubot_proxy_management_interface | bool
  23. - name: Register Maubot's proxying configuration with matrix-nginx-proxy
  24. ansible.builtin.set_fact:
  25. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
  26. {{
  27. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([])
  28. +
  29. [matrix_bot_maubot_matrix_nginx_proxy_configuration]
  30. }}
  31. when: matrix_bot_maubot_proxy_management_interface | bool
  32. - name: Warn about reverse-proxying if matrix-nginx-proxy not used
  33. ansible.builtin.debug:
  34. msg: >-
  35. NOTE: You've enabled Maubot but are not using the matrix-nginx-proxy
  36. reverse proxy.
  37. Please make sure that you're proxying the `/_matrix/maubot`
  38. URL endpoint to the matrix-maubot container.
  39. when: "matrix_bot_maubot_enabled | bool and matrix_bot_maubot_proxy_management_interface | bool and matrix_nginx_proxy_enabled is not defined"