4.1 KiB
4.1 KiB
Backup-Automation - Datei-Index
📁 Projektstruktur
Dokumentation
- README.md - Hauptdokumentation, Setup, Troubleshooting
- GETTING_STARTED.md - Schnelleinstieg, Schritt für Schritt
- ARCHITECTURE.md - Detaillierte Architektur & Datenfluss
- SETUP_CHECKLIST.md - Vollständige Setup-Checkliste
- FILES_INDEX.md - Dieser Index
Kestra Workflows
- kestra/workflows/backup-provision.yaml - Hauptworkflow
- Netbox Abfrage
- Ansible Playbook Trigger
- Status Reporting
Ansible Playbooks & Roles
- ansible/playbooks/install-borg-client.yaml - Installation auf Clients
- ansible/playbooks/configure-backup-server.yaml - Server-Setup
- ansible/roles/borg-client/ - Role für Client-Installation
- ansible/roles/backup-server/ - Role für Server-Setup
Ansible Templates (.j2)
-
borg-backup.sh.j2 - Hauptbackup-Script
- Pre-Backup Hooks
- Borg Execution
- Pruning & Retention
-
pre-backup-docker.sh.j2 - Docker-spezifische Pre-Backup
- MySQL/PostgreSQL Dumps
- Named Volume Export
- Compose-File Backup
-
borg-backup.service.j2 - Systemd Service
-
borg-backup.timer.j2 - Systemd Timer (tägliche Ausführung)
-
backup-status-reporter.sh.j2 - Status Report
-
rclone.conf.j2 - Rclone S3 Konfiguration
-
rclone-sync.service.j2 - Systemd Service für S3-Sync
-
rclone-sync.timer.j2 - Systemd Timer für S3-Sync
Bash-Scripts (zum Ausführen auf Hosts)
- scripts/borg-backup-wrapper.sh - Wrapper mit Error-Handling
- scripts/docker-volume-dump.sh - Docker Volume Export
- scripts/backup-status-reporter.sh - Status Report
- scripts/restore-from-borg.sh - Restore-Helfer
Konfigurationen
- .gitignore - Git Ignore Patterns
- Secrets, Keys
- Temporäre Dateien
- IDE/OS-Dateien
📊 Größe & Komplexität
| Komponente | Größe | Komplexität |
|---|---|---|
| Kestra Workflow | ~400 Zeilen | Mittel |
| Ansible Playbook Client | ~200 Zeilen | Mittel |
| Ansible Playbook Server | ~250 Zeilen | Mittel |
| Borg Backup Script | ~200 Zeilen | Mittel |
| Docker Pre-Backup | ~150 Zeilen | Mittel |
| Rclone Config | ~30 Zeilen | Einfach |
| Dokumentation | ~3000 Zeilen | -- |
🔄 Datenabhängigkeiten
backup-provision.yaml (Kestra)
├── Nutzt: NETBOX_TOKEN (Secret)
├── Triggert: install-borg-client.yaml (Ansible)
│ ├── Nutzt: borg-backup.sh.j2
│ ├── Nutzt: pre-backup-docker.sh.j2
│ ├── Nutzt: borg-backup.service.j2
│ └── Nutzt: borg-backup.timer.j2
│
└── Auf Backup-Server:
├── configure-backup-server.yaml (Ansible)
├── Nutzt: rclone-sync.service.j2
├── Nutzt: rclone-sync.timer.j2
└── Nutzt: rclone.conf.j2
🚀 Erste Verwendung
- README.md lesen - Überblick
- GETTING_STARTED.md folgen - Step-by-Step
- SETUP_CHECKLIST.md durcharbeiten - Validierung
- ARCHITECTURE.md - Tieferes Verständnis
📝 Anpassungen
Pro Host anpassen:
- Template-Variablen in Ansible
group_vars//host_vars/ - Beispiele: Backup-Pfade, Exclude-Listen, Timeouts
Pro Server anpassen:
rclone.conf.j2- S3 Credentials, Regionborg-backup.timer.j2- Backup-Zeit (aktuell 03:00)rclone-sync.timer.j2- Sync-Zeit (aktuell 04:00)
Kestra anpassen:
backup-provision.yaml- Netbox Abfrage-Parameter- Schedule ändern (aktuell tägliche 02:00)
- Error Handling / Notifications
🔐 Sicherheit
Secrets (NICHT ins Git!)
- Netbox API Token → Kestra Secrets
- Hetzner S3 Keys → Ansible Vault / Kestra Secrets
- SSH Private Keys →
/root/.ssh/(Host-lokal)
SSH Key Management
- Ed25519 Keys generieren pro Host
- Public Keys → Backup-Server
authorized_keys - Mit
restrict,command=...limitation
📚 Referenzen
- Borg Backup: https://borgbackup.readthedocs.io
- Kestra: https://kestra.io/docs
- Ansible: https://docs.ansible.com
- Rclone: https://rclone.org/s3/
- Hetzner S3: https://www.hetzner.com/cloud/storage/object-storage
Stand: 2026-09-09
Version: 1.0
Maintainer: Jonny @ MBO-Tech-IT