Matrix Docker Ansible eploy
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

88 líneas
4.0 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:
  19. name: "{{ matrix_client_fluffychat_docker_image }}"
  20. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  21. force_source: "{{ matrix_client_fluffychat_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  22. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_client_fluffychat_docker_image_force_pull }}"
  23. when: "not matrix_client_fluffychat_container_image_self_build | bool"
  24. register: matrix_client_fluffychat_container_image_pull_result
  25. retries: "{{ devture_playbook_help_container_retries_count }}"
  26. delay: "{{ devture_playbook_help_container_retries_delay }}"
  27. until: matrix_client_fluffychat_container_image_pull_result is not failed
  28. - when: "matrix_client_fluffychat_container_image_self_build | bool"
  29. block:
  30. - name: Ensure FluffyChat Web repository is present on self-build
  31. ansible.builtin.git:
  32. repo: "{{ matrix_client_fluffychat_container_image_self_build_repo }}"
  33. dest: "{{ matrix_client_fluffychat_container_src_files_path }}"
  34. version: "{{ matrix_client_fluffychat_container_image_self_build_version }}"
  35. force: "yes"
  36. become: true
  37. become_user: "{{ matrix_user_name }}"
  38. register: matrix_client_fluffychat_git_pull_results
  39. - name: Ensure FluffyChat Web container image is built
  40. ansible.builtin.command:
  41. cmd: |-
  42. {{ devture_systemd_docker_base_host_command_docker }} buildx build
  43. --tag={{ matrix_client_fluffychat_docker_image }}
  44. --file={{ matrix_client_fluffychat_container_src_files_path }}/Dockerfile
  45. {{ matrix_client_fluffychat_container_src_files_path }}
  46. changed_when: true
  47. - name: Ensure FluffyChat Web config files installed
  48. ansible.builtin.template:
  49. src: "{{ item.src }}"
  50. dest: "{{ item.dest }}"
  51. mode: '0644'
  52. owner: "{{ matrix_user_name }}"
  53. group: "{{ matrix_group_name }}"
  54. with_items:
  55. - {src: "{{ role_path }}/templates/labels.j2", dest: "{{ matrix_client_fluffychat_base_path }}/labels"}
  56. - {src: "{{ role_path }}/templates/config.json.j2", dest: "{{ matrix_client_fluffychat_config_path }}/config.json"}
  57. when: "item.src is not none"
  58. register: matrix_client_fluffychat_config_result
  59. - name: Ensure FluffyChat Web container network is created
  60. community.general.docker_network:
  61. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  62. name: "{{ matrix_client_fluffychat_container_network }}"
  63. driver: bridge
  64. driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
  65. - name: Ensure matrix-client-fluffychat.service installed
  66. ansible.builtin.template:
  67. src: "{{ role_path }}/templates/systemd/matrix-client-fluffychat.service.j2"
  68. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-client-fluffychat.service"
  69. mode: '0644'
  70. register: matrix_client_fluffychat_systemd_service_result
  71. - name: Determine whether FluffyChat Web needs a restart
  72. ansible.builtin.set_fact:
  73. matrix_client_fluffychat_restart_necessary: >-
  74. {{
  75. matrix_client_fluffychat_config_result.changed | default(false)
  76. or matrix_client_fluffychat_systemd_service_result.changed | default(false)
  77. or matrix_client_fluffychat_container_image_pull_result.changed | default(false)
  78. }}