I was able to get a server up and running at home again, and given what I want to do, using ESXi is a good solution. When it comes to servers I prefer to do: (a) from the command line and (b) using ssh. First thing I did after getting ESXi installed was to enable their “Tech Support Mode“, and then things got interesting. The command line of ESXi 4.1 is limited, but yet powerful enough to do the job nicely. After some searching I learned how to create a new server on the command line, power it on/off, register it with ESX and destroy it too.
To create and power on a new server I created the following script
#!/bin/sh ## Most of this taken from http://www.vm-help.com/esx40i/manage_without_VI_client_1.php mkdir $1 # First make the disk vmkfstools -c 15G -a lsilogic $1/$1.vmdk # Now output the vmx file cat <$1/$1.vmx config.version = "8" virtualHW.version = "7" vmci0.present = "TRUE" displayName = "$1" floppy0.present = "FALSE" numvcpus = "2" scsi0.present = "TRUE" scsi0.sharedBus = "none" scsi0.virtualDev = "lsilogic" memsize = "256" scsi0:0.present = "TRUE" scsi0:0.fileName = "$1.vmdk" scsi0:0.deviceType = "scsi-hardDisk" ide1:0.present = "TRUE" ide1:0.fileName = "/vmfs/volumes/datastore1/ISOs/install48-amd64.iso" ide1:0.deviceType = "cdrom-image" ethernet0.present = "TRUE" ethernet0.virtualDev = "vmxnet" ethernet0.features = "15" ethernet0.networkName = "VM Network" ethernet0.addressType = "generated" ethernet1.present = "TRUE" ethernet1.virtualDev = "vmxnet" ethernet1.features = "15" ethernet1.networkName = "VM Network 2" ethernet1.addressType = "generated" guestOS = "freebsd-64" EOF # Now register our new VM vnum=`vim-cmd solo/registervm /vmfs/volumes/datastore1/$1/$1.vmx` vim-cmd vmsvc/power.on $vnum
#!/bin/sh
vim-cmd vmsvc/power.off `vim-cmd vmsvc/getallvms |grep $1|awk '{print $1}'`
vim-cmd vmsvc/destroy `vim-cmd vmsvc/getallvms |grep $1|awk '{print $1}'`
Then I went ahead and wrote a one liner to create 10 new machines and then destroy them. Once I get my completely automated OpenBSD installer finished, then I can adjust the creation of the machines to boot from the network. Thus all I will have to do is run the script to create the machine and then sit back and wait. In I’m guessing about 15 minutes I’ll have an up and working OpenBSD system. Since the install will be automated I can also fully customize the final result. If I was responsible for a group of say web servers and my company just announced some awesome widget that everyone wants, then I had better be prepared to deploy more servers quickly. Using the above I could easily accomplish that task. After all if our customers could not use our website then they will not be happy.

