Matrix Docker Ansible eploy
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

86 righe
3.6 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. - name: Ensure FluffyChat Web repository is present on self-build
  29. ansible.builtin.git:
  30. repo: "{{ matrix_client_fluffychat_container_image_self_build_repo }}"
  31. dest: "{{ matrix_client_fluffychat_container_src_files_path }}"
  32. version: "{{ matrix_client_fluffychat_container_image_self_build_version }}"
  33. force: "yes"
  34. become: true
  35. become_user: "{{ matrix_user_name }}"
  36. register: matrix_client_fluffychat_git_pull_results
  37. - name: Ensure FluffyChat Web container image is built
  38. ansible.builtin.command:
  39. cmd: |-
  40. {{ devture_systemd_docker_base_host_command_docker }} buildx build
  41. --tag={{ matrix_client_fluffychat_container_image }}
  42. --file={{ matrix_client_fluffychat_container_src_files_path }}/Dockerfile
  43. {{ matrix_client_fluffychat_container_src_files_path }}
  44. changed_when: true
  45. - name: Ensure FluffyChat Web config files installed
  46. ansible.builtin.template:
  47. src: "{{ item.src }}"
  48. dest: "{{ item.dest }}"
  49. mode: '0644'
  50. owner: "{{ matrix_user_name }}"
  51. group: "{{ matrix_group_name }}"
  52. with_items:
  53. - {src: "{{ role_path }}/templates/labels.j2", dest: "{{ matrix_client_fluffychat_base_path }}/labels"}
  54. - {src: "{{ role_path }}/templates/config.json.j2", dest: "{{ matrix_client_fluffychat_config_path }}/config.json"}
  55. when: "item.src is not none"
  56. register: matrix_client_fluffychat_config_result
  57. - name: Ensure FluffyChat Web container network is created
  58. community.general.docker_network:
  59. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  60. name: "{{ matrix_client_fluffychat_container_network }}"
  61. driver: bridge
  62. driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
  63. - name: Ensure matrix-client-fluffychat.service installed
  64. ansible.builtin.template:
  65. src: "{{ role_path }}/templates/systemd/matrix-client-fluffychat.service.j2"
  66. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-client-fluffychat.service"
  67. mode: '0644'
  68. register: matrix_client_fluffychat_systemd_service_result
  69. - name: Determine whether FluffyChat Web needs a restart
  70. ansible.builtin.set_fact:
  71. matrix_client_fluffychat_restart_necessary: >-
  72. {{
  73. matrix_client_fluffychat_config_result.changed | default(false)
  74. or matrix_client_fluffychat_systemd_service_result.changed | default(false)
  75. or matrix_client_fluffychat_container_image_pull_result.changed | default(false)
  76. }}