feat: add various infrastructure check and automation scripts

This commit is contained in:
2026-11-15 17:17:41 -05:00
parent 336b7759d0
commit b301aa3ece
232 changed files with 8274 additions and 298 deletions

View File

@@ -0,0 +1,29 @@
import paramiko
import json
SSH_KEY = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet"
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("140.44.4.90", username="rancher", key_filename=SSH_KEY, timeout=10)
def k8s(cmd):
full_cmd = f"echo Katzir476! | sudo -S sh -c 'export KUBECONFIG=/etc/rancher/rke2/rke2.yaml; PATH=$PATH:/var/lib/rancher/rke2/bin; {cmd}'"
_, o, e = c.exec_command(full_cmd)
return o.read().decode().strip(), e.read().decode().strip()
out, _ = k8s("kubectl get nodes.longhorn.io -n longhorn-system -o json")
data = json.loads(out)
node_disk_uuids = {}
for node in data.get("items", []):
nname = node["metadata"]["name"]
node_disk_uuids[nname] = {}
for dname, dstat in node.get("status", {}).get("diskStatus", {}).items():
node_disk_uuids[nname][dname] = {
"path": node.get("spec", {}).get("disks", {}).get(dname, {}).get("path"),
"diskUUID": dstat.get("diskUUID")
}
print(json.dumps(node_disk_uuids, indent=2))
c.close()