Matrix Docker Ansible eploy
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

70 řádky
3.7 KiB

  1. ---
  2. # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
  3. # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
  4. - name: Fail if trying to self-build on Ansible < 2.8
  5. ansible.builtin.fail:
  6. msg: "To self-build the Matrix Registration image, you should use Ansible 2.8 or higher. See docs/ansible.md"
  7. when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_registration_container_image_self_build and matrix_registration_enabled"
  8. - ansible.builtin.set_fact:
  9. matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-registration.service'] }}"
  10. when: matrix_registration_enabled | bool
  11. - when: matrix_registration_enabled | bool
  12. tags:
  13. - always
  14. block:
  15. - name: Fail if matrix-nginx-proxy role already executed
  16. ansible.builtin.fail:
  17. msg: >-
  18. Trying to append matrix-registration's reverse-proxying configuration to matrix-nginx-proxy,
  19. but it's pointless since the matrix-nginx-proxy role had already executed.
  20. To fix this, please change the order of roles in your playbook,
  21. so that the matrix-nginx-proxy role would run after the matrix-registration role.
  22. when: matrix_nginx_proxy_role_executed | default(False) | bool
  23. - name: Generate matrix-registration proxying configuration for matrix-nginx-proxy
  24. ansible.builtin.set_fact:
  25. matrix_registration_matrix_nginx_proxy_configuration: |
  26. rewrite ^{{ matrix_registration_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_registration_public_endpoint }}/ permanent;
  27. rewrite ^{{ matrix_registration_public_endpoint }}/$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_registration_public_endpoint }}/register redirect;
  28. location ~ ^{{ matrix_registration_public_endpoint }}/(.*) {
  29. {% if matrix_nginx_proxy_enabled | default(False) %}
  30. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  31. resolver 127.0.0.11 valid=5s;
  32. set $backend "matrix-registration:5000";
  33. proxy_pass http://$backend/$1;
  34. {% else %}
  35. {# Generic configuration for use outside of our container setup #}
  36. proxy_pass http://127.0.0.1:8767/$1;
  37. {% endif %}
  38. {#
  39. Workaround matrix-registration serving the background image at /static
  40. (see https://github.com/ZerataX/matrix-registration/issues/47)
  41. #}
  42. sub_filter_once off;
  43. sub_filter_types text/css;
  44. sub_filter "/static/" "{{ matrix_registration_public_endpoint }}/static/";
  45. }
  46. - name: Register matrix-registration proxying configuration with matrix-nginx-proxy
  47. ansible.builtin.set_fact:
  48. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: |
  49. {{
  50. matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([])
  51. +
  52. [matrix_registration_matrix_nginx_proxy_configuration]
  53. }}
  54. - name: Warn about reverse-proxying if matrix-nginx-proxy not used
  55. ansible.builtin.debug:
  56. msg: >-
  57. NOTE: You've enabled the matrix-registration tool but are not using the matrix-nginx-proxy
  58. reverse proxy.
  59. Please make sure that you're proxying the `{{ matrix_registration_public_endpoint }}`
  60. URL endpoint to the matrix-registration container.
  61. You can expose the container's port using the `matrix_registration_container_http_host_bind_port` variable.
  62. when: "matrix_registration_enabled | bool and not matrix_nginx_proxy_enabled | default(False) | bool"