Matrix Docker Ansible eploy
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

64 Zeilen
2.7 KiB

  1. ---
  2. - name: Ensure Email2Matrix paths exist
  3. file:
  4. path: "{{ item.path }}"
  5. state: directory
  6. mode: 0750
  7. owner: "{{ matrix_user_username }}"
  8. group: "{{ matrix_user_groupname }}"
  9. with_items:
  10. - { path: "{{ matrix_email2matrix_base_path }}", when: true }
  11. - { path: "{{ matrix_email2matrix_config_dir_path }}", when: true }
  12. - { path: "{{ matrix_email2matrix_docker_src_files_path }}", when: "{{ matrix_email2matrix_container_image_self_build }}"}
  13. when: "item.when|bool"
  14. - name: Ensure Email2Matrix configuration file created
  15. template:
  16. src: "{{ role_path }}/templates/config.json.j2"
  17. dest: "{{ matrix_email2matrix_config_dir_path }}/config.json"
  18. owner: "{{ matrix_user_username }}"
  19. group: "{{ matrix_user_groupname }}"
  20. mode: 0640
  21. - name: Ensure Email2Matrix image is pulled
  22. docker_image:
  23. name: "{{ matrix_email2matrix_docker_image }}"
  24. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  25. force_source: "{{ matrix_email2matrix_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  26. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_email2matrix_docker_image_force_pull }}"
  27. when: "not matrix_email2matrix_container_image_self_build|bool"
  28. - name: Ensure Email2Matrix repository is present on self-build
  29. git:
  30. repo: "{{ matrix_email2matrix_container_image_self_build_repo }}"
  31. dest: "{{ matrix_email2matrix_docker_src_files_path }}"
  32. version: "{{ matrix_email2matrix_container_image_self_build_branch }}"
  33. force: "yes"
  34. register: matrix_email2matrix_git_pull_results
  35. when: "matrix_email2matrix_container_image_self_build|bool"
  36. - name: Ensure Email2Matrix Docker image is built
  37. docker_image:
  38. name: "{{ matrix_email2matrix_docker_image }}"
  39. source: build
  40. force_source: "{{ matrix_email2matrix_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  41. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_email2matrix_git_pull_results.changed }}"
  42. build:
  43. dockerfile: etc/docker/Dockerfile
  44. path: "{{ matrix_email2matrix_docker_src_files_path }}"
  45. pull: yes
  46. when: "matrix_email2matrix_container_image_self_build|bool"
  47. - name: Ensure matrix-email2matrix.service installed
  48. template:
  49. src: "{{ role_path }}/templates/systemd/matrix-email2matrix.service.j2"
  50. dest: "{{ matrix_systemd_path }}/matrix-email2matrix.service"
  51. mode: 0644
  52. register: matrix_email2matrix_systemd_service_result
  53. - name: Ensure systemd reloaded after matrix-email2matrix.service installation
  54. service:
  55. daemon_reload: yes
  56. when: "matrix_email2matrix_systemd_service_result.changed|bool"