Matrix Docker Ansible eploy
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 

81 lignes
3.3 KiB

  1. # SPDX-FileCopyrightText: 2023 - 2025 Slavi Pantaleev
  2. # SPDX-FileCopyrightText: 2025 Suguru Hirahara
  3. #
  4. # SPDX-License-Identifier: AGPL-3.0-or-later
  5. ---
  6. - name: Ensure Matrix.to path exists
  7. ansible.builtin.file:
  8. path: "{{ item }}"
  9. state: directory
  10. mode: "0750"
  11. owner: "{{ matrix_user_name }}"
  12. group: "{{ matrix_group_name }}"
  13. with_items:
  14. - "{{ matrix_matrixto_base_path }}"
  15. - name: Ensure Matrix.to support files installed
  16. ansible.builtin.template:
  17. src: "{{ role_path }}/templates/{{ item }}.j2"
  18. dest: "{{ matrix_matrixto_base_path }}/{{ item }}"
  19. mode: "0640"
  20. owner: "{{ matrix_user_name }}"
  21. group: "{{ matrix_group_name }}"
  22. with_items:
  23. - env
  24. - labels
  25. register: matrix_matrixto_support_files_result
  26. - name: Ensure Matrix.to repository is present on self-build
  27. ansible.builtin.git:
  28. repo: "{{ matrix_matrixto_container_image_self_build_repo }}"
  29. version: "{{ matrix_matrixto_container_image_self_build_repo_version }}"
  30. dest: "{{ matrix_matrixto_container_image_self_build_src_files_path }}"
  31. force: "yes"
  32. register: matrix_matrixto_git_pull_results
  33. - name: Ensure Matrix.to container image is built
  34. community.docker.docker_image_build:
  35. name: "{{ matrix_matrixto_container_image_self_build_name }}"
  36. dockerfile: Dockerfile
  37. path: "{{ matrix_matrixto_container_image_self_build_src_files_path }}"
  38. pull: true
  39. rebuild: "{{ 'always' if matrix_matrixto_git_pull_results.changed | bool else 'never' }}"
  40. register: matrix_matrixto_container_image_build_result
  41. - name: Ensure Matrix.to container network is created via community.docker.docker_network
  42. when: devture_systemd_docker_base_container_network_creation_method == 'ansible-module'
  43. community.docker.docker_network:
  44. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  45. name: "{{ matrix_matrixto_container_network }}"
  46. driver: bridge
  47. driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
  48. - name: Ensure Matrix.to container network is created via ansible.builtin.command
  49. when: devture_systemd_docker_base_container_network_creation_method == 'command'
  50. ansible.builtin.command:
  51. cmd: >-
  52. {{ devture_systemd_docker_base_host_command_docker }} network create
  53. {% if devture_systemd_docker_base_ipv6_enabled %}--ipv6{% endif %}
  54. {{ devture_systemd_docker_base_container_networks_driver_options_string }}
  55. {{ matrix_matrixto_container_network }}
  56. register: network_creation_result
  57. changed_when: network_creation_result.rc == 0
  58. failed_when: network_creation_result.rc != 0 and 'already exists' not in network_creation_result.stderr
  59. - name: Ensure Matrix.to systemd service is present
  60. ansible.builtin.template:
  61. src: "{{ role_path }}/templates/systemd/matrix-matrixto.service.j2"
  62. dest: "{{ devture_systemd_docker_base_systemd_path }}/{{ matrix_matrixto_identifier }}.service"
  63. mode: "0644"
  64. register: matrix_matrixto_systemd_service_result
  65. - name: Determine whether Matrix.to needs a restart
  66. ansible.builtin.set_fact:
  67. matrix_matrixto_restart_necessary: >-
  68. {{
  69. matrix_matrixto_support_files_result.changed | default(false)
  70. or matrix_matrixto_systemd_service_result.changed | default(false)
  71. or matrix_matrixto_container_image_build_result.changed | default(false)
  72. }}