How can I deploy template-based VM from Linux?

We are trying to provide our Linux engineers with a CLI to deploy VMWare vSphere VMs using templates.

The vSphere CLI looks promising but the documentation doesn't mention templates.

Does anyone have any suggestions on how to go about this?


Solution 1:

The only option I've found would be using the PySphere SDK

I've used it to do snapshot consolidation and cleanup, but it can certainly do VM creation from a template.

Solution 2:

A couple of thoughts on this...

  • It's almost easier to install Linux operating systems anew if you have a deployment solution and configuration management in place (e.g. Cobbler and Puppet/Chef). I tend not to use vSphere templates for anything other than canned Windows server installations.

  • If that's not possible, and the template deployment process is infrequent, the standard vSphere Web Client and thick client are adequate.

The fact that you've phrased this as "[providing] our Linux engineers with a CLI", makes me wonder if there's been some pushback, or reluctance to use the standard VMware tools.

Is there more context here?

Solution 3:

There's a fling, Ruby vSphere Console, that you can make use of.

If your Linux admins prefer Python they could use pyVmomi, but it's more of a library (although you can start Python, import pyVmomi and then use it as a "shell").

There's also virsh but it looks like you can't deploy templates with it. However, googleing for virsh + deploy + template I found vm-easy-deploy that might help you.