- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
112 lines
4.0 KiB
Makefile
112 lines
4.0 KiB
Makefile
.PHONY: install setup clients add-client remove-client status download-configs ping-test check-service help
|
||
|
||
# Standardziel
|
||
help:
|
||
@echo "WireGuard Ansible (vereinfacht, ohne Firewall)"
|
||
@echo ""
|
||
@echo "Verfügbare Befehle:"
|
||
@echo " install - WireGuard installieren"
|
||
@echo " setup - Nur WireGuard-Server installieren"
|
||
@echo " clients - Client-Konfigurationen erstellen"
|
||
@echo " add-client - Neuen Client hinzufügen"
|
||
@echo " remove-client - Client entfernen"
|
||
@echo " show-clients - Vorhandene Clients anzeigen"
|
||
@echo " status - WireGuard-Status anzeigen"
|
||
@echo " download-configs - Client-Konfigurationen herunterladen"
|
||
@echo " ping-test - Verbindung zum Server testen"
|
||
@echo " check-service - Service-Status prüfen"
|
||
@echo " logs - WireGuard-Logs anzeigen"
|
||
@echo " restart - WireGuard-Service neustarten"
|
||
@echo " qr-codes - QR-Codes für alle Clients erstellen"
|
||
|
||
# WireGuard-Installation
|
||
install:
|
||
@echo "🚀 Installiere WireGuard (ohne Firewall)..."
|
||
ansible-playbook -i inventory/hosts.yml site.yml
|
||
|
||
# Nur Server-Setup
|
||
setup:
|
||
@echo "⚙️ Installiere WireGuard-Server..."
|
||
ansible-playbook -i inventory/hosts.yml wireguard-install-server.yml
|
||
|
||
# Client-Konfigurationen erstellen
|
||
clients:
|
||
@echo "👥 Erstelle Client-Konfigurationen..."
|
||
ansible-playbook -i inventory/hosts.yml wireguard-create-config.yml
|
||
|
||
# Client-Management
|
||
add-client:
|
||
@echo "➕ Füge neuen Client hinzu..."
|
||
ansible-playbook -i inventory/hosts.yml add-client.yml
|
||
|
||
remove-client:
|
||
@echo "➖ Entferne Client..."
|
||
ansible-playbook -i inventory/hosts.yml remove-client.yml
|
||
|
||
show-clients:
|
||
@echo "👀 Zeige vorhandene Clients..."
|
||
ansible-playbook -i inventory/hosts.yml show-clients.yml
|
||
|
||
# Status und Überwachung
|
||
status:
|
||
@echo "📊 WireGuard-Status:"
|
||
ansible vpn -i inventory/hosts.yml -m shell -a "wg show"
|
||
|
||
download-configs:
|
||
@echo "📥 Lade Client-Konfigurationen herunter..."
|
||
@mkdir -p ./client-configs
|
||
ansible vpn -i inventory/hosts.yml -m fetch -a "src=/etc/wireguard/clients/ dest=./client-configs/ flat=true"
|
||
@echo "✅ Konfigurationen in ./client-configs/ gespeichert"
|
||
|
||
ping-test:
|
||
@echo "🏓 Teste Verbindung zum Server..."
|
||
ansible vpn -i inventory/hosts.yml -m ping
|
||
|
||
check-service:
|
||
@echo "🔍 Prüfe WireGuard-Service..."
|
||
ansible vpn -i inventory/hosts.yml -m systemd -a "name=wg-quick@wg0"
|
||
|
||
logs:
|
||
@echo "📋 WireGuard-Logs:"
|
||
ansible vpn -i inventory/hosts.yml -m shell -a "journalctl -u wg-quick@wg0 --no-pager -n 20"
|
||
|
||
restart:
|
||
@echo "🔄 Starte WireGuard-Service neu..."
|
||
ansible vpn -i inventory/hosts.yml -m systemd -a "name=wg-quick@wg0 state=restarted"
|
||
|
||
# Client-QR-Codes
|
||
qr-codes:
|
||
@echo "📱 Erstelle QR-Codes für alle Clients..."
|
||
ansible vpn -i inventory/hosts.yml -m shell -a "for conf in /etc/wireguard/clients/*.conf; do echo; echo '=== '$$conf' ==='; qrencode -t ansiutf8 < $$conf; done"
|
||
|
||
# Backup der Konfiguration
|
||
backup:
|
||
@echo "💾 Erstelle Backup der WireGuard-Konfiguration..."
|
||
@mkdir -p ./backups/$(shell date +%Y%m%d_%H%M%S)
|
||
ansible vpn -i inventory/hosts.yml -m fetch -a "src=/etc/wireguard/ dest=./backups/$(shell date +%Y%m%d_%H%M%S)/ flat=true"
|
||
@echo "✅ Backup in ./backups/$(shell date +%Y%m%d_%H%M%S)/ erstellt"
|
||
|
||
# Syntax-Check
|
||
check:
|
||
@echo "✅ Prüfe Ansible-Syntax..."
|
||
ansible-playbook -i inventory/hosts.yml site.yml --syntax-check
|
||
ansible-playbook -i inventory/hosts.yml add-client.yml --syntax-check
|
||
ansible-playbook -i inventory/hosts.yml remove-client.yml --syntax-check
|
||
ansible-playbook -i inventory/hosts.yml show-clients.yml --syntax-check
|
||
|
||
# Dry-run
|
||
dry-run:
|
||
@echo "🧪 Dry-run der Installation..."
|
||
ansible-playbook -i inventory/hosts.yml site.yml --check --diff
|
||
|
||
# Netzwerk-Info
|
||
network-info:
|
||
@echo "🌐 Netzwerk-Informationen:"
|
||
ansible vpn -i inventory/hosts.yml -m shell -a "ip addr show wg0"
|
||
ansible vpn -i inventory/hosts.yml -m shell -a "ip route | grep wg0"
|
||
|
||
# Server-Konfiguration anzeigen
|
||
server-config:
|
||
@echo "📄 Zeige Server-Konfiguration:"
|
||
ansible vpn -i inventory/hosts.yml -m shell -a "cat /etc/wireguard/wg0.conf"
|