Matrix Docker Ansible eploy
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 

87 rader
4.5 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/nginx/nginx.conf.j2"
  27. dest: "{{ matrix_synapse_reverse_proxy_companion_base_path }}/nginx.conf"
  28. - src: "{{ role_path }}/templates/nginx/conf.d/nginx-http.conf.j2"
  29. dest: "{{ matrix_synapse_reverse_proxy_companion_confd_path }}/nginx-http.conf"
  30. - src: "{{ role_path }}/templates/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/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/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:
  50. name: "{{ matrix_synapse_reverse_proxy_companion_container_image }}"
  51. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  52. force_source: "{{ matrix_synapse_reverse_proxy_companion_container_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  53. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_synapse_reverse_proxy_companion_container_image_force_pull }}"
  54. register: matrix_synapse_reverse_proxy_companion_container_image_pull_result
  55. retries: "{{ devture_playbook_help_container_retries_count }}"
  56. delay: "{{ devture_playbook_help_container_retries_delay }}"
  57. until: matrix_synapse_reverse_proxy_companion_container_image_pull_result is not failed
  58. - name: Ensure matrix-synapse-reverse-proxy-companion container network is created
  59. community.general.docker_network:
  60. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  61. name: "{{ matrix_synapse_reverse_proxy_companion_container_network }}"
  62. driver: bridge
  63. driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
  64. - name: Ensure matrix-synapse-reverse-proxy-companion.service installed
  65. ansible.builtin.template:
  66. src: "{{ role_path }}/templates/systemd/matrix-synapse-reverse-proxy-companion.service.j2"
  67. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-synapse-reverse-proxy-companion.service"
  68. mode: '0644'
  69. register: matrix_synapse_reverse_proxy_companion_systemd_service_result
  70. - name: Determine whether Synapse reverse-proxy companion needs a restart
  71. ansible.builtin.set_fact:
  72. matrix_synapse_reverse_proxy_companion_restart_necessary: >-
  73. {{
  74. matrix_synapse_reverse_proxy_companion_config_result.changed | default(false)
  75. or matrix_synapse_reverse_proxy_companion_systemd_service_result.changed | default(false)
  76. or matrix_synapse_reverse_proxy_companion_container_image_pull_result.changed | default(false)
  77. }}