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

83 строки
3.4 KiB

  1. # SPDX-FileCopyrightText: 2024 MDAD Team and contributors
  2. #
  3. # SPDX-License-Identifier: AGPL-3.0-or-later
  4. ---
  5. - name: Ensure Cinny paths exists
  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_client_cinny_data_path }}", when: true}
  14. - {path: "{{ matrix_client_cinny_docker_src_files_path }}", when: "{{ matrix_client_cinny_container_image_self_build }}"}
  15. when: "item.when | bool"
  16. - name: Ensure Cinny Docker image is pulled
  17. community.docker.docker_image:
  18. name: "{{ matrix_client_cinny_docker_image }}"
  19. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  20. force_source: "{{ matrix_client_cinny_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  21. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_client_cinny_docker_image_force_pull }}"
  22. when: "not matrix_client_cinny_container_image_self_build | bool"
  23. register: result
  24. retries: "{{ devture_playbook_help_container_retries_count }}"
  25. delay: "{{ devture_playbook_help_container_retries_delay }}"
  26. until: result is not failed
  27. - name: Ensure Cinny repository is present on self-build
  28. ansible.builtin.git:
  29. repo: "{{ matrix_client_cinny_container_image_self_build_repo }}"
  30. dest: "{{ matrix_client_cinny_docker_src_files_path }}"
  31. version: "{{ matrix_client_cinny_docker_image.split(':')[1] }}"
  32. force: "yes"
  33. become: true
  34. become_user: "{{ matrix_user_username }}"
  35. register: matrix_client_cinny_git_pull_results
  36. when: "matrix_client_cinny_container_image_self_build | bool"
  37. - name: Ensure Cinny configuration installed
  38. ansible.builtin.copy:
  39. content: "{{ matrix_client_cinny_configuration | to_nice_json }}"
  40. dest: "{{ matrix_client_cinny_data_path }}/config.json"
  41. mode: 0644
  42. owner: "{{ matrix_user_username }}"
  43. group: "{{ matrix_user_groupname }}"
  44. - name: Ensure Cinny additional config files installed
  45. ansible.builtin.template:
  46. src: "{{ item.src }}"
  47. dest: "{{ matrix_client_cinny_data_path }}/{{ item.name }}"
  48. mode: 0644
  49. owner: "{{ matrix_user_username }}"
  50. group: "{{ matrix_user_groupname }}"
  51. with_items:
  52. - {src: "{{ role_path }}/templates/nginx.conf.j2", name: "nginx.conf"}
  53. - {src: "{{ role_path }}/templates/labels.j2", name: "labels"}
  54. - name: Ensure Cinny Docker image is built
  55. community.docker.docker_image:
  56. name: "{{ matrix_client_cinny_docker_image }}"
  57. source: build
  58. force_source: "{{ matrix_client_cinny_git_pull_results.changed }}"
  59. build:
  60. dockerfile: Dockerfile
  61. path: "{{ matrix_client_cinny_docker_src_files_path }}"
  62. pull: true
  63. when: "matrix_client_cinny_container_image_self_build | bool"
  64. - name: Ensure Cinny container network is created
  65. community.general.docker_network:
  66. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  67. name: "{{ matrix_client_cinny_container_network }}"
  68. driver: bridge
  69. driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
  70. - name: Ensure matrix-client-cinny.service installed
  71. ansible.builtin.template:
  72. src: "{{ role_path }}/templates/systemd/matrix-client-cinny.service.j2"
  73. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-client-cinny.service"
  74. mode: 0644