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

75 строки
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 Email2Matrix 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_email2matrix_base_path }}", when: true}
  14. - {path: "{{ matrix_email2matrix_config_dir_path }}", when: true}
  15. - {path: "{{ matrix_email2matrix_docker_src_files_path }}", when: "{{ matrix_email2matrix_container_image_self_build }}"}
  16. when: "item.when | bool"
  17. - name: Ensure Email2Matrix configuration file created
  18. ansible.builtin.template:
  19. src: "{{ role_path }}/templates/config.json.j2"
  20. dest: "{{ matrix_email2matrix_config_dir_path }}/config.json"
  21. owner: "{{ matrix_user_username }}"
  22. group: "{{ matrix_user_groupname }}"
  23. mode: 0640
  24. - name: Ensure Email2Matrix image is pulled
  25. community.docker.docker_image:
  26. name: "{{ matrix_email2matrix_docker_image }}"
  27. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  28. force_source: "{{ matrix_email2matrix_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  29. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_email2matrix_docker_image_force_pull }}"
  30. when: "not matrix_email2matrix_container_image_self_build | bool"
  31. register: result
  32. retries: "{{ devture_playbook_help_container_retries_count }}"
  33. delay: "{{ devture_playbook_help_container_retries_delay }}"
  34. until: result is not failed
  35. - name: Ensure Email2Matrix repository is present on self-build
  36. ansible.builtin.git:
  37. repo: "{{ matrix_email2matrix_container_image_self_build_repo }}"
  38. dest: "{{ matrix_email2matrix_docker_src_files_path }}"
  39. version: "{{ matrix_email2matrix_container_image_self_build_branch }}"
  40. force: "yes"
  41. become: true
  42. become_user: "{{ matrix_user_username }}"
  43. register: matrix_email2matrix_git_pull_results
  44. when: "matrix_email2matrix_container_image_self_build | bool"
  45. - name: Ensure Email2Matrix Docker image is built
  46. community.docker.docker_image:
  47. name: "{{ matrix_email2matrix_docker_image }}"
  48. source: build
  49. force_source: "{{ matrix_email2matrix_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  50. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_email2matrix_git_pull_results.changed }}"
  51. build:
  52. dockerfile: etc/docker/Dockerfile
  53. path: "{{ matrix_email2matrix_docker_src_files_path }}"
  54. pull: true
  55. when: "matrix_email2matrix_container_image_self_build | bool"
  56. - name: Ensure matrix-email2matrix container network is created
  57. community.general.docker_network:
  58. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  59. name: "{{ matrix_email2matrix_container_network }}"
  60. driver: bridge
  61. driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
  62. - name: Ensure matrix-email2matrix.service installed
  63. ansible.builtin.template:
  64. src: "{{ role_path }}/templates/systemd/matrix-email2matrix.service.j2"
  65. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-email2matrix.service"
  66. mode: 0644