Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

75 lines
3.1 KiB

  1. # SPDX-FileCopyrightText: 2024 - 2025 Slavi Pantaleev
  2. # SPDX-FileCopyrightText: 2024 David Mehren
  3. #
  4. # SPDX-License-Identifier: AGPL-3.0-or-later
  5. ---
  6. - name: Ensure matrix-pantalaimon 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_pantalaimon_base_path }}", when: true}
  15. - {path: "{{ matrix_pantalaimon_data_path }}", when: true}
  16. - {path: "{{ matrix_pantalaimon_container_src_files_path }}", when: "{{ matrix_pantalaimon_container_image_self_build }}"}
  17. when: "item.when | bool"
  18. - name: Ensure matrix-pantalaimon config installed
  19. ansible.builtin.copy:
  20. content: "{{ matrix_pantalaimon_configuration }}"
  21. dest: "{{ matrix_pantalaimon_data_path }}/pantalaimon.conf"
  22. mode: 0644
  23. owner: "{{ matrix_user_name }}"
  24. group: "{{ matrix_group_name }}"
  25. - name: Ensure pantalaimon container image is pulled
  26. community.docker.docker_image:
  27. name: "{{ matrix_pantalaimon_docker_image }}"
  28. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  29. force_source: "{{ matrix_pantalaimon_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  30. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_pantalaimon_docker_image_force_pull }}"
  31. when: "not matrix_pantalaimon_container_image_self_build | bool"
  32. register: result
  33. retries: "{{ devture_playbook_help_container_retries_count }}"
  34. delay: "{{ devture_playbook_help_container_retries_delay }}"
  35. until: result is not failed
  36. - name: Ensure pantalaimon repository is present on self-build
  37. ansible.builtin.git:
  38. repo: "{{ matrix_pantalaimon_container_image_self_build_repo }}"
  39. version: "{{ matrix_pantalaimon_container_image_self_build_repo_version }}"
  40. dest: "{{ matrix_pantalaimon_container_src_files_path }}"
  41. force: "yes"
  42. become: true
  43. become_user: "{{ matrix_user_name }}"
  44. register: matrix_pantalaimon_git_pull_results
  45. when: "matrix_pantalaimon_container_image_self_build | bool"
  46. - name: Ensure pantalaimon container image is built
  47. community.docker.docker_image:
  48. name: "{{ matrix_pantalaimon_docker_image }}"
  49. source: build
  50. force_source: "{{ matrix_pantalaimon_git_pull_results.changed }}"
  51. build:
  52. dockerfile: Dockerfile
  53. path: "{{ matrix_pantalaimon_container_src_files_path }}"
  54. pull: true
  55. when: "matrix_pantalaimon_container_image_self_build | bool"
  56. - name: Ensure pantalaimon container network is created
  57. community.general.docker_network:
  58. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  59. name: "{{ matrix_pantalaimon_container_network }}"
  60. driver: bridge
  61. driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
  62. - name: Ensure matrix-pantalaimon.service installed
  63. ansible.builtin.template:
  64. src: "{{ role_path }}/templates/systemd/matrix-pantalaimon.service.j2"
  65. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-pantalaimon.service"
  66. mode: 0644