docker-fobi/scripts/01-install-ansible-and-run-playbook.sh
2025-10-25 17:19:14 +02:00

27 lines
696 B
Bash

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
cd "${REPO_ROOT}"
if [[ ${EUID} -ne 0 ]]; then
echo "Bitte als root oder per sudo ausführen." >&2
exit 1
fi
echo "[0/3] Arbeitsverzeichnis: ${REPO_ROOT}"
echo "[1/3] apt-Index aktualisieren..."
apt-get update -y
echo "[2/3] Ansible installieren..."
DEBIAN_FRONTEND=noninteractive apt-get install -y ansible
echo "[3/3] Playbook ansible/install-docker.yml lokal ausführen..."
ansible-playbook \
-i localhost, \
--connection=local \
ansible/install-docker.yml
echo "Fertig: install-docker.yml wurde erfolgreich auf localhost angewendet."