Matrix Docker Ansible eploy
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

79 řádky
3.5 KiB

  1. # SPDX-FileCopyrightText: 2021 - 2024 Slavi Pantaleev
  2. # SPDX-FileCopyrightText: 2022 Nikita Chernyi
  3. # SPDX-FileCopyrightText: 2022 Marko Weltzer
  4. # SPDX-FileCopyrightText: 2022 Sebastian Gumprich
  5. # SPDX-FileCopyrightText: 2024 David Mehren
  6. #
  7. # SPDX-License-Identifier: AGPL-3.0-or-later
  8. ---
  9. - name: Ensure Email2Matrix paths exist
  10. ansible.builtin.file:
  11. path: "{{ item.path }}"
  12. state: directory
  13. mode: 0750
  14. owner: "{{ matrix_user_username }}"
  15. group: "{{ matrix_user_groupname }}"
  16. with_items:
  17. - {path: "{{ matrix_email2matrix_base_path }}", when: true}
  18. - {path: "{{ matrix_email2matrix_config_dir_path }}", when: true}
  19. - {path: "{{ matrix_email2matrix_docker_src_files_path }}", when: "{{ matrix_email2matrix_container_image_self_build }}"}
  20. when: "item.when | bool"
  21. - name: Ensure Email2Matrix configuration file created
  22. ansible.builtin.template:
  23. src: "{{ role_path }}/templates/config.json.j2"
  24. dest: "{{ matrix_email2matrix_config_dir_path }}/config.json"
  25. owner: "{{ matrix_user_username }}"
  26. group: "{{ matrix_user_groupname }}"
  27. mode: 0640
  28. - name: Ensure Email2Matrix image is pulled
  29. community.docker.docker_image:
  30. name: "{{ matrix_email2matrix_docker_image }}"
  31. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  32. force_source: "{{ matrix_email2matrix_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_email2matrix_docker_image_force_pull }}"
  34. when: "not matrix_email2matrix_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 Email2Matrix repository is present on self-build
  40. ansible.builtin.git:
  41. repo: "{{ matrix_email2matrix_container_image_self_build_repo }}"
  42. dest: "{{ matrix_email2matrix_docker_src_files_path }}"
  43. version: "{{ matrix_email2matrix_container_image_self_build_branch }}"
  44. force: "yes"
  45. become: true
  46. become_user: "{{ matrix_user_username }}"
  47. register: matrix_email2matrix_git_pull_results
  48. when: "matrix_email2matrix_container_image_self_build | bool"
  49. - name: Ensure Email2Matrix Docker image is built
  50. community.docker.docker_image:
  51. name: "{{ matrix_email2matrix_docker_image }}"
  52. source: build
  53. force_source: "{{ matrix_email2matrix_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_email2matrix_git_pull_results.changed }}"
  55. build:
  56. dockerfile: etc/docker/Dockerfile
  57. path: "{{ matrix_email2matrix_docker_src_files_path }}"
  58. pull: true
  59. when: "matrix_email2matrix_container_image_self_build | bool"
  60. - name: Ensure matrix-email2matrix container network is created
  61. community.general.docker_network:
  62. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  63. name: "{{ matrix_email2matrix_container_network }}"
  64. driver: bridge
  65. driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
  66. - name: Ensure matrix-email2matrix.service installed
  67. ansible.builtin.template:
  68. src: "{{ role_path }}/templates/systemd/matrix-email2matrix.service.j2"
  69. dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-email2matrix.service"
  70. mode: 0644