Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
68 lines
2.3 KiB
Bash
Executable File
68 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Uses PROXMOX_* from .env or config/ip-addresses.conf
|
|
# List all LXC containers on r630-01 and r630-02 with VMID, Name, IP, and Status
|
|
# Usage: ./scripts/list-r630-containers.sh [r630-01|r630-02|all]
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
[ -f "${PROJECT_ROOT}/.env" ] && source "${PROJECT_ROOT}/.env" 2>/dev/null || true
|
|
[ -f "${PROJECT_ROOT}/config/ip-addresses.conf" ] && source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
|
|
|
|
# Colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
|
log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
|
|
log_error() { echo -e "${RED}[✗]${NC} $1"; }
|
|
|
|
# Hosts (from config/ip-addresses.conf or .env)
|
|
R630_01="${PROXMOX_HOST_R630_01:-192.168.11.11}"
|
|
R630_02="${PROXMOX_HOST_R630_02:-192.168.11.12}"
|
|
SSH_OPTS="-o StrictHostKeyChecking=no -o ConnectTimeout=10"
|
|
|
|
# Function to list containers on a host
|
|
list_containers() {
|
|
local host=$1
|
|
local hostname=$2
|
|
|
|
log_info "Listing containers on $hostname ($host)..."
|
|
echo ""
|
|
|
|
ssh $SSH_OPTS root@$host "pct list | tail -n +2 | while read vmid status lock name; do
|
|
ip=\$(pct config \$vmid 2>/dev/null | grep '^net0:' | sed -n 's/.*ip=\([^\/]*\).*/\1/p' || echo 'N/A')
|
|
hostname=\$(pct config \$vmid 2>/dev/null | grep '^hostname:' | cut -d' ' -f2 || echo 'N/A')
|
|
echo \"\$vmid|\$hostname|\$ip|\$status\"
|
|
done" 2>/dev/null | column -t -s'|' -N 'VMID,Hostname,IP,Status'
|
|
|
|
echo ""
|
|
}
|
|
|
|
# Main
|
|
TARGET="${1:-all}"
|
|
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "📋 LXC Container Inventory - R630 Proxmox Hosts"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
|
|
case "$TARGET" in
|
|
r630-01|r630_01|1)
|
|
list_containers "$R630_01" "r630-01"
|
|
;;
|
|
r630-02|r630_02|2)
|
|
list_containers "$R630_02" "r630-02"
|
|
;;
|
|
all|*)
|
|
list_containers "$R630_01" "r630-01"
|
|
list_containers "$R630_02" "r630-02"
|
|
;;
|
|
esac
|
|
|
|
log_success "Inventory complete"
|