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

96 строки
4.2 KiB

  1. # SPDX-FileCopyrightText: 2025 Nikita Chernyi
  2. #
  3. # SPDX-License-Identifier: AGPL-3.0-or-later
  4. ---
  5. - name: Ensure FluffyChat Web paths exists
  6. ansible.builtin.file:
  7. path: "{{ item.path }}"
  8. state: directory
  9. mode: '0750'
  10. owner: "{{ matrix_user_name }}"
  11. group: "{{ matrix_group_name }}"
  12. with_items:
  13. - {path: "{{ matrix_client_fluffychat_base_path }}", when: true}
  14. - {path: "{{ matrix_client_fluffychat_config_path }}", when: true}
  15. - {path: "{{ matrix_client_fluffychat_container_src_files_path }}", when: "{{ matrix_client_fluffychat_container_image_self_build }}"}
  16. when: "item.when | bool"
  17. - name: Ensure FluffyChat Web container image is pulled
  18. community.docker.docker_image_pull:
  19. name: "{{ matrix_client_fluffychat_container_image }}"
  20. pull: always
  21. when: "not matrix_client_fluffychat_container_image_self_build | bool"
  22. register: matrix_client_fluffychat_container_image_pull_result
  23. retries: "{{ devture_playbook_help_container_retries_count }}"
  24. delay: "{{ devture_playbook_help_container_retries_delay }}"
  25. until: matrix_client_fluffychat_container_image_pull_result is not failed
  26. - when: "matrix_client_fluffychat_container_image_self_build | bool"
  27. block:
  28. # A checkout owned by a different user (a uid change, an earlier clone by another user, etc.) would make the git task below fail on ownership or permissions.
  29. - name: Ensure FluffyChat Web repository ownership is correct on self-build
  30. ansible.builtin.file:
  31. path: "{{ matrix_client_fluffychat_container_src_files_path }}"
  32. state: directory
  33. owner: "{{ matrix_user_name }}"
  34. group: "{{ matrix_group_name }}"
  35. recurse: true
  36. - name: Ensure FluffyChat Web repository is present on self-build
  37. ansible.builtin.git:
  38. repo: "{{ matrix_client_fluffychat_container_image_self_build_repo }}"
  39. dest: "{{ matrix_client_fluffychat_container_src_files_path }}"
  40. version: "{{ matrix_client_fluffychat_container_image_self_build_version }}"
  41. force: "yes"
  42. become: true
  43. become_user: "{{ matrix_user_name }}"
  44. register: matrix_client_fluffychat_git_pull_results
  45. - name: Ensure FluffyChat Web container image is built
  46. ansible.builtin.command:
  47. cmd: |-
  48. {{ devture_systemd_docker_base_host_command_docker }} buildx build
  49. --tag={{ matrix_client_fluffychat_container_image }}
  50. --file={{ matrix_client_fluffychat_container_src_files_path }}/Dockerfile
  51. {{ matrix_client_fluffychat_container_src_files_path }}
  52. changed_when: true
  53. - name: Ensure FluffyChat Web config files installed
  54. ansible.builtin.template:
  55. src: "{{ item.src }}"
  56. dest: "{{ item.dest }}"
  57. mode: '0644'
  58. owner: "{{ matrix_user_name }}"
  59. group: "{{ matrix_group_name }}"
  60. with_items:
  61. - {src: "{{ role_path }}/templates/labels.j2", dest: "{{ matrix_client_fluffychat_base_path }}/labels"}
  62. - {src: "{{ role_path }}/templates/config.json.j2", dest: "{{ matrix_client_fluffychat_config_path }}/config.json"}
  63. when: "item.src is not none"
  64. register: matrix_client_fluffychat_config_result
  65. - name: Ensure FluffyChat Web container network is created
  66. when: matrix_client_fluffychat_container_network != 'host'
  67. community.general.docker_network:
  68. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  69. name: "{{ matrix_client_fluffychat_container_network }}"
  70. driver: bridge
  71. driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
  72. - name: Ensure matrix-client-fluffychat.service installed
  73. ansible.builtin.template:
  74. src: "{{ role_path }}/templates/systemd/matrix-client-fluffychat.service.j2"
  75. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-client-fluffychat.service"
  76. mode: '0644'
  77. register: matrix_client_fluffychat_systemd_service_result
  78. - name: Determine whether FluffyChat Web needs a restart
  79. ansible.builtin.set_fact:
  80. matrix_client_fluffychat_restart_necessary: >-
  81. {{
  82. matrix_client_fluffychat_config_result.changed | default(false)
  83. or matrix_client_fluffychat_systemd_service_result.changed | default(false)
  84. or matrix_client_fluffychat_container_image_pull_result.changed | default(false)
  85. }}