Creating vSphere VMs from .ova files on the linux command line

VMware's documentation is great, but their naming is absolutely awful. Trying to find your way through the maze of acronyms and names is truly daunting. Take heart!

Uploading a OVA and creating a VM

Install OVFtool

Download ovftool from VMware, https://www.vmware.com/support/developer/ovf/ and install. I like to see what my shell scripts are doing, so I added -x

bash -x VMware-ovftool-4.2.0-4586971-lin.x86_64.bundle
ovftool

Upload an OVA

ovftool $ova_file vi://$username:$password@$hostname/$inventory_path

The only complicated thing is finding out the inventory path to use. The good news is that ovftool will tell you possible completeions

$ ovftool $ova_file vi://$username:$password@$hostname/$inventory_path

Error: Found wrong kind of object (Folder). Possible completions are:
  Boulder/
  Completed with errors
$ ovftool $ova_file vi://$username:$password@$hostname/Boulder/
Error: Found wrong kind of object (Folder). Possible completions are:
  folder1/
  folder2/
  Completed with errors
$ ovftool $ova_file vi://$username:$password@$hostname/Boulder/folder2
Error: Found wrong kind of object (Folder). Possible completions are:
  subfolder1/
  Completed with errors
$ # and so on...

Anyways, once you find the right path, you might find it useful to preconfigure some things about the VM you are creating, but this should all be immediately obvious by examining

ovftool --help

social