--- - name: Test Grafana VPN Access - Final Check hosts: production gather_facts: no become: no tasks: - name: Instructions debug: msg: - "=== FINALER TEST ===" - "AllowedIPs ist korrekt (10.8.0.0/24) ?" - "" - "Bitte f?hre diese Schritte auf Windows aus:" - "1. DNS-Cache leeren: ipconfig /flushdns" - "2. Browser-Cache leeren oder Inkognito-Modus nutzen" - "3. Stelle sicher, dass VPN verbunden ist" - "4. ?ffne: https://grafana.michaelschiemer.de" - "5. Warte 10 Sekunden" - "" - "Dann pr?fe ich die Logs..." - name: Wait for access attempt pause: seconds: 20 - name: Check latest Grafana access shell: | cd ~/deployment/stacks/traefik echo "=== Letzte 10 Grafana-Zugriffe ===" tail -500 logs/access.log | grep -i grafana | tail -10 | while IFS= read -r line; do time=$(echo "$line" | grep -oP '"time":"[^"]*"' | sed 's/"time":"//;s/"//' | cut -d'T' -f2 | cut -d'+' -f1 | cut -d':' -f1-2) client=$(echo "$line" | grep -oP '"ClientHost":"[^"]*"' | sed 's/"ClientHost":"//;s/"//') status=$(echo "$line" | grep -oP '"DownstreamStatus":[0-9]+' | sed 's/"DownstreamStatus"://') if [[ "$client" =~ ^10\.8\.0\.[0-9]+$ ]]; then echo "$time | ClientHost: $client | Status: $status ? VPN-IP (Traffic kommt ?ber VPN!)" elif [[ "$client" == "89.246.96.244" ]]; then echo "$time | ClientHost: $client | Status: $status ? ?ffentliche IP (Traffic kommt NICHT ?ber VPN)" else echo "$time | ClientHost: $client | Status: $status ? Unbekannt" fi done args: executable: /bin/bash register: analysis ignore_errors: yes failed_when: false - name: Display analysis debug: msg: "{{ analysis.stdout_lines }}" - name: Get unique client IPs from last 10 requests shell: | cd ~/deployment/stacks/traefik tail -100 logs/access.log | grep -i grafana | tail -10 | grep -oP '"ClientHost":"[^"]*"' | sed 's/"ClientHost":"//;s/"//' | sort -u args: executable: /bin/bash register: unique_ips ignore_errors: yes failed_when: false - name: Display unique IPs debug: msg: "{{ unique_ips.stdout_lines }}" - name: Final verdict debug: msg: - "" - "=== ERGEBNIS ===" - "Pr?fe die obigen Zeilen:" - "" - "? Wenn ClientHost: 10.8.0.7 ? Traffic kommt ?ber VPN!" - " ? Dann k?nnen wir die tempor?re IP-Erlaubnis entfernen!" - "" - "? Wenn ClientHost: 89.246.96.244 ? Traffic kommt NICHT ?ber VPN" - " ? Dann m?ssen wir weitere Debugging-Schritte durchf?hren"