29 lines
496 B
Tcsh
29 lines
496 B
Tcsh
#!/bin/csh -f
|
|
# set arguments
|
|
set HOSTNAME=$1
|
|
set IP=$2
|
|
|
|
if ( $3 == "" ) then
|
|
set SIZE=20G
|
|
else
|
|
set SIZE=$3
|
|
endif
|
|
|
|
# set static variables
|
|
set VM=/usr/local/sbin/vm
|
|
set TEMPLATE=ubuntu-small
|
|
set IMAGE=ubuntu20.img
|
|
set PUBKEY=/home/simon/.ssh/id_ed25519.pub
|
|
set NAMESERVER=192.168.10.254
|
|
set GATEWAY=192.168.10.254
|
|
set PREFIX=24
|
|
|
|
# create vm
|
|
$VM create \
|
|
-t $TEMPLATE \
|
|
-s $SIZE \
|
|
-i $IMAGE \
|
|
-C -k $PUBKEY \
|
|
-n "ip=$IP/$PREFIX;gateway=$GATEWAY;nameservers=$NAMESERVER" \
|
|
$HOSTNAME
|