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.
 
 

51 lines
2.5 KiB

  1. ---
  2. - when: matrix_appservice_webhooks_enabled | bool
  3. tags:
  4. - always
  5. block:
  6. - name: Fail if matrix-nginx-proxy role already executed
  7. ansible.builtin.fail:
  8. msg: >-
  9. Trying to append webhooks Appservice'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-bridge-appservice-webhooks role.
  13. when: matrix_nginx_proxy_role_executed | default(False) | bool
  14. - name: Generate Matrix Appservice webhooks proxying configuration for matrix-nginx-proxy
  15. ansible.builtin.set_fact:
  16. matrix_appservice_webhooks_matrix_nginx_proxy_configuration: |
  17. {% if matrix_nginx_proxy_enabled | default(False) %}
  18. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  19. location ~ ^{{ matrix_appservice_webhooks_public_endpoint }}/(.*)$ {
  20. resolver 127.0.0.11 valid=5s;
  21. set $backend "matrix-appservice-webhooks:{{ matrix_appservice_webhooks_matrix_port }}";
  22. proxy_pass http://$backend/$1;
  23. }
  24. {% else %}
  25. {# Generic configuration for use outside of our container setup #}
  26. location {{ matrix_appservice_webhooks_public_endpoint }}/ {
  27. proxy_pass http://127.0.0.1:{{ matrix_appservice_webhooks_matrix_port }}/;
  28. }
  29. {% endif %}
  30. - name: Register webhooks Appservice proxying configuration with matrix-nginx-proxy
  31. ansible.builtin.set_fact:
  32. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
  33. {{
  34. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([])
  35. +
  36. [matrix_appservice_webhooks_matrix_nginx_proxy_configuration]
  37. }}
  38. - name: Warn about reverse-proxying if matrix-nginx-proxy not used
  39. ansible.builtin.debug:
  40. msg: >-
  41. NOTE: You've enabled the Matrix webhooks bridge but are not using the matrix-nginx-proxy
  42. reverse proxy.
  43. Please make sure that you're proxying the `{{ matrix_appservice_webhooks_public_endpoint }}`
  44. URL endpoint to the matrix-appservice-webhooks container.
  45. You can expose the container's port using the `matrix_appservice_webhooks_container_http_host_bind_port` variable.
  46. when: "matrix_appservice_webhooks_enabled | bool and not matrix_nginx_proxy_enabled | default(False) | bool"