feat(infra): Phase 3 & 4 completion, deploy AWX playbooks & Zabbix monitoring
This commit is contained in:
38
scripts/inspect_awx_orm.py
Normal file
38
scripts/inspect_awx_orm.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import paramiko
|
||||
|
||||
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)
|
||||
|
||||
py_script = """
|
||||
from awx.main.models import Organization, Inventory, Group, Host, Credential, Project, JobTemplate
|
||||
print("=== ORGANIZATIONS ===")
|
||||
for o in Organization.objects.all():
|
||||
print(f" [{o.id}] {o.name}")
|
||||
|
||||
print("\\n=== INVENTORIES ===")
|
||||
for i in Inventory.objects.all():
|
||||
print(f" [{i.id}] {i.name} (Hosts: {i.hosts.count()})")
|
||||
|
||||
print("\\n=== CREDENTIALS ===")
|
||||
for c in Credential.objects.all():
|
||||
print(f" [{c.id}] {c.name} (Type: {c.credential_type.name})")
|
||||
|
||||
print("\\n=== PROJECTS ===")
|
||||
for p in Project.objects.all():
|
||||
print(f" [{p.id}] {p.name} (SCM: {p.scm_type}, URL: {p.scm_url}, Status: {p.status})")
|
||||
|
||||
print("\\n=== JOB TEMPLATES ===")
|
||||
for t in JobTemplate.objects.all():
|
||||
print(f" [{t.id}] {t.name}")
|
||||
"""
|
||||
|
||||
import base64
|
||||
b64 = base64.b64encode(py_script.encode()).decode()
|
||||
|
||||
cmd = f"kubectl exec -i -n awx -c awx-task deployment/awx-task -- awx-manage shell_plus --quiet << 'EOF'\n{py_script}\nEOF"
|
||||
stdin, stdout, stderr = ssh.exec_command(cmd)
|
||||
print(stdout.read().decode())
|
||||
print(stderr.read().decode())
|
||||
|
||||
ssh.close()
|
||||
Reference in New Issue
Block a user