Matrix Docker Ansible eploy
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

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