import paramiko, time, sys ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect('140.44.4.11', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10) print("Monitoring sninfr2lnxwrk01 (140.44.4.21) first-boot progress...") for attempt in range(1, 25): # 1. Ping stdin, stdout, stderr = ssh.exec_command('ping -c 1 -W 1 140.44.4.21 > /dev/null 2>&1 && echo ONLINE || echo OFFLINE') ping_status = stdout.read().decode().strip() # 2. Port 22 stdin, stdout, stderr = ssh.exec_command('nc -z -w 1 140.44.4.21 22 > /dev/null 2>&1 && echo OPEN || echo CLOSED') ssh_port = stdout.read().decode().strip() # 3. K3s node stdin, stdout, stderr = ssh.exec_command('kubectl get node sninfr2lnxwrk01 -o jsonpath="{.status.conditions[-1].type}={.status.conditions[-1].status}" 2>/dev/null || echo "NOT_REGISTERED"') k3s_status = stdout.read().decode().strip() print(f"[{attempt * 10}s] Ping: {ping_status} | SSH Port: {ssh_port} | K3s Status: {k3s_status}") if k3s_status == "Ready=True": print("\nSUCCESS! sninfr2lnxwrk01 is Ready in Kubernetes!") stdin, stdout, stderr = ssh.exec_command('kubectl get node sninfr2lnxwrk01 -o wide') print(stdout.read().decode()) break time.sleep(10) ssh.close()