29 lines
1.3 KiB
Python
29 lines
1.3 KiB
Python
import paramiko
|
|
|
|
ssh_sp = paramiko.SSHClient()
|
|
ssh_sp.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
ssh_sp.connect('140.44.4.41', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
|
|
|
ssh_ae = paramiko.SSHClient()
|
|
ssh_ae.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
ssh_ae.connect('140.44.4.11', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
|
|
|
def run(ssh, name, cmd):
|
|
print(f"\n--- {name}: {cmd} ---")
|
|
_, out, err = ssh.exec_command(cmd)
|
|
res = out.read().decode().strip()
|
|
if res:
|
|
print(res)
|
|
|
|
run(ssh_sp, "SPACEPORT", "helm list -A")
|
|
run(ssh_sp, "SPACEPORT", "kubectl get deploy -n monitoring -o jsonpath='{range .items[*]}{.metadata.name}{\"\\t\"}{range .spec.template.spec.containers[*]}{.image}{\" \"}{end}{\"\\n\"}'")
|
|
|
|
run(ssh_ae, "AERODROME", "helm list -A")
|
|
run(ssh_ae, "AERODROME", "kubectl get deploy -n infra -o jsonpath='{range .items[*]}{.metadata.name}{\"\\t\"}{range .spec.template.spec.containers[*]}{.image}{\" \"}{end}{\"\\n\"}'")
|
|
run(ssh_ae, "AERODROME", "kubectl get deploy -n awx -o jsonpath='{range .items[*]}{.metadata.name}{\"\\t\"}{range .spec.template.spec.containers[*]}{.image}{\" \"}{end}{\"\\n\"}'")
|
|
run(ssh_ae, "AERODROME", "kubectl get awx -n awx -o yaml | grep -E 'image|version'")
|
|
|
|
ssh_sp.close()
|
|
ssh_ae.close()
|
|
|