Files
SnarfCode/scripts/delete_nowait.py

25 lines
932 B
Python

import paramiko
import sys
sys.stdout.reconfigure(encoding='utf-8')
key_path = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet"
print("--- Aerodrome ---")
c1 = paramiko.SSHClient()
c1.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c1.connect("140.44.4.11", username="root", key_filename=key_path, timeout=5)
stdin, stdout, stderr = c1.exec_command("k3s kubectl -n infra delete svc technitium-npm-vip-service --wait=false")
print(stdout.read().decode('utf-8'))
c1.close()
print("--- Spaceport ---")
c2 = paramiko.SSHClient()
c2.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c2.connect("140.44.4.41", username="root", key_filename=key_path, timeout=5)
cmd = "k3s kubectl -n infrastructure delete deploy pihole technitium-dns svc pihole-dns-tcp pihole-dns-udp pihole-web technitium-service --wait=false --ignore-not-found=true"
stdin, stdout, stderr = c2.exec_command(cmd)
print(stdout.read().decode('utf-8'))
c2.close()