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

70 строки
3.4 KiB

  1. - set_fact:
  2. matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-hangouts'] }}"
  3. when: matrix_mautrix_hangouts_enabled|bool
  4. # If the matrix-synapse role is not used, these variables may not exist.
  5. - set_fact:
  6. matrix_synapse_container_extra_arguments: >
  7. {{ matrix_synapse_container_extra_arguments|default([]) }}
  8. +
  9. ["--mount type=bind,src={{ matrix_mautrix_hangouts_config_path }}/registration.yaml,dst=/matrix-mautrix-hangouts-registration.yaml,ro"]
  10. matrix_synapse_app_service_config_files: >
  11. {{ matrix_synapse_app_service_config_files|default([]) }}
  12. +
  13. {{ ["/matrix-mautrix-hangouts-registration.yaml"] }}
  14. when: matrix_mautrix_hangouts_enabled|bool
  15. - block:
  16. - name: Fail if matrix-nginx-proxy role already executed
  17. fail:
  18. msg: >-
  19. Trying to append Mautrix Hangouts's reverse-proxying configuration to matrix-nginx-proxy,
  20. but it's pointless since the matrix-nginx-proxy role had already executed.
  21. To fix this, please change the order of roles in your plabook,
  22. so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-hangouts role.
  23. when: matrix_nginx_proxy_role_executed|default(False)|bool
  24. - name: Generate Mautrix Hangouts proxying configuration for matrix-nginx-proxy
  25. set_fact:
  26. matrix_mautrix_hangouts_matrix_nginx_proxy_configuration: |
  27. location {{ matrix_mautrix_hangouts_public_endpoint }} {
  28. {% if matrix_nginx_proxy_enabled|default(False) %}
  29. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  30. resolver 127.0.0.11 valid=5s;
  31. set $backend "matrix-mautrix-hangouts:8080";
  32. proxy_pass http://$backend;
  33. {% else %}
  34. {# Generic configuration for use outside of our container setup #}
  35. proxy_pass http://127.0.0.1:9007;
  36. {% endif %}
  37. }
  38. - name: Register Mautrix Hangouts proxying configuration with matrix-nginx-proxy
  39. set_fact:
  40. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
  41. {{
  42. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([])
  43. +
  44. [matrix_mautrix_hangouts_matrix_nginx_proxy_configuration]
  45. }}
  46. tags:
  47. - always
  48. when: matrix_mautrix_hangouts_enabled|bool
  49. - name: Warn about reverse-proxying if matrix-nginx-proxy not used
  50. debug:
  51. msg: >-
  52. NOTE: You've enabled the Mautrix Hangouts bridge but are not using the matrix-nginx-proxy
  53. reverse proxy.
  54. Please make sure that you're proxying the `{{ matrix_mautrix_hangouts_public_endpoint }}`
  55. URL endpoint to the matrix-mautrix-hangouts container.
  56. You can expose the container's port using the `matrix_mautrix_hangouts_container_http_host_bind_port` variable.
  57. when: "matrix_mautrix_hangouts_enabled|bool and (matrix_nginx_proxy_enabled is not defined or matrix_nginx_proxy_enabled|bool == false)"
  58. # ansible lower than 2.8, does not support docker_image build parameters
  59. # for self buildig it is explicitly needed, so we rather fail here
  60. - name: Fail if running on Ansible lower than 2.8 and trying self building
  61. fail:
  62. msg: "To self build Mautrix Hangouts image, you should usa ansible 2.8 or higher. E.g. pip contains such packages."
  63. when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_hangouts_container_image_self_build"