Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

76 lines
2.4 KiB

  1. #
  2. # Tasks related to setting up Goofys
  3. #
  4. - name: Ensure Goofys Docker image is pulled
  5. docker_image:
  6. name: "{{ matrix_s3_goofys_docker_image }}"
  7. when: matrix_s3_media_store_enabled
  8. # This will throw a Permission Denied error if already mounted
  9. - name: Check Matrix Goofys external storage mountpoint path
  10. stat:
  11. path: "{{ matrix_synapse_media_store_path }}"
  12. register: local_path_matrix_synapse_media_store_path_stat
  13. ignore_errors: yes
  14. when: matrix_s3_media_store_enabled
  15. - name: Ensure Matrix Goofys external storage mountpoint exists
  16. file:
  17. path: "{{ matrix_synapse_media_store_path }}"
  18. state: directory
  19. mode: 0750
  20. owner: "{{ matrix_user_uid }}"
  21. group: "{{ matrix_user_gid }}"
  22. when: "matrix_s3_media_store_enabled and not local_path_matrix_synapse_media_store_path_stat.failed and not local_path_matrix_synapse_media_store_path_stat.stat.exists"
  23. - name: Ensure goofys environment variables file created
  24. template:
  25. src: "{{ role_path }}/templates/goofys/env-goofys.j2"
  26. dest: "{{ matrix_synapse_config_dir_path }}/env-goofys"
  27. owner: root
  28. mode: 0600
  29. when: matrix_s3_media_store_enabled
  30. - name: Ensure matrix-goofys.service installed
  31. template:
  32. src: "{{ role_path }}/templates/goofys/systemd/matrix-goofys.service.j2"
  33. dest: "/etc/systemd/system/matrix-goofys.service"
  34. mode: 0644
  35. when: matrix_s3_media_store_enabled
  36. #
  37. # Tasks related to getting rid of goofys (if it was previously enabled)
  38. #
  39. - name: Check existence of matrix-goofys service
  40. stat:
  41. path: "/etc/systemd/system/matrix-goofys.service"
  42. register: matrix_goofys_service_stat
  43. - name: Ensure matrix-goofys is stopped
  44. service:
  45. name: matrix-goofys
  46. state: stopped
  47. daemon_reload: yes
  48. register: stopping_result
  49. when: "not matrix_s3_media_store_enabled and matrix_goofys_service_stat.stat.exists"
  50. - name: Ensure matrix-goofys.service doesn't exist
  51. file:
  52. path: "/etc/systemd/system/matrix-goofys.service"
  53. state: absent
  54. when: "not matrix_s3_media_store_enabled and matrix_goofys_service_stat.stat.exists"
  55. - name: Ensure goofys environment variables file doesn't exist
  56. file:
  57. path: "{{ matrix_synapse_config_dir_path }}/env-goofys"
  58. state: absent
  59. when: "not matrix_s3_media_store_enabled"
  60. - name: Ensure Goofys Docker image doesn't exist
  61. docker_image:
  62. name: "{{ matrix_s3_goofys_docker_image }}"
  63. state: absent
  64. when: "not matrix_s3_media_store_enabled"