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.
 
 

73 lines
3.0 KiB

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