Matrix Docker Ansible eploy
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

56 行
2.2 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. - name: Ensure media store permissions are correct
  35. file:
  36. path: "{{ matrix_synapse_media_store_path }}"
  37. owner: "{{ matrix_user_username }}"
  38. group: "{{ matrix_user_username }}"
  39. recurse: yes
  40. - name: Ensure Matrix Synapse is started (if it previously was)
  41. service: name="{{ item }}" state=started daemon_reload=yes
  42. when: stopping_result.changed
  43. with_items:
  44. - matrix-synapse
  45. - matrix-nginx-proxy