2023-09-01 15:42:23 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-09-01 15:42:24 -04:00
|
|
|
echo -e "DANGER: This script will PURGE ALL PVC data and configuration from the following host(s):"
|
|
|
|
echo
|
|
|
|
echo -e " $@"
|
|
|
|
echo
|
|
|
|
echo -e "Are you sure you want to continue?"
|
|
|
|
echo
|
|
|
|
echo -en "To abort, press <Ctrl+C> now. To continue, press <Enter>. "
|
|
|
|
read
|
2023-09-01 15:42:25 -04:00
|
|
|
echo
|
2023-09-01 15:42:23 -04:00
|
|
|
|
|
|
|
for host in $@; do
|
2023-09-01 15:42:25 -04:00
|
|
|
echo -n "Purging host ${host}... "
|
2023-09-01 15:42:25 -04:00
|
|
|
ssh deploy@${host} '
|
2023-09-01 15:42:25 -04:00
|
|
|
sudo systemctl stop pvcnoded;
|
2023-09-01 15:42:23 -04:00
|
|
|
sudo systemctl stop ceph-mon@$(hostname -s);
|
2023-09-01 15:42:25 -04:00
|
|
|
sudo systemctl stop ceph-mgr@$(hostname -s);
|
|
|
|
sudo systemctl stop patroni;
|
2023-09-01 15:42:25 -04:00
|
|
|
for key in $( echo "ls /" | sudo /usr/share/zookeeper/bin/zkCli.sh | grep --color=none zookeeper | tr -d "[]," | tr " " "\n" | grep -v zookeeper ); do
|
|
|
|
echo "rmr /${key}" | sudo /usr/share/zookeeper/bin/zkCli.sh;
|
|
|
|
done
|
2023-09-01 15:42:25 -04:00
|
|
|
sudo systemctl stop zookeeper;
|
|
|
|
sudo rm -rf /etc/pvc-install.* /etc/ceph* /etc/patroni* /etc/postgres* /etc/zookeeper* /etc/libvirt*;
|
|
|
|
sudo rm -rf /var/lib/postgresql /var/lib/zookeeper /var/lib/libvirt;
|
2023-09-01 15:42:25 -04:00
|
|
|
suod rm -rf /var/log/postgresql /var/log/zookeeper /var/log/libvirt;
|
2023-09-01 15:42:25 -04:00
|
|
|
sudo rm -rf /run/ceph;
|
2023-09-01 15:42:23 -04:00
|
|
|
sudo rm -rf /etc/systemd/system/ceph-*.target.wants;
|
|
|
|
sudo apt purge -y *ceph* *rbd* *rados*;
|
|
|
|
sudo apt purge -y patroni* postgres* zookeeper* libvirt*
|
|
|
|
sudo apt purge -y ca-certificates-java fontconfig-config libjemalloc2 libpq5 python-psycopg2 python3-eventlet python3-greenlet python3-jinja2 python3-kazoo python3-markupsafe python3-pkg-resources python3-pygments python3-six uuid-runtime
|
|
|
|
sudo apt autoremove --purge -y;
|
|
|
|
sudo apt clean;
|
2023-09-01 15:42:23 -04:00
|
|
|
sudo apt update;
|
2023-09-01 15:42:23 -04:00
|
|
|
sudo userdel ceph;
|
|
|
|
sudo umount /var/lib/ceph;
|
|
|
|
sudo mkfs.ext4 /dev/vgx/ceph;
|
2023-09-01 15:42:25 -04:00
|
|
|
sudo mount /var/lib/ceph;
|
2023-09-01 15:42:25 -04:00
|
|
|
sudo reboot;
|
2023-09-01 15:42:25 -04:00
|
|
|
' &>/dev/null
|
2023-09-01 15:42:25 -04:00
|
|
|
echo "done."
|
2023-09-01 15:42:23 -04:00
|
|
|
done
|