55 lines
1.6 KiB
Bash
55 lines
1.6 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Create placeholder LXCs for later-phase DBIS RTGS sidecars.
|
|
# Usage:
|
|
# ./scripts/deployment/create-dbis-rtgs-later-phase-sidecar-lxcs.sh [--dry-run]
|
|
|
|
HOST="${PROXMOX_HOST_R630_02:-192.168.11.12}"
|
|
SSH_OPTS="-o BatchMode=yes -o ConnectTimeout=15 -o StrictHostKeyChecking=accept-new"
|
|
TEMPLATE="${PVE_LXC_TEMPLATE:-local:vztmpl/debian-12-standard_12.7-1_amd64.tar.zst}"
|
|
STORAGE="${PVE_STORAGE:-local-lvm}"
|
|
BRIDGE="${PVE_BRIDGE:-vmbr0}"
|
|
GATEWAY="${PVE_GATEWAY:-192.168.11.1}"
|
|
|
|
DRY_RUN=false
|
|
if [[ "${1:-}" == "--dry-run" ]]; then
|
|
DRY_RUN=true
|
|
fi
|
|
|
|
LXCS=(
|
|
"${RTGS_SECURITIES_VMID:-5808} ${RTGS_SECURITIES_HOSTNAME:-rtgs-securities-1} ${RTGS_SECURITIES_IP:-192.168.11.96} 4096 2 24"
|
|
"${RTGS_CARDNET_VMID:-5809} ${RTGS_CARDNET_HOSTNAME:-rtgs-cardnet-1} ${RTGS_CARDNET_IP:-192.168.11.97} 4096 2 24"
|
|
"${RTGS_MT103_VMID:-5810} ${RTGS_MT103_HOSTNAME:-rtgs-mt103-1} ${RTGS_MT103_IP:-192.168.11.98} 4096 2 24"
|
|
)
|
|
|
|
run_remote() {
|
|
local cmd="$1"
|
|
if $DRY_RUN; then
|
|
echo "[DRY-RUN] $cmd"
|
|
else
|
|
ssh $SSH_OPTS "root@$HOST" "$cmd"
|
|
fi
|
|
}
|
|
|
|
echo "=== DBIS RTGS later-phase sidecar LXCs ==="
|
|
echo "Host: $HOST"
|
|
echo "Template: $TEMPLATE"
|
|
echo
|
|
|
|
for spec in "${LXCS[@]}"; do
|
|
read -r vmid hostname ip memory cores disk <<<"$spec"
|
|
cmd="pct create $vmid $TEMPLATE \
|
|
--hostname $hostname \
|
|
--cores $cores \
|
|
--memory $memory \
|
|
--rootfs ${STORAGE}:${disk} \
|
|
--net0 name=eth0,bridge=${BRIDGE},gw=${GATEWAY},ip=${ip}/24 \
|
|
--onboot 1 \
|
|
--unprivileged 1 \
|
|
--features nesting=1 \
|
|
--password \$(openssl rand -base64 18) \
|
|
--description 'DBIS RTGS later-phase sidecar LXC ($hostname)'"
|
|
run_remote "$cmd"
|
|
done
|