Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

76 строки
3.3 KiB

  1. # SPDX-FileCopyrightText: 2024 MDAD Team and contributors
  2. #
  3. # SPDX-License-Identifier: AGPL-3.0-or-later
  4. ---
  5. - name: Ensure matrix-cactus-comments 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_cactus_comments_base_path }}", when: true}
  14. - {path: "{{ matrix_cactus_comments_container_tmp_path }}", when: true}
  15. - {path: "{{ matrix_cactus_comments_docker_src_files_path }}", when: matrix_cactus_comments_container_image_self_build}
  16. when: "item.when | bool"
  17. - name: Ensure matrix-cactus-comments environment file created
  18. ansible.builtin.template:
  19. src: "{{ role_path }}/templates/env.j2"
  20. dest: "{{ matrix_cactus_comments_app_service_env_file }}"
  21. owner: "{{ matrix_user_username }}"
  22. group: "{{ matrix_user_groupname }}"
  23. mode: 0640
  24. - name: Ensure matrix-cactus-comments appservice file created
  25. ansible.builtin.template:
  26. src: "{{ role_path }}/templates/cactus_appservice.yaml.j2"
  27. dest: "{{ matrix_cactus_comments_app_service_config_file }}"
  28. owner: "{{ matrix_user_username }}"
  29. group: "{{ matrix_user_groupname }}"
  30. mode: 0640
  31. - name: Ensure matrix-cactus-comments image is pulled
  32. community.docker.docker_image:
  33. name: "{{ matrix_cactus_comments_docker_image }}"
  34. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  35. force_source: "{{ matrix_cactus_comments_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  36. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_cactus_comments_docker_image_force_pull }}"
  37. when: "not matrix_cactus_comments_container_image_self_build | bool"
  38. register: result
  39. retries: "{{ devture_playbook_help_container_retries_count }}"
  40. delay: "{{ devture_playbook_help_container_retries_delay }}"
  41. until: result is not failed
  42. - name: Ensure matrix-cactus-comments repository is present on self-build
  43. ansible.builtin.git:
  44. repo: "{{ matrix_cactus_comments_docker_repo }}"
  45. version: "{{ matrix_cactus_comments_docker_repo_version }}"
  46. dest: "{{ matrix_cactus_comments_docker_src_files_path }}"
  47. force: "yes"
  48. become: true
  49. become_user: "{{ matrix_user_username }}"
  50. register: matrix_cactus_comments_git_pull_results
  51. when: "matrix_cactus_comments_container_image_self_build | bool"
  52. - name: Ensure matrix-cactus-comments image is built
  53. community.docker.docker_image:
  54. name: "{{ matrix_cactus_comments_docker_image }}"
  55. source: build
  56. force_source: "{{ matrix_cactus_comments_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  57. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_cactus_comments_git_pull_results.changed }}"
  58. build:
  59. dockerfile: Dockerfile
  60. path: "{{ matrix_cactus_comments_docker_src_files_path }}"
  61. pull: true
  62. when: "matrix_cactus_comments_container_image_self_build | bool"
  63. - name: Ensure matrix-cactus-comments.service installed
  64. ansible.builtin.template:
  65. src: "{{ role_path }}/templates/systemd/matrix-cactus-comments.service.j2"
  66. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-cactus-comments.service"
  67. mode: 0644