Matrix Docker Ansible eploy
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 

75 рядки
3.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_data_path }}", when: true}
  14. - {path: "{{ matrix_client_fluffychat_container_src_files_path }}", when: "{{ matrix_client_fluffychat_container_image_self_build }}"}
  15. when: "item.when | bool"
  16. - name: Ensure FluffyChat Web container image is pulled
  17. community.docker.docker_image:
  18. name: "{{ matrix_client_fluffychat_docker_image }}"
  19. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  20. force_source: "{{ matrix_client_fluffychat_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  21. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_client_fluffychat_docker_image_force_pull }}"
  22. when: "not matrix_client_fluffychat_container_image_self_build | bool"
  23. register: result
  24. retries: "{{ devture_playbook_help_container_retries_count }}"
  25. delay: "{{ devture_playbook_help_container_retries_delay }}"
  26. until: result is not failed
  27. - when: "matrix_client_fluffychat_container_image_self_build | bool"
  28. block:
  29. - name: Ensure FluffyChat Web repository is present on self-build
  30. ansible.builtin.git:
  31. repo: "{{ matrix_client_fluffychat_container_image_self_build_repo }}"
  32. dest: "{{ matrix_client_fluffychat_container_src_files_path }}"
  33. version: "{{ matrix_client_fluffychat_container_image_self_build_version }}"
  34. force: "yes"
  35. become: true
  36. become_user: "{{ matrix_user_name }}"
  37. register: matrix_client_fluffychat_git_pull_results
  38. - name: Ensure FluffyChat Web container image is built
  39. ansible.builtin.command:
  40. cmd: |-
  41. {{ devture_systemd_docker_base_host_command_docker }} buildx build
  42. --tag={{ matrix_client_fluffychat_docker_image }}
  43. --file={{ matrix_client_fluffychat_container_src_files_path }}/Dockerfile
  44. {{ matrix_client_fluffychat_container_src_files_path }}
  45. changed_when: true
  46. - name: Ensure FluffyChat Web config files installed
  47. ansible.builtin.template:
  48. src: "{{ item.src }}"
  49. dest: "{{ matrix_client_fluffychat_data_path }}/{{ item.name }}"
  50. mode: 0644
  51. owner: "{{ matrix_user_name }}"
  52. group: "{{ matrix_group_name }}"
  53. with_items:
  54. - {src: "{{ role_path }}/templates/labels.j2", name: "labels"}
  55. when: "item.src is not none"
  56. - name: Ensure FluffyChat Web container network is created
  57. community.general.docker_network:
  58. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  59. name: "{{ matrix_client_fluffychat_container_network }}"
  60. driver: bridge
  61. driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
  62. - name: Ensure matrix-client-fluffychat.service installed
  63. ansible.builtin.template:
  64. src: "{{ role_path }}/templates/systemd/matrix-client-fluffychat.service.j2"
  65. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-client-fluffychat.service"
  66. mode: 0644