Matrix Docker Ansible eploy
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 

49 rader
1.8 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. #!/bin/bash
  3. if [ "$(id -u)" != "0" ]; then
  4. echo "This script must be executed as root! Aborting."
  5. exit 1
  6. fi
  7. echo "WARNING! You are about to remove everything the playbook installs for {{ matrix_server_fqn_matrix }}: matrix, docker images,..."
  8. echo -n "If you're sure you want to do this, type: 'Yes, I really want to remove everything!'"
  9. read sure
  10. if [ "$sure" != "Yes, I really want to remove everything!" ]; then
  11. echo "Good thing I asked, exiting"
  12. exit 0
  13. else
  14. echo "Stop and remove matrix services"
  15. # Look for and stop services, avoiding things like
  16. # 'matrix-synapse-worker@.service' (just a template for instantiated services; can't stop it directly).
  17. # We use '-xtype f' and not '-type f', because we wish to match symlinks like this:
  18. # '/etc/systemd/system/matrix-synapse.service.wants/matrix-synapse-worker@generic_worker:18111.service'
  19. # and stop these instantiated services as well.
  20. for s in $(find {{ matrix_systemd_path }}/ -xtype f -name "matrix-*" -printf "%f\n" | grep -v '@.service' | uniq); do
  21. systemctl stop $s
  22. done
  23. # Get rid of regular service files, as well as symlinks like
  24. # '/etc/systemd/system/matrix-synapse.service.wants/matrix-synapse-worker@generic_worker:18111.service'
  25. # and even
  26. # '/etc/systemd/system/multi-user.target.wants/matrix-synapse.service'.
  27. for s in $(find {{ matrix_systemd_path }}/ -xtype f -name "matrix-*" -printf "%p\n"); do
  28. rm -f {{ matrix_systemd_path }}/$s
  29. done
  30. systemctl daemon-reload
  31. echo "Remove matrix scripts"
  32. find {{ matrix_local_bin_path }}/ -name "matrix-*" -delete
  33. echo "Remove unused Docker images and resources"
  34. docker system prune -af
  35. echo "Remove Docker matrix network (should be gone already, but ..)"
  36. docker network rm {{ matrix_docker_network }}
  37. echo "Remove {{ matrix_base_data_path }} directory"
  38. rm -fr "{{ matrix_base_data_path }}"
  39. exit 0
  40. fi