- 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.
66 lines
2.1 KiB
Bash
66 lines
2.1 KiB
Bash
#!/bin/bash
|
|
|
|
# ==============================================================================
|
|
# SINGLE-COMMAND BOOTSTRAP: IP, DOCKER, ANSIBLE
|
|
# Target: Ubuntu / Debian
|
|
# ==============================================================================
|
|
|
|
set -euo pipefail
|
|
|
|
# --- 1. SET STATIC IP (Netplan) ---
|
|
echo "[⚙] Configuring Static IP to 10.0.0.200..."
|
|
|
|
# Find the active physical interface (e.g., eth0, enp3s0)
|
|
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
|
|
|
|
echo "[✓] Netplan config created. Applying in background..."
|
|
# We apply in background so the script doesn't hang if SSH drops
|
|
sudo netplan apply &
|
|
|
|
# --- 2. INSTALL DOCKER ---
|
|
echo "[⚙] Installing Docker..."
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y ca-certificates curl gnupg lsb-release
|
|
|
|
sudo mkdir -p /etc/apt/keyrings
|
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg --yes
|
|
|
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) 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..."
|
|
sudo apt-get install -y software-properties-common
|
|
sudo add-apt-repository --yes --update ppa:ansible/ansible
|
|
sudo apt-get install -y ansible
|
|
echo "[✓] Ansible installed."
|
|
|
|
echo "=========================================="
|
|
echo "BOOTSTRAP COMPLETE"
|
|
echo "IP: 10.0.0.200 (You may need to reconnect)"
|
|
echo "Docker & Ansible: Ready"
|
|
echo "=========================================="
|