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

85 строки
4.2 KiB

  1. # SPDX-FileCopyrightText: 2022 - 2024 Slavi Pantaleev
  2. # SPDX-FileCopyrightText: 2024 David Mehren
  3. #
  4. # SPDX-License-Identifier: AGPL-3.0-or-later
  5. ---
  6. - name: Ensure matrix-synapse-reverse-proxy-companion paths exist
  7. ansible.builtin.file:
  8. path: "{{ item.path }}"
  9. state: directory
  10. mode: '0750'
  11. owner: "{{ matrix_user_name }}"
  12. group: "{{ matrix_group_name }}"
  13. with_items:
  14. - {path: "{{ matrix_synapse_reverse_proxy_companion_base_path }}", when: true}
  15. - {path: "{{ matrix_synapse_reverse_proxy_companion_confd_path }}", when: true}
  16. - {path: "{{ matrix_synapse_reverse_proxy_companion_njs_path }}", when: "{{ matrix_synapse_reverse_proxy_companion_njs_enabled }}"}
  17. when: item.when | bool
  18. - name: Ensure matrix-synapse-reverse-proxy-companion is configured
  19. ansible.builtin.template:
  20. src: "{{ item.src }}"
  21. dest: "{{ item.dest }}"
  22. owner: "{{ matrix_user_name }}"
  23. group: "{{ matrix_group_name }}"
  24. mode: '0644'
  25. with_items:
  26. - src: "{{ role_path }}/templates/reverse_proxy_companion/nginx/nginx.conf.j2"
  27. dest: "{{ matrix_synapse_reverse_proxy_companion_base_path }}/nginx.conf"
  28. - src: "{{ role_path }}/templates/reverse_proxy_companion/nginx/conf.d/nginx-http.conf.j2"
  29. dest: "{{ matrix_synapse_reverse_proxy_companion_confd_path }}/nginx-http.conf"
  30. - src: "{{ role_path }}/templates/reverse_proxy_companion/nginx/conf.d/matrix-synapse-reverse-proxy-companion.conf.j2"
  31. dest: "{{ matrix_synapse_reverse_proxy_companion_confd_path }}/matrix-synapse-reverse-proxy-companion.conf"
  32. - src: "{{ role_path }}/templates/reverse_proxy_companion/labels.j2"
  33. dest: "{{ matrix_synapse_reverse_proxy_companion_base_path }}/labels"
  34. register: matrix_synapse_reverse_proxy_companion_config_result
  35. - name: Ensure matrix-synapse-reverse-proxy-companion whoami sync worker router njs script is deployed
  36. ansible.builtin.template:
  37. src: "{{ role_path }}/templates/reverse_proxy_companion/nginx/njs/whoami_sync_worker_router.js.j2"
  38. dest: "{{ matrix_synapse_reverse_proxy_companion_njs_path }}/whoami_sync_worker_router.js"
  39. owner: "{{ matrix_user_name }}"
  40. group: "{{ matrix_group_name }}"
  41. mode: '0644'
  42. when: matrix_synapse_reverse_proxy_companion_whoami_sync_worker_router_enabled | bool
  43. - name: Ensure matrix-synapse-reverse-proxy-companion njs path is removed when njs is disabled
  44. ansible.builtin.file:
  45. path: "{{ matrix_synapse_reverse_proxy_companion_njs_path }}"
  46. state: absent
  47. when: not matrix_synapse_reverse_proxy_companion_njs_enabled
  48. - name: Ensure matrix-synapse-reverse-proxy-companion nginx container image is pulled
  49. community.docker.docker_image_pull:
  50. name: "{{ matrix_synapse_reverse_proxy_companion_container_image }}"
  51. pull: always
  52. register: matrix_synapse_reverse_proxy_companion_container_image_pull_result
  53. retries: "{{ devture_playbook_help_container_retries_count }}"
  54. delay: "{{ devture_playbook_help_container_retries_delay }}"
  55. until: matrix_synapse_reverse_proxy_companion_container_image_pull_result is not failed
  56. - name: Ensure matrix-synapse-reverse-proxy-companion container network is created
  57. community.general.docker_network:
  58. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  59. name: "{{ matrix_synapse_reverse_proxy_companion_container_network }}"
  60. driver: bridge
  61. driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
  62. - name: Ensure matrix-synapse-reverse-proxy-companion.service installed
  63. ansible.builtin.template:
  64. src: "{{ role_path }}/templates/reverse_proxy_companion/systemd/matrix-synapse-reverse-proxy-companion.service.j2"
  65. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-synapse-reverse-proxy-companion.service"
  66. mode: '0644'
  67. register: matrix_synapse_reverse_proxy_companion_systemd_service_result
  68. - name: Determine whether Synapse reverse-proxy companion needs a restart
  69. ansible.builtin.set_fact:
  70. matrix_synapse_reverse_proxy_companion_restart_necessary: >-
  71. {{
  72. matrix_synapse_reverse_proxy_companion_config_result.changed | default(false)
  73. or matrix_synapse_reverse_proxy_companion_systemd_service_result.changed | default(false)
  74. or matrix_synapse_reverse_proxy_companion_container_image_pull_result.changed | default(false)
  75. }}