2 echo "==== START $HOST ===="
3 echo "VMENGINE=$VMENGINE VMTEMPLATE=$VMTEMPLATE CIDR=$CIDR IPGW=$IPGW"
6 export TEMPLATE=$VMTEMPLATE
10 echo "ERROR: VMENGINE not set"
15 echo "ERROR: TEMPLATE not set"
19 if [ ! -e /usr/lib/lxc/templates/lxc-$TEMPLATE ]
21 echo "/usr/lib/lxc/templates/lxc-$TEMPLATE not found"
22 echo "you need to install template"
23 echo "run: (cd $lxcdir ; sudo make)"
26 cat $lxcdir/config.$TEMPLATE > $tmpconf
29 echo "lxc.network.ipv4 = $CIDR" >> $tmpconf
31 # Next is a bit hacky, the only way I found to pass pubkey to the template
32 # LXC don't allow to pass extra args
35 echo "#lxc.network.ipv4.gw = $IPGW" >> $tmpconf
37 echo "#lxc.pubkey = $SSHPUBKEY" >> $tmpconf
38 sudo /usr/bin/lxc-create -n $HOST -f $tmpconf -t $TEMPLATE
40 sudo /usr/bin/lxc-start -n $HOST -d