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ů.
 
 

88 řádky
4.5 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. fail:
  6. msg: "To self-build the Synapse 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_synapse_container_image_self_build and matrix_synapse_enabled"
  8. # Unless `matrix_synapse_workers_enabled_list` is explicitly defined,
  9. # we'll generate it dynamically.
  10. - import_tasks: "{{ role_path }}/tasks/synapse/workers/init.yml"
  11. when: "matrix_synapse_enabled and matrix_synapse_workers_enabled and matrix_synapse_workers_enabled_list|length == 0"
  12. - set_fact:
  13. matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-synapse.service'] }}"
  14. when: matrix_synapse_enabled|bool
  15. - name: Ensure systemd services for workers are injected
  16. include_tasks: "{{ role_path }}/tasks/synapse/workers/util/inject_systemd_services_for_worker.yml"
  17. with_items: "{{ matrix_synapse_workers_enabled_list }}"
  18. loop_control:
  19. loop_var: matrix_synapse_worker_details
  20. when: matrix_synapse_enabled|bool and matrix_synapse_workers_enabled|bool
  21. - set_fact:
  22. matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-goofys.service'] }}"
  23. when: matrix_s3_media_store_enabled|bool
  24. - block:
  25. - name: Fail if matrix-nginx-proxy role already executed
  26. fail:
  27. msg: >-
  28. Trying to append Synapse's reverse-proxying configuration to matrix-nginx-proxy,
  29. but it's pointless since the matrix-nginx-proxy role had already executed.
  30. To fix this, please change the order of roles in your playbook,
  31. so that the matrix-nginx-proxy role would run after the matrix-synapse role.
  32. when: matrix_nginx_proxy_role_executed|default(False)|bool
  33. - name: Generate synapse metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/synapse/main-process)
  34. set_fact:
  35. matrix_synapse_nginx_metrics_configuration_block: |
  36. location /metrics/synapse/main-process {
  37. {% if matrix_nginx_proxy_enabled|default(False) %}
  38. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  39. resolver 127.0.0.11 valid=5s;
  40. set $backend "matrix-synapse:{{ matrix_synapse_metrics_port }}";
  41. proxy_pass http://$backend/_synapse/metrics;
  42. {% else %}
  43. {# Generic configuration for use outside of our container setup #}
  44. proxy_pass http://127.0.0.1:{{ matrix_synapse_metrics_port }}/_synapse/metrics;
  45. {% endif %}
  46. }
  47. - name: Register synapse metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/synapse/main-process)
  48. set_fact:
  49. matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
  50. {{
  51. matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks|default([])
  52. +
  53. [matrix_synapse_nginx_metrics_configuration_block]
  54. }}
  55. - name: Generate synapse worker metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/synapse/worker)
  56. set_fact:
  57. matrix_synapse_worker_nginx_metrics_configuration_block: |
  58. {% for worker in matrix_synapse_workers_enabled_list %}
  59. {% if worker.metrics_port != 0 %}
  60. location /metrics/synapse/worker/{{ worker.type }}-{{ worker.instanceId }} {
  61. resolver 127.0.0.11 valid=5s;
  62. set $backend "matrix-synapse-worker-{{ worker.type }}-{{ worker.instanceId }}:{{ worker.metrics_port }}";
  63. proxy_pass http://$backend/_synapse/metrics;
  64. proxy_set_header Host $host;
  65. }
  66. {% endif %}
  67. {% endfor %}
  68. when: matrix_synapse_workers_enabled_list|length > 0
  69. - name: Register synapse worker metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/synapse/worker)
  70. set_fact:
  71. matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: |
  72. {{
  73. matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks|default([])
  74. +
  75. [matrix_synapse_worker_nginx_metrics_configuration_block]
  76. }}
  77. when: matrix_synapse_workers_enabled_list|length > 0
  78. when: matrix_synapse_enabled|bool and matrix_synapse_metrics_proxying_enabled|bool