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.
 
 

49 lines
2.0 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="File cannot be found on the local machine at {{ local_path_media_store }}"
  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 Matrix Synapse is started (if it previously was)
  35. service: name="{{ item }}" state=started daemon_reload=yes
  36. when: stopping_result.changed
  37. with_items:
  38. - matrix-synapse
  39. - matrix-nginx-proxy