Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

111 wiersze
5.0 KiB

  1. # SPDX-FileCopyrightText: 2026 MDAD project contributors
  2. # SPDX-FileCopyrightText: 2026 Jason LaGuidice
  3. #
  4. # SPDX-License-Identifier: AGPL-3.0-or-later
  5. ---
  6. - name: Ensure RustPush paths exist
  7. ansible.builtin.file:
  8. path: "{{ item.path }}"
  9. state: directory
  10. mode: 0750
  11. owner: "{{ matrix_user_name }}"
  12. group: "{{ matrix_group_name }}"
  13. with_items:
  14. - {path: "{{ matrix_rustpush_bridge_base_path }}", when: true}
  15. - {path: "{{ matrix_rustpush_bridge_config_path }}", when: true}
  16. - {path: "{{ matrix_rustpush_bridge_data_path }}", when: true}
  17. - {path: "{{ matrix_rustpush_bridge_container_src_files_path }}", when: "{{ matrix_rustpush_bridge_container_image_self_build }}"}
  18. when: item.when | bool
  19. - name: Ensure RustPush repository is present on self-build
  20. ansible.builtin.git:
  21. repo: "{{ matrix_rustpush_bridge_container_image_self_build_repo }}"
  22. version: "{{ matrix_rustpush_bridge_container_image_self_build_repo_version }}"
  23. dest: "{{ matrix_rustpush_bridge_container_src_files_path }}"
  24. force: "yes"
  25. become: true
  26. become_user: "{{ matrix_user_name }}"
  27. register: matrix_rustpush_bridge_git_pull_results
  28. when: "matrix_rustpush_bridge_enabled | bool and matrix_rustpush_bridge_container_image_self_build"
  29. - name: Ensure RustPush Docker image is built
  30. community.docker.docker_image_build:
  31. name: "{{ matrix_rustpush_bridge_container_image }}"
  32. dockerfile: Dockerfile
  33. path: "{{ matrix_rustpush_bridge_container_src_files_path }}"
  34. pull: true
  35. rebuild: "{{ 'always' if matrix_rustpush_bridge_git_pull_results.changed | bool else 'never' }}"
  36. build_args:
  37. BUILD_VERSION: "{{ matrix_rustpush_bridge_container_image_self_build_repo_version }}"
  38. BUILD_COMMIT: "{{ matrix_rustpush_bridge_git_pull_results.after[:8] if matrix_rustpush_bridge_git_pull_results is defined and matrix_rustpush_bridge_git_pull_results.after is defined else 'unknown' }}"
  39. register: matrix_rustpush_bridge_container_image_build_result
  40. when: "matrix_rustpush_bridge_enabled | bool and matrix_rustpush_bridge_container_image_self_build | bool"
  41. - name: Ensure RustPush container image is pulled
  42. community.docker.docker_image_pull:
  43. name: "{{ matrix_rustpush_bridge_container_image }}"
  44. pull: always
  45. register: matrix_rustpush_bridge_container_image_pull_result
  46. when: "matrix_rustpush_bridge_enabled | bool and not matrix_rustpush_bridge_container_image_self_build | bool"
  47. retries: "{{ devture_playbook_help_container_retries_count }}"
  48. delay: "{{ devture_playbook_help_container_retries_delay }}"
  49. until: matrix_rustpush_bridge_container_image_pull_result is not failed
  50. ignore_errors: "{{ ansible_check_mode }}"
  51. - name: Ensure rustpush-bridge config.yaml installed
  52. ansible.builtin.copy:
  53. content: "{{ matrix_rustpush_bridge_configuration | to_nice_yaml(indent=2, width=999999) }}"
  54. dest: "{{ matrix_rustpush_bridge_config_path }}/config.yaml"
  55. mode: 0644
  56. owner: "{{ matrix_user_name }}"
  57. group: "{{ matrix_group_name }}"
  58. register: matrix_rustpush_bridge_config_result
  59. - name: Ensure rustpush-bridge registration.yaml installed
  60. ansible.builtin.copy:
  61. content: "{{ matrix_rustpush_bridge_registration | to_nice_yaml(indent=2, width=999999) }}"
  62. dest: "{{ matrix_rustpush_bridge_config_path }}/registration.yaml"
  63. mode: 0644
  64. owner: "{{ matrix_user_name }}"
  65. group: "{{ matrix_group_name }}"
  66. register: matrix_rustpush_bridge_registration_result
  67. - name: Ensure rustpush-bridge support files installed
  68. ansible.builtin.template:
  69. src: "{{ role_path }}/templates/{{ item }}.j2"
  70. dest: "{{ matrix_rustpush_bridge_base_path }}/{{ item }}"
  71. mode: 0640
  72. owner: "{{ matrix_user_name }}"
  73. group: "{{ matrix_group_name }}"
  74. with_items:
  75. - labels
  76. register: matrix_rustpush_bridge_support_files_result
  77. - name: Ensure matrix-rustpush-bridge container network is created
  78. community.general.docker_network:
  79. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  80. name: "{{ matrix_rustpush_bridge_container_network }}"
  81. driver: bridge
  82. driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
  83. - name: Ensure matrix-rustpush-bridge.service installed
  84. ansible.builtin.template:
  85. src: "{{ role_path }}/templates/systemd/matrix-rustpush-bridge.service.j2"
  86. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-rustpush-bridge.service"
  87. mode: 0644
  88. register: matrix_rustpush_bridge_systemd_service_result
  89. - name: Determine whether matrix-rustpush-bridge needs a restart
  90. ansible.builtin.set_fact:
  91. matrix_rustpush_bridge_restart_necessary: >-
  92. {{
  93. matrix_rustpush_bridge_config_result.changed | default(false)
  94. or matrix_rustpush_bridge_registration_result.changed | default(false)
  95. or matrix_rustpush_bridge_support_files_result.changed | default(false)
  96. or matrix_rustpush_bridge_systemd_service_result.changed | default(false)
  97. or matrix_rustpush_bridge_container_image_pull_result.changed | default(false)
  98. or matrix_rustpush_bridge_container_image_build_result.changed | default(false)
  99. }}