zmgr/create_oi_zone.sh
Till Wegmueller abdce9c927
Add zmgr: illumos zone manager with IPAM and flat-file registry
Rust CLI that creates/destroys/imports illumos zones from KDL template
configs with automatic IP allocation from named pools. Registry lives
under /etc/zmgr as flat KDL files — zone entries double as the IPAM
ledger. Includes default templates for ipkg (OI) and nlipkg (OFL)
brands, matching the existing shell scripts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 12:14:09 +01:00

29 lines
464 B
Bash
Executable file

#!/usr/bin/bash
set -ex
ZONE=$1
ADDRESS="${2}/24"
NICNAME="${ZONE}0"
INTERNALSTUB="oinetint0"
GATEWAY="10.1.0.1"
if ! dladm show-vnic $NICNAME > /dev/null; then
dladm create-vnic -l $INTERNALSTUB $NICNAME
fi
cat <<EOF | zonecfg -z $ZONE
create -b
set zonepath=/zones/$ZONE
set brand=ipkg
set autoboot=false
set ip-type=exclusive
add net
set physical=$NICNAME
set allowed-address=$ADDRESS
set defrouter=$GATEWAY
end
verify
commit
EOF
zoneadm -z $ZONE install