Deleting staging VM

I’m using the vsphere-clone builder to:

  1. Make a clone of a VM template
  2. Provision it with a shell provisioner
  3. Export it to an OVF

However I can’t find an option to delete the temporary VM, when the OVF has been exported.

How can I do this?

Same problem here. It would be nice if I could avoid writing my own scripts to clean up after packer…

@tom-vo @darkprokoba

Not sure if this is a solution, but have you tried using the vSphere REST API to delete the VM in a post-processor?

You might have to explicitly name the vCenter Server so you’ll know what it is called (or do you have to do that anyway?)

Hope this helps?


I have the same issue as you describe. Have you found a way to do this ?

Thanks in advance for your reply

Hi, no unfortunately not. I have created a PowerShell script which removes the staging VM’s once in a while.

This is an existing enhancement request. See GH-168.

Ryan Johnson
Senior Staff Solutions Architect | Product Engineering @ VMware, Inc.