chore: complete update
This commit is contained in:
43
x_ansible/setup.sh
Executable file
43
x_ansible/setup.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
echo "=== Ansible-Setup für michaelschiemer.de ==="
|
||||
echo "Dieses Script vereinfacht die Ausführung der Ansible-Playbooks."
|
||||
|
||||
if [ "$#" -lt 1 ]; then
|
||||
echo "Verwendung: $0 [setup|deploy] [Zielumgebung]"
|
||||
echo "Beispiel: $0 setup staging"
|
||||
echo "Beispiel: $0 deploy production"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ACTION=$1
|
||||
ENVIRONMENT=${2:-staging} # Standard ist staging
|
||||
|
||||
echo "Aktion: $ACTION"
|
||||
echo "Zielumgebung: $ENVIRONMENT"
|
||||
echo ""
|
||||
|
||||
# Wechsle in das Ansible-Verzeichnis
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
if [ "$ACTION" == "setup" ]; then
|
||||
echo "Führe Server-Setup für $ENVIRONMENT aus..."
|
||||
ansible-playbook -i inventory/hosts.ini setup.yml --limit $ENVIRONMENT -v
|
||||
exit_code=$?
|
||||
elif [ "$ACTION" == "deploy" ]; then
|
||||
echo "Führe Deployment für $ENVIRONMENT aus..."
|
||||
ansible-playbook -i inventory/hosts.ini playbooks/deploy.yml --limit $ENVIRONMENT -v
|
||||
exit_code=$?
|
||||
else
|
||||
echo "Unbekannte Aktion: $ACTION"
|
||||
echo "Erlaubte Aktionen: setup, deploy"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $exit_code -eq 0 ]; then
|
||||
echo "\n✅ Ansible-Ausführung erfolgreich abgeschlossen!"
|
||||
else
|
||||
echo "\n❌ Ansible-Ausführung fehlgeschlagen mit Fehlercode $exit_code"
|
||||
fi
|
||||
Reference in New Issue
Block a user