Convert template to VM -> vsphere-clone

23 views
Skip to first unread message

Manish Garedia

unread,
Oct 5, 2020, 1:44:39 AM10/5/20
to Packer
Hi,

Goal:  I have a simple goal of uploading existing template to Content Library.  (Code snippet is attached below)

I am able to achieve that using vsphere-clone but only problem is I have to create a VM from template with new name. I want to know if there is anyway to convert a template to a VM using vsphere-clone? It seems both "vm_name" and "template" are required variables so both have to be of different name.

{
  "builders": [
    {
      "type": "vsphere-clone",

      "vcenter_server":      "{{user `VCENTER_URL`}}",
      "cluster":             "myCluster",
      "host":                "{{user `ESXI_HOST`}}",
      "datastore":           "{{user `DATASTORE`}}",
      "datacenter":          "{{user `DATACENTER`}}",
      "folder":              "{{user `VM_FOLDER`}}",
      "insecure_connection": "true",
      "template":            "{{user `VM_TEMPLATE`}}",
      "username":            "{{user `VCENTER_USER`}}",
      "password":            "{{user `VCENTER_PASS`}}",
      "vm_name":             "{{user `VM_NAME`}}",

      "content_library_destination" : {
        "library": "myCL",
        "ovf": true
      },
      "communicator": "none"
    }
  ]
}



Thanks!
Manish G.
Reply all
Reply to author
Forward
0 new messages