Skip to content

Instantly share code, notes, and snippets.

@bachmanity1
bachmanity1 / ceph-cleanup.sh
Created March 10, 2026 08:55
Run ceph-v2-manage.sh cleanup for each host
#!/bin/bash
set -euo pipefail
for h in "$@"; do
echo "=== Cleanup: ${h}.n3r ==="
./ceph-v2-manage.sh cleanup -l "${h}.n3r" -p ceph-v2 --skip-check -v
done
@bachmanity1
bachmanity1 / ceph-host-check.sh
Created March 10, 2026 07:19
Check if Ceph hosts are fully removed (daemons, host list, crush map)
#!/bin/bash
set -euo pipefail
HOST_FILE=""
HOSTS=()
usage() {
echo "Usage: $0 [--file <hosts-file>] [hostname ...]"
echo ""
echo "Verifies that hosts are fully removed: no daemons, not in host list, not in crush map."
@bachmanity1
bachmanity1 / ceph-host-drain-dryrun.sh
Created March 10, 2026 07:11
Ceph host drain dry run: crush weight check only
#!/bin/bash
set -euo pipefail
POLL_INTERVAL=10
TIMEOUT=1800 # 30 minutes
HOST_FILE=""
HOSTS=()
MODE="drain" # drain or check
usage() {
@bachmanity1
bachmanity1 / ceph-host-drain-dryrun.sh
Last active March 10, 2026 07:10
Dry run: check CRUSH weight only
#!/bin/bash
set -euo pipefail
POLL_INTERVAL=10
TIMEOUT=1800 # 30 minutes
HOST_FILE=""
HOSTS=()
MODE="drain" # drain or check
usage() {
@bachmanity1
bachmanity1 / ceph-host-drain.sh
Last active March 10, 2026 08:29
Ceph host drain, remove, and cleanup script
#!/bin/bash
set -euo pipefail
POLL_INTERVAL=10
TIMEOUT=1800 # 30 minutes
HOST_FILE=""
HOSTS=()
MODE="drain" # drain or check
usage() {
@bachmanity1
bachmanity1 / check-crush-weight.sh
Created March 10, 2026 06:43
Check if Ceph CRUSH weight is zero for hosts
#!/bin/bash
set -euo pipefail
HOST_FILE=""
HOSTS=()
usage() {
echo "Usage: $0 [--file <hosts-file>] [hostname ...]"
echo ""
echo "Checks if CRUSH weight is zero for each specified host."
@bachmanity1
bachmanity1 / check-crush-weight.sh
Last active March 10, 2026 06:31
Check if Ceph CRUSH weight is zero for hosts
#!/bin/bash
set -euo pipefail
HOST_FILE=""
HOSTS=()
usage() {
echo "Usage: $0 [--file <hosts-file>] [hostname ...]"
echo ""
echo "Checks if CRUSH weight is zero for each specified host."
@bachmanity1
bachmanity1 / install-k8s-1.32.sh
Last active February 24, 2026 06:29
Install Kubernetes v1.32 worker node
#!/bin/bash
set -e
MASTER=false
for arg in "$@"; do
if [[ "$arg" == "--master" ]]; then
MASTER=true
break
fi
done
@bachmanity1
bachmanity1 / uninstall-k8s.sh
Created February 24, 2026 05:51
Uninstall Kubernetes from node
#!/bin/bash
set -e
echo "[1/6] Resetting kubeadm"
kubeadm reset -f || true
echo "[2/6] Stopping services"
systemctl stop kubelet || true
systemctl disable kubelet || true
systemctl stop containerd || true