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

72 строки
3.2 KiB

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