Update purge script

This commit is contained in:
Joshua Boniface 2021-01-27 17:05:20 -05:00
parent b7f251ea16
commit 20d802f0b0
1 changed files with 11 additions and 5 deletions

View File

@ -8,10 +8,19 @@ echo -e "Are you sure you want to continue?"
echo echo
echo -en "To abort, press <Ctrl+C> now. To continue, press <Enter>. " echo -en "To abort, press <Ctrl+C> now. To continue, press <Enter>. "
read read
echo
for host in $@; do for host in $@; do
echo -n "Purging host ${host}... "
ssh deploy@${host} " ssh deploy@${host} "
sudo systemctl stop pvcnoded;
sudo systemctl stop ceph-mon@$(hostname -s); sudo systemctl stop ceph-mon@$(hostname -s);
sudo systemctl stop ceph-mgr@$(hostname -s);
sudo systemctl stop patroni;
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;
sudo rm -rf /run/ceph;
sudo rm -rf /etc/systemd/system/ceph-*.target.wants; sudo rm -rf /etc/systemd/system/ceph-*.target.wants;
sudo apt purge -y *ceph* *rbd* *rados*; sudo apt purge -y *ceph* *rbd* *rados*;
sudo apt purge -y patroni* postgres* zookeeper* libvirt* sudo apt purge -y patroni* postgres* zookeeper* libvirt*
@ -19,12 +28,9 @@ for host in $@; do
sudo apt autoremove --purge -y; sudo apt autoremove --purge -y;
sudo apt clean; sudo apt clean;
sudo apt update; sudo apt update;
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;
sudo rm -rf /run/ceph;
sudo userdel ceph; sudo userdel ceph;
sudo umount /var/lib/ceph; sudo umount /var/lib/ceph;
sudo mkfs.ext4 /dev/vgx/ceph; sudo mkfs.ext4 /dev/vgx/ceph;
sudo mount /var/lib/ceph" & sudo mount /var/lib/ceph" &>/dev/null
echo "done."
done done
wait