Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

67 wiersze
2.8 KiB

  1. ---
  2. - name: Fail if playbook called incorrectly
  3. fail: msg="The `local_path_media_store` variable needs to be provided to this playbook, via --extra-vars"
  4. when: "local_path_media_store is not defined or local_path_media_store.startswith('<')"
  5. - name: Check if the provided media store directory exists
  6. stat: path="{{ local_path_media_store }}"
  7. delegate_to: 127.0.0.1
  8. become: false
  9. register: local_path_media_store_stat
  10. - name: Fail if provided media store directory doesn't exist on the local machine
  11. fail: msg="{{ local_path_media_store }} cannot be found on the local machine"
  12. when: "not local_path_media_store_stat.stat.exists or not local_path_media_store_stat.stat.isdir"
  13. - name: Check if media store contains local_content
  14. stat: path="{{ local_path_media_store }}/local_content"
  15. delegate_to: 127.0.0.1
  16. become: false
  17. register: local_path_media_store_local_content_stat
  18. - name: Check if media store contains remote_content
  19. stat: path="{{ local_path_media_store }}/remote_content"
  20. delegate_to: 127.0.0.1
  21. become: false
  22. register: local_path_media_store_remote_content_stat
  23. - name: Fail if media store directory doesn't look okay (lacking remote and local content)
  24. fail: msg="{{ local_path_media_store }} contains neither local_content nor remote_content. It's most likely a mistake and is not a media store directory."
  25. when: "not local_path_media_store_local_content_stat.stat.exists and not local_path_media_store_remote_content_stat.stat.exists"
  26. - name: Ensure matrix-synapse is stopped
  27. service: name=matrix-synapse state=stopped daemon_reload=yes
  28. register: stopping_result
  29. - name: Ensure provided media store directory is copied to the server
  30. synchronize:
  31. src: "{{ local_path_media_store }}/"
  32. dest: "{{ matrix_synapse_media_store_path }}"
  33. delete: yes
  34. # It's wasteful to preserve owner/group now. We chown below anyway.
  35. owner: no
  36. group: no
  37. times: "{{ False if matrix_s3_media_store_enabled else True }}"
  38. perms: "{{ False if matrix_s3_media_store_enabled else True }}"
  39. # This is for the generic case and fails in other cases (remote file systems),
  40. # because in such cases the base path (matrix_synapse_media_store_path) is a mount point.
  41. - name: Ensure media store permissions are correct (generic case)
  42. file:
  43. path: "{{ matrix_synapse_media_store_path }}"
  44. owner: "{{ matrix_user_username }}"
  45. group: "{{ matrix_user_username }}"
  46. recurse: yes
  47. when: "not matrix_s3_media_store_enabled"
  48. # We don't chown for Goofys, because due to the way it's mounted,
  49. # all files become owned by whoever needs to own them.
  50. - name: Ensure Matrix Synapse is started (if it previously was)
  51. service: name="{{ item }}" state=started daemon_reload=yes
  52. when: stopping_result.changed
  53. with_items:
  54. - matrix-synapse
  55. - matrix-nginx-proxy