ungleich-tools/ceph/ceph-osd-stop-remove-permanently
Nico Schottelius 88f824dc3b [ceph] also delete the authentication token when deleting osd
This helps better use of ceph-volume
2021-04-18 15:47:54 +02:00

37 lines
635 B
Bash
Executable file

#!/bin/sh
# 17:19, 2018-02-09
# Nico Schottelius
set -x
set -e
if [ $# -ne 1 ]; then
echo "$0 osd.id"
echo "i.e. $0 17"
exit 1
fi
osd_id=$1; shift
osd_name=osd.${osd_id}
mountpath=/var/lib/ceph/osd/ceph-${osd_id}
# Remove monit job
if [ -e /etc/monit ]; then
monit stop $osd_name
/opt/ungleich-tools/monit-remove $osd_name
else
/etc/init.d/ceph stop $osd_name
fi
ceph osd crush remove $osd_name
ceph osd rm $osd_name
ceph auth del $osd_name
echo "Mount path before umounting: "
mount | grep "$mountpath"
# Sleep 5 to wait for monit to kill it
sleep 5
umount "$mountpath"
echo 'TODO: remove from fstab!'