Matrix Docker Ansible eploy
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

88 linhas
3.7 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_container_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_pull:
  37. name: "{{ matrix_cactus_comments_container_image }}"
  38. pull: always
  39. when: "not matrix_cactus_comments_container_image_self_build | bool"
  40. register: matrix_cactus_comments_container_image_pull_result
  41. retries: "{{ devture_playbook_help_container_retries_count }}"
  42. delay: "{{ devture_playbook_help_container_retries_delay }}"
  43. until: matrix_cactus_comments_container_image_pull_result is not failed
  44. - name: Ensure matrix-cactus-comments repository is present on self-build
  45. ansible.builtin.git:
  46. repo: "{{ matrix_cactus_comments_container_repo }}"
  47. version: "{{ matrix_cactus_comments_container_repo_version }}"
  48. dest: "{{ matrix_cactus_comments_container_src_files_path }}"
  49. force: "yes"
  50. become: true
  51. become_user: "{{ matrix_user_name }}"
  52. register: matrix_cactus_comments_git_pull_results
  53. when: "matrix_cactus_comments_container_image_self_build | bool"
  54. - name: Ensure matrix-cactus-comments image is built
  55. community.docker.docker_image_build:
  56. name: "{{ matrix_cactus_comments_container_image }}"
  57. dockerfile: Dockerfile
  58. path: "{{ matrix_cactus_comments_container_src_files_path }}"
  59. pull: true
  60. rebuild: "{{ 'always' if matrix_cactus_comments_git_pull_results.changed | bool else 'never' }}"
  61. when: "matrix_cactus_comments_container_image_self_build | bool"
  62. register: matrix_cactus_comments_container_image_build_result
  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'
  68. register: matrix_cactus_comments_systemd_service_result
  69. - name: Determine whether matrix-cactus-comments needs a restart
  70. ansible.builtin.set_fact:
  71. matrix_cactus_comments_restart_necessary: >-
  72. {{
  73. matrix_cactus_comments_config_env_result.changed | default(false)
  74. or matrix_cactus_comments_config_appservice_result.changed | default(false)
  75. or matrix_cactus_comments_systemd_service_result.changed | default(false)
  76. or matrix_cactus_comments_container_image_pull_result.changed | default(false)
  77. or matrix_cactus_comments_container_image_build_result.changed | default(false)
  78. }}