# Deployment Commands - Quick Reference Alle Deployment-Operationen werden über **Ansible Playbooks** durchgeführt. --- ## 🚀 Häufig verwendete Commands ### Code deployen (Image-basiert) ```bash cd deployment/ansible ansible-playbook -i inventory/production.yml \ playbooks/deploy-update.yml \ -e "image_tag=abc1234-1696234567" \ -e "git_commit_sha=$(git rev-parse HEAD)" ``` ### Code synchen (Git-basiert) ```bash cd deployment/ansible ansible-playbook -i inventory/production.yml \ playbooks/sync-code.yml \ -e "git_branch=main" ``` ### Rollback zu vorheriger Version ```bash cd deployment/ansible ansible-playbook -i inventory/production.yml \ playbooks/rollback.yml ``` ### Infrastructure Setup (einmalig) ```bash cd deployment/ansible ansible-playbook -i inventory/production.yml \ playbooks/setup-infrastructure.yml ``` ### System Maintenance (regelmäßig) ```bash cd deployment/ansible ansible-playbook -i inventory/production.yml \ playbooks/system-maintenance.yml ``` --- ## 📋 Alle verfügbaren Playbooks ### Deployment & Updates - **`playbooks/deploy-update.yml`** - Deployt neues Docker Image - **`playbooks/sync-code.yml`** - Synchronisiert Code aus Git Repository - **`playbooks/rollback.yml`** - Rollback zu vorheriger Version ### Infrastructure Setup - **`playbooks/setup-infrastructure.yml`** - Deployed alle Stacks (Traefik, PostgreSQL, Registry, Gitea, Monitoring, Application) - **`playbooks/setup-production-secrets.yml`** - Deployed Secrets zu Production - **`playbooks/setup-ssl-certificates.yml`** - SSL Certificate Setup - **`playbooks/sync-stacks.yml`** - Synchronisiert Stack-Konfigurationen ### Troubleshooting & Maintenance - **`playbooks/troubleshoot.yml`** - Unified Troubleshooting Playbook mit Tags ```bash # Nur Diagnose ansible-playbook ... troubleshoot.yml --tags diagnose # Health Check prüfen ansible-playbook ... troubleshoot.yml --tags health,check # Health Checks fixen ansible-playbook ... troubleshoot.yml --tags health,fix # Nginx 404 fixen ansible-playbook ... troubleshoot.yml --tags nginx,404,fix # Alles ausführen ansible-playbook ... troubleshoot.yml --tags all ``` - **`playbooks/system-maintenance.yml`** - Führt Paket-Updates, Unattended-Upgrades und optional Docker-Pruning aus ### VPN - **`playbooks/setup-wireguard.yml`** - WireGuard VPN Setup - **`playbooks/add-wireguard-client.yml`** - WireGuard Client hinzufügen ### CI/CD - **`playbooks/setup-gitea-runner-ci.yml`** - Gitea Runner CI Setup --- ## 🔧 Ansible Variablen ### Häufig verwendete Extra Variables ```bash # Image Tag für Deployment -e "image_tag=abc1234-1696234567" # Git Branch für Code Sync -e "git_branch=main" -e "git_repo_url=https://git.michaelschiemer.de/michael/michaelschiemer.git" # Registry Credentials (wenn nicht im Vault) -e "docker_registry_username=admin" -e "docker_registry_password=secret" # Dry Run (Check Mode) --check # Verbose Output -v # oder -vv, -vvv für mehr Details ``` --- ## 📖 Vollständige Dokumentation - **[README.md](../../README.md)** - Haupt-Dokumentation - **[quick-start.md](quick-start.md)** - Schnellstart-Guide - **[code-change-workflow.md](code-change-workflow.md)** - Codeänderungen workflow --- ## 💡 Tipps ### Vault Passwort setzen ```bash export ANSIBLE_VAULT_PASSWORD_FILE=~/.ansible/vault_pass # oder ansible-playbook ... --vault-password-file ~/.ansible/vault_pass ``` ### Nur bestimmte Tasks ausführen ```bash ansible-playbook ... --tags "deploy,restart" ``` ### Check Mode (Dry Run) ```bash ansible-playbook ... --check --diff ``` ### Inventory prüfen ```bash ansible -i inventory/production.yml production -m ping ```