- Add service management prompts (review, standardize, troubleshoot, integration) - Add Docker Swarm migration and tutoring workflows (swarm-migration, swarm-tutor) - Add SSO onboarding guide for Authentik integration (sso-onboarding) - Add session lifecycle prompts (start, end, status) for context continuity - Add node bootstrap scripts for Debian Trixie (day0bootstrap.sh) and Ubuntu/Debian (pi_init.sh) These prompts implement gated, step-by-step workflows with explicit confirmation requirements to prevent accidental changes during service operations. Bootstrap scripts standardize IP configuration (10.0.0.200) and install Docker + Ansible on new nodes.
83 lines
2.6 KiB
Bash
83 lines
2.6 KiB
Bash
#!/bin/bash
|
|
|
|
# ==============================================================================
|
|
# DEBIAN TRIXIE BOOTSTRAP: IP, DOCKER, ANSIBLE
|
|
# ==============================================================================
|
|
|
|
set -euo pipefail
|
|
|
|
# --- 1. SET STATIC IP (Netplan) ---
|
|
echo "[⚙] Configuring Static IP to 10.0.0.200..."
|
|
|
|
# Fix permissions on existing netplan files
|
|
sudo chmod 600 /lib/netplan/*.yaml 2>/dev/null || true
|
|
|
|
# Find the active physical interface
|
|
INTERFACE=$(ip -o link show | awk -F': ' '$2 != "lo" {print $2}' | head -n1)
|
|
|
|
sudo mkdir -p /etc/netplan
|
|
sudo cat <<EOF > /etc/netplan/01-netcfg.yaml
|
|
network:
|
|
version: 2
|
|
renderer: networkd
|
|
ethernets:
|
|
$INTERFACE:
|
|
addresses:
|
|
- 10.0.0.200/24
|
|
nameservers:
|
|
addresses: [10.0.0.2, 8.8.8.8]
|
|
routes:
|
|
- to: default
|
|
via: 10.0.0.1
|
|
EOF
|
|
|
|
# Fix permissions so Netplan doesn't complain
|
|
sudo chmod 600 /etc/netplan/01-netcfg.yaml
|
|
|
|
echo "[✓] Netplan config created. Applying now..."
|
|
sudo netplan apply
|
|
|
|
echo "[⚙] Waiting for network to stabilize..."
|
|
sleep 3
|
|
|
|
# Verify network connectivity
|
|
if ! ping -c 1 8.8.8.8 &>/dev/null; then
|
|
echo "[!] Warning: Network may not be ready yet, but continuing..."
|
|
fi
|
|
|
|
# --- 2. INSTALL DOCKER ---
|
|
echo "[⚙] Installing Docker (using Debian Bookworm repo for Trixie compatibility)..."
|
|
|
|
# Remove any existing Docker repository configurations
|
|
sudo rm -f /etc/apt/sources.list.d/docker.list
|
|
sudo rm -f /etc/apt/sources.list.d/docker*.list
|
|
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y ca-certificates curl gnupg
|
|
|
|
sudo mkdir -p /etc/apt/keyrings
|
|
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg --yes
|
|
|
|
# Manually set to 'bookworm' because 'trixie' doesn't exist on Docker's servers yet
|
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian bookworm stable" | \
|
|
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
|
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
|
|
|
# Allow current user to run docker without sudo
|
|
sudo usermod -aG docker $USER
|
|
echo "[✓] Docker installed."
|
|
|
|
# --- 3. INSTALL ANSIBLE ---
|
|
echo "[⚙] Installing Ansible..."
|
|
# On Debian, we don't use the Ubuntu PPA. We install from the default repos.
|
|
sudo apt-get install -y ansible
|
|
echo "[✓] Ansible installed."
|
|
|
|
echo "=========================================="
|
|
echo "BOOTSTRAP COMPLETE"
|
|
echo "IP: 10.0.0.200 (Connection will drop shortly)"
|
|
echo "Docker & Ansible: Ready"
|
|
echo "=========================================="
|