feat(nixos): add control center host with hypervisor gitops service

This commit is contained in:
Tibo De Peuter 2026-07-27 22:01:40 +02:00
parent 89cec4e0f3
commit dc9b7a30d9
Signed by: tdpeuter
SSH key fingerprint: SHA256:u/h/LVoqKF1Iz02uOyxe6hcjmoZASCGV2HM0TG9ZMoU
10 changed files with 259 additions and 42 deletions

View file

@ -0,0 +1,39 @@
#!/usr/bin/env bash
# This script pulls the latest changes from the Git repository
# and runs OpenTofu to provision the hypervisor state.
# Usage: ./hypervisor-sync.sh <REPO_URL> <OPENTOFU_DIR>
REPO_URL=${1:-"https://git.depeuter.dev/Bos55/nix-config.git"}
OPENTOFU_DIR=${2:-"opentofu/nodes/mikoshi"}
echo "Starting Hypervisor GitOps sync..."
if [ ! -d "nix-config" ]; then
echo "Cloning repository from $REPO_URL..."
git clone "$REPO_URL" nix-config
fi
cd nix-config || exit
git fetch origin main
LOCAL=$(git rev-parse HEAD)
REMOTE=$(git rev-parse origin/main)
if [ "$LOCAL" = "$REMOTE" ]; then
echo "Already up to date. Nothing to do."
exit 0
fi
echo "Changes detected. Updating from $LOCAL to $REMOTE..."
git reset --hard origin/main
echo "Applying OpenTofu changes in $OPENTOFU_DIR..."
cd "$OPENTOFU_DIR" || exit
tofu init -upgrade
tofu apply -auto-approve
echo "Hypervisor GitOps sync completed successfully."