feat: add scripts to apply pihole manifests and update authentik launch URLs
This commit is contained in:
26
scripts/apply_pihole_redirect.py
Normal file
26
scripts/apply_pihole_redirect.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import paramiko
|
||||
|
||||
def apply_manifest(host, cluster_name, file_path):
|
||||
print(f"Applying {file_path} to {cluster_name} ({host})...")
|
||||
with open(file_path, 'r') as f:
|
||||
manifest_content = f.read()
|
||||
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect(host, username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
stdin, stdout, stderr = ssh.exec_command('k3s kubectl apply -f -')
|
||||
stdin.write(manifest_content)
|
||||
stdin.channel.shutdown_write()
|
||||
|
||||
out = stdout.read().decode('utf-8')
|
||||
err = stderr.read().decode('utf-8')
|
||||
print("Output:")
|
||||
print(out)
|
||||
if err:
|
||||
print("Stderr:", err)
|
||||
ssh.close()
|
||||
|
||||
apply_manifest('140.44.4.11', 'Aerodrome', r'homelab-gitops-repo/manifests/aerodrome/dns/dns-stack.yaml')
|
||||
apply_manifest('140.44.4.41', 'Spaceport', r'homelab-gitops-repo/manifests/spaceport/dns/dns-stack.yaml')
|
||||
|
||||
@@ -51,3 +51,4 @@ for a in sorted(final_apps.get('results', []), key=lambda x: x['name']):
|
||||
if a['slug'] in ['pihole1', 'pihole2', 'dns1', 'dns2']:
|
||||
print(f" [{a['group']}] {a['name']}")
|
||||
print(f" Slug: {a['slug']} | Launch URL: {a['meta_launch_url']}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user