20 lines
536 B
Python
20 lines
536 B
Python
import paramiko
|
|
|
|
ssh = paramiko.SSHClient()
|
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
ssh.connect('140.44.4.41', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
|
|
|
def run(cmd):
|
|
print(f"=== {cmd} ===")
|
|
_, out, err = ssh.exec_command(cmd)
|
|
res = out.read().decode().strip()
|
|
errors = err.read().decode().strip()
|
|
if res:
|
|
print(res)
|
|
if errors:
|
|
print("ERR:", errors)
|
|
|
|
run("kubectl logs deployment/semaphore -n infrastructure --tail=40")
|
|
ssh.close()
|
|
|