157 lines
5.0 KiB
Python
157 lines
5.0 KiB
Python
import os
|
|
|
|
new_configmap_data = """apiVersion: v1
|
|
data:
|
|
bookmarks.yaml: |
|
|
- Developer:
|
|
- Github:
|
|
- abbr: GH
|
|
href: https://github.com/
|
|
docker.yaml: ''
|
|
kubernetes.yaml: |
|
|
mode: disable
|
|
services.yaml: |
|
|
- Critical Services:
|
|
- Authentik:
|
|
icon: authentik.png
|
|
href: https://authentik.snarfnet.net
|
|
description: SSO & Identity Management
|
|
- PeaNUT UPS:
|
|
icon: peanut.png
|
|
href: https://portal.snarfnet.net
|
|
description: UPS Power & Battery Monitor
|
|
- Unifi Controller:
|
|
icon: unifi.png
|
|
href: https://unifi.ui.com
|
|
widget:
|
|
type: unifi
|
|
url: https://140.44.44.1
|
|
username: Snarf
|
|
password: Katzir476!!!
|
|
|
|
- GitOps & Automation:
|
|
- Gitea:
|
|
icon: gitea.png
|
|
href: https://git.snarfnet.net
|
|
description: Git Repositories
|
|
- ArgoCD:
|
|
icon: argocd.png
|
|
href: https://argo.snarfnet.net
|
|
description: Declarative GitOps Reconciler
|
|
- AWX Automation:
|
|
icon: awx.png
|
|
href: https://awx.snarfnet.net
|
|
description: Ansible Automation Controller
|
|
- Semaphore:
|
|
icon: semaphore.png
|
|
href: https://semaphore.snarfnet.net
|
|
description: Playbook Execution Engine
|
|
|
|
- Storage & Clusters:
|
|
- Longhorn Aerodrome:
|
|
icon: longhorn.png
|
|
href: https://longhorn.aerodrome.snarfnet.net
|
|
description: Aerodrome Distributed Flash Storage
|
|
- Longhorn Spaceport:
|
|
icon: longhorn.png
|
|
href: https://longhorn.spaceport.snarfnet.net
|
|
description: Spaceport Distributed Block Storage
|
|
- Rancher (Aerodrome):
|
|
icon: rancher.png
|
|
href: https://aerodrome.snarfnet.net
|
|
description: Kubernetes Management Console
|
|
- Harvester HCI (Spacedock):
|
|
icon: harvester.png
|
|
href: https://harvester.spacedock.snarfnet.net
|
|
description: HCI Virtualization Hypervisors
|
|
- Portainer Swarm:
|
|
icon: portainer.png
|
|
href: https://shipyard.snarfnet.net
|
|
description: Docker Swarm Container Fleet
|
|
|
|
- Infrastructure & Observability:
|
|
- NGINX Proxy Manager:
|
|
icon: nginx-proxy-manager
|
|
href: https://nginx.snarfnet.net
|
|
description: Reverse Proxy & SSL Certificates
|
|
- Uptime Kuma:
|
|
icon: uptime-kuma
|
|
href: https://uptime.snarfnet.net
|
|
description: Multi-Endpoint Availability Probes
|
|
- Zabbix:
|
|
icon: zabbix.png
|
|
href: https://zabbix.snarfnet.net
|
|
description: Infrastructure Metrics & Alarms
|
|
- Grafana:
|
|
icon: grafana.png
|
|
href: https://grafana.snarfnet.net
|
|
description: Real-Time Metrics & AI Dashboards
|
|
- Core Node Glances:
|
|
icon: glances.png
|
|
href: http://140.44.4.11:61208
|
|
description: Host Resource Monitor
|
|
|
|
- Environment & Weather:
|
|
- Tempest Weather Station:
|
|
icon: weather.png
|
|
href: https://snarfhome.snarfnet.net
|
|
description: Backyard Weather Telemetry
|
|
widget:
|
|
type: homeassistant
|
|
url: http://14.4.4.20:8123
|
|
key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIzZWUyNTE1MDk0NGU0ZjRjYmJkMGM1MWI5MThmY2EzYiIsImlhdCI6MTc0NjgxMDM3NSwiZXhwIjoyMDYyMTcwMzc1fQ.Le6M7WL63nxtLTxccFacQR5GVUY5C-a_zGtmXT_uaz4
|
|
custom:
|
|
- state: sensor.st_00158555_temperature
|
|
label: Outdoor Temp
|
|
- state: sensor.st_00158555_feels_like
|
|
label: Feels Like
|
|
- state: sensor.st_00158555_humidity
|
|
label: Humidity
|
|
- state: sensor.st_00158555_wind_speed
|
|
label: Wind Speed
|
|
|
|
settings.yaml: |
|
|
title: SnarfNet Operations & Telemetry
|
|
headerStyle: boxedWidgets
|
|
color: green
|
|
theme: dark
|
|
layout:
|
|
Critical Services:
|
|
GitOps & Automation:
|
|
Storage & Clusters:
|
|
Infrastructure & Observability:
|
|
Environment & Weather:
|
|
showStats: true
|
|
|
|
widgets.yaml: |
|
|
- resources:
|
|
backend: resources
|
|
cpu: true
|
|
expanded: true
|
|
memory: true
|
|
- search:
|
|
provider: duckduckgo
|
|
target: _blank
|
|
"""
|
|
|
|
filepath = r"homelab-gitops-repo\manifests\spaceport\homepage\homepage.yaml"
|
|
with open(filepath, "r", encoding="utf-8") as f:
|
|
text = f.read()
|
|
|
|
parts = text.split("---\n")
|
|
if len(parts) == 1:
|
|
parts = text.split("---\r\n")
|
|
|
|
cm_part = parts[2]
|
|
cm_kind_idx = cm_part.index("kind: ConfigMap")
|
|
cm_suffix = cm_part[cm_kind_idx:]
|
|
|
|
new_cm_part = new_configmap_data + cm_suffix
|
|
parts[2] = new_cm_part
|
|
|
|
new_full = "---\n".join(parts)
|
|
with open(filepath, "w", encoding="utf-8", newline="\r\n") as f:
|
|
f.write(new_full)
|
|
print("Updated homepage.yaml cleanly!")
|
|
|