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.
 
 

97 Zeilen
3.2 KiB

  1. ---
  2. #
  3. # Tasks related to setting up riot-web
  4. #
  5. - name: Ensure Matrix riot-web path exists
  6. file:
  7. path: "{{ matrix_riot_web_data_path }}"
  8. state: directory
  9. mode: 0750
  10. owner: "{{ matrix_user_username }}"
  11. group: "{{ matrix_user_username }}"
  12. when: matrix_riot_web_enabled|bool
  13. - name: Ensure riot-web Docker image is pulled
  14. docker_image:
  15. name: "{{ matrix_riot_web_docker_image }}"
  16. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  17. when: matrix_riot_web_enabled|bool
  18. - name: Ensure Matrix riot-web config files installed
  19. template:
  20. src: "{{ item.src }}"
  21. dest: "{{ matrix_riot_web_data_path }}/{{ item.name }}"
  22. mode: 0644
  23. owner: "{{ matrix_user_username }}"
  24. group: "{{ matrix_user_username }}"
  25. with_items:
  26. - {src: "{{ role_path }}/templates/config.json.j2", name: "config.json"}
  27. - {src: "{{ role_path }}/templates/nginx.conf.j2", name: "nginx.conf"}
  28. - {src: "{{ role_path }}/templates/welcome.html.j2", name: "welcome.html"}
  29. - {src: "{{ matrix_riot_web_embedded_pages_home_path }}", name: "home.html"}
  30. when: "matrix_riot_web_enabled|bool and item.src is not none"
  31. - name: Ensure Matrix riot-web config files removed
  32. file:
  33. path: "{{ matrix_riot_web_data_path }}/{{ item.name }}"
  34. state: absent
  35. with_items:
  36. - {src: "{{ matrix_riot_web_embedded_pages_home_path }}", name: "home.html"}
  37. when: "matrix_riot_web_enabled|bool and item.src is none"
  38. - name: Ensure matrix-riot-web.service installed
  39. template:
  40. src: "{{ role_path }}/templates/systemd/matrix-riot-web.service.j2"
  41. dest: "/etc/systemd/system/matrix-riot-web.service"
  42. mode: 0644
  43. register: matrix_riot_web_systemd_service_result
  44. when: matrix_riot_web_enabled|bool
  45. - name: Ensure systemd reloaded after matrix-riot-web.service installation
  46. service:
  47. daemon_reload: yes
  48. when: "matrix_riot_web_enabled and matrix_riot_web_systemd_service_result.changed"
  49. #
  50. # Tasks related to getting rid of riot-web (if it was previously enabled)
  51. #
  52. - name: Check existence of matrix-riot-web service
  53. stat:
  54. path: "/etc/systemd/system/matrix-riot-web.service"
  55. register: matrix_riot_web_service_stat
  56. when: "not matrix_riot_web_enabled|bool"
  57. - name: Ensure matrix-riot-web is stopped
  58. service:
  59. name: matrix-riot-web
  60. state: stopped
  61. daemon_reload: yes
  62. register: stopping_result
  63. when: "not matrix_riot_web_enabled|bool and matrix_riot_web_service_stat.stat.exists"
  64. - name: Ensure matrix-riot-web.service doesn't exist
  65. file:
  66. path: "/etc/systemd/system/matrix-riot-web.service"
  67. state: absent
  68. when: "not matrix_riot_web_enabled|bool and matrix_riot_web_service_stat.stat.exists"
  69. - name: Ensure systemd reloaded after matrix-riot-web.service removal
  70. service:
  71. daemon_reload: yes
  72. when: "not matrix_riot_web_enabled|bool and matrix_riot_web_service_stat.stat.exists"
  73. - name: Ensure Matrix riot-web paths doesn't exist
  74. file:
  75. path: "{{ matrix_riot_web_data_path }}"
  76. state: absent
  77. when: "not matrix_riot_web_enabled|bool"
  78. - name: Ensure riot-web Docker image doesn't exist
  79. docker_image:
  80. name: "{{ matrix_riot_web_docker_image }}"
  81. state: absent
  82. when: "not matrix_riot_web_enabled|bool"