Matrix Docker Ansible eploy
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

91 líneas
4.1 KiB

  1. # SPDX-FileCopyrightText: 2022 - 2023 Julian-Samuel Gebühr
  2. # SPDX-FileCopyrightText: 2022 - 2024 Slavi Pantaleev
  3. # SPDX-FileCopyrightText: 2022 Sebastian Gumprich
  4. #
  5. # SPDX-License-Identifier: AGPL-3.0-or-later
  6. ---
  7. - name: Ensure matrix-cactus-comments paths exist
  8. ansible.builtin.file:
  9. path: "{{ item.path }}"
  10. state: directory
  11. mode: 0750
  12. owner: "{{ matrix_user_name }}"
  13. group: "{{ matrix_group_name }}"
  14. with_items:
  15. - {path: "{{ matrix_cactus_comments_base_path }}", when: true}
  16. - {path: "{{ matrix_cactus_comments_container_tmp_path }}", when: true}
  17. - {path: "{{ matrix_cactus_comments_docker_src_files_path }}", when: "{{ matrix_cactus_comments_container_image_self_build }}"}
  18. when: "item.when | bool"
  19. - name: Ensure matrix-cactus-comments environment file created
  20. ansible.builtin.template:
  21. src: "{{ role_path }}/templates/env.j2"
  22. dest: "{{ matrix_cactus_comments_app_service_env_file }}"
  23. owner: "{{ matrix_user_name }}"
  24. group: "{{ matrix_group_name }}"
  25. mode: 0640
  26. register: matrix_cactus_comments_config_env_result
  27. - name: Ensure matrix-cactus-comments appservice file created
  28. ansible.builtin.template:
  29. src: "{{ role_path }}/templates/cactus_appservice.yaml.j2"
  30. dest: "{{ matrix_cactus_comments_app_service_config_file }}"
  31. owner: "{{ matrix_user_name }}"
  32. group: "{{ matrix_group_name }}"
  33. mode: 0640
  34. register: matrix_cactus_comments_config_appservice_result
  35. - name: Ensure matrix-cactus-comments image is pulled
  36. community.docker.docker_image:
  37. name: "{{ matrix_cactus_comments_docker_image }}"
  38. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  39. force_source: "{{ matrix_cactus_comments_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  40. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_cactus_comments_docker_image_force_pull }}"
  41. when: "not matrix_cactus_comments_container_image_self_build | bool"
  42. register: matrix_cactus_comments_container_image_pull_result
  43. retries: "{{ devture_playbook_help_container_retries_count }}"
  44. delay: "{{ devture_playbook_help_container_retries_delay }}"
  45. until: matrix_cactus_comments_container_image_pull_result is not failed
  46. - name: Ensure matrix-cactus-comments repository is present on self-build
  47. ansible.builtin.git:
  48. repo: "{{ matrix_cactus_comments_docker_repo }}"
  49. version: "{{ matrix_cactus_comments_docker_repo_version }}"
  50. dest: "{{ matrix_cactus_comments_docker_src_files_path }}"
  51. force: "yes"
  52. become: true
  53. become_user: "{{ matrix_user_name }}"
  54. register: matrix_cactus_comments_git_pull_results
  55. when: "matrix_cactus_comments_container_image_self_build | bool"
  56. - name: Ensure matrix-cactus-comments image is built
  57. community.docker.docker_image:
  58. name: "{{ matrix_cactus_comments_docker_image }}"
  59. source: build
  60. force_source: "{{ matrix_cactus_comments_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  61. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_cactus_comments_git_pull_results.changed }}"
  62. build:
  63. dockerfile: Dockerfile
  64. path: "{{ matrix_cactus_comments_docker_src_files_path }}"
  65. pull: true
  66. when: "matrix_cactus_comments_container_image_self_build | bool"
  67. - name: Ensure matrix-cactus-comments.service installed
  68. ansible.builtin.template:
  69. src: "{{ role_path }}/templates/systemd/matrix-cactus-comments.service.j2"
  70. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-cactus-comments.service"
  71. mode: 0644
  72. register: matrix_cactus_comments_systemd_service_result
  73. - name: Determine whether matrix-cactus-comments needs a restart
  74. ansible.builtin.set_fact:
  75. matrix_cactus_comments_restart_necessary: >-
  76. {{
  77. matrix_cactus_comments_config_env_result.changed | default(false)
  78. or matrix_cactus_comments_config_appservice_result.changed | default(false)
  79. or matrix_cactus_comments_systemd_service_result.changed | default(false)
  80. or matrix_cactus_comments_container_image_pull_result.changed | default(false)
  81. }}