mirror of
https://github.com/CloudNebulaProject/zmgr.git
synced 2026-04-10 13:10:42 +00:00
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>
29 lines
464 B
Bash
Executable file
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
|