#!/usr/bin/env bash # Create only the 3 missing containers (2506, 2507, 2508) per MISSING_CONTAINERS_LIST.md. # Use this for W2-6 when 1504, 2503-2505, etc. already exist on other hosts. # # Usage: PROXMOX_HOST=192.168.11.11 bash scripts/create-missing-containers-2506-2508.sh [--dry-run] set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true PROXMOX_HOST="${PROXMOX_HOST:-${PROXMOX_HOST_R630_01:-192.168.11.11}}" TEMPLATE="${TEMPLATE:-local:vztmpl/debian-12-standard_12.12-1_amd64.tar.zst}" STORAGE="${STORAGE:-local-lvm}" NETWORK="${NETWORK:-vmbr0}" GATEWAY="${NETWORK_GATEWAY:-192.168.11.1}" DRY_RUN=false [[ "${1:-}" == "--dry-run" ]] && DRY_RUN=true log() { echo -e "\033[0;34m[INFO]\033[0m $1"; } success() { echo -e "\033[0;32m[✓]\033[0m $1"; } warn() { echo -e "\033[0;33m[WARN]\033[0m $1"; } error() { echo -e "\033[0;31m[ERROR]\033[0m $1"; } exists() { local vmid=$1 ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 root@"${PROXMOX_HOST}" "pct list 2>/dev/null | grep -q '^$vmid ' && echo yes || echo no" } create() { local vmid=$1 hostname=$2 ip=$3 mem=$4 cores=$5 disk=$6 desc="$7" if [[ "$(exists $vmid)" == "yes" ]]; then warn "Container $vmid already exists, skipping." return 0 fi log "Creating $vmid: $hostname ($ip) — ${mem}GB RAM, ${cores} cores, ${disk}GB disk..." if [[ "$DRY_RUN" == true ]]; then echo " [DRY-RUN] ssh root@${PROXMOX_HOST} pct create $vmid ..." return 0 fi ssh -o StrictHostKeyChecking=no root@"${PROXMOX_HOST}" <