Matrix Docker Ansible eploy
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

77 行
3.2 KiB

  1. # SPDX-FileCopyrightText: 2021 Toni Spets
  2. # SPDX-FileCopyrightText: 2022 - 2024 Slavi Pantaleev
  3. # SPDX-FileCopyrightText: 2022 Jim Myhrberg
  4. # SPDX-FileCopyrightText: 2022 Marko Weltzer
  5. # SPDX-FileCopyrightText: 2022 Nikita Chernyi
  6. # SPDX-FileCopyrightText: 2022 Sebastian Gumprich
  7. # SPDX-FileCopyrightText: 2024 David Mehren
  8. #
  9. # SPDX-License-Identifier: AGPL-3.0-or-later
  10. ---
  11. - name: Ensure Heisenbridge image is pulled
  12. community.docker.docker_image:
  13. name: "{{ matrix_heisenbridge_container_image }}"
  14. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  15. force_source: "{{ matrix_heisenbridge_container_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  16. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_heisenbridge_container_image_force_pull }}"
  17. register: matrix_heisenbridge_container_image_pull_result
  18. retries: "{{ devture_playbook_help_container_retries_count }}"
  19. delay: "{{ devture_playbook_help_container_retries_delay }}"
  20. until: matrix_heisenbridge_container_image_pull_result is not failed
  21. - name: Ensure Heisenbridge paths exist
  22. ansible.builtin.file:
  23. path: "{{ item }}"
  24. state: directory
  25. mode: '0750'
  26. owner: "{{ matrix_user_name }}"
  27. group: "{{ matrix_group_name }}"
  28. with_items:
  29. - "{{ matrix_heisenbridge_base_path }}"
  30. - name: Ensure Heisenbridge registration.yaml installed if provided
  31. ansible.builtin.copy:
  32. content: "{{ matrix_heisenbridge_registration | to_nice_yaml(indent=2, width=999999) }}"
  33. dest: "{{ matrix_heisenbridge_base_path }}/registration.yaml"
  34. mode: '0644'
  35. owner: "{{ matrix_user_name }}"
  36. group: "{{ matrix_group_name }}"
  37. register: matrix_heisenbridge_registration_result
  38. - name: Ensure Heisenbridge support files installed
  39. ansible.builtin.template:
  40. src: "{{ role_path }}/templates/{{ item }}.j2"
  41. dest: "{{ matrix_heisenbridge_base_path }}/{{ item }}"
  42. mode: '0640'
  43. owner: "{{ matrix_user_name }}"
  44. group: "{{ matrix_group_name }}"
  45. with_items:
  46. - labels
  47. register: matrix_heisenbridge_support_files_result
  48. - name: Ensure Heisenbridge container network is created
  49. community.general.docker_network:
  50. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  51. name: "{{ matrix_heisenbridge_container_network }}"
  52. driver: bridge
  53. driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
  54. - name: Ensure matrix-heisenbridge.service installed
  55. ansible.builtin.template:
  56. src: "{{ role_path }}/templates/systemd/matrix-heisenbridge.service.j2"
  57. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-heisenbridge.service"
  58. mode: '0644'
  59. register: matrix_heisenbridge_systemd_service_result
  60. - name: Determine whether matrix-heisenbridge needs a restart
  61. ansible.builtin.set_fact:
  62. matrix_heisenbridge_restart_necessary: >-
  63. {{
  64. matrix_heisenbridge_registration_result.changed | default(false)
  65. or matrix_heisenbridge_support_files_result.changed | default(false)
  66. or matrix_heisenbridge_systemd_service_result.changed | default(false)
  67. or matrix_heisenbridge_container_image_pull_result.changed | default(false)
  68. }}