One of my biggest pet peeve when it comes to deploying the VCSA (vCenter Server Appliance) and other OVF/OVA directly onto an ESXi host is the lack of OVF property support. If you have deployed the VCSA before, you are probably aware of the different user experience when deploying to a vCenter Server versus deploying directly to an ESXi host. For those of you who are not familiar, the difference is when you deploy an OVF/OVA that contains custom OVF properties such as the VCSA, you have the ability to provide input to these parameters when deploying to a vCenter Server as seen in the screenshot below.

ovftool-inject-ovf-0
However, when you deploy to an ESXi host (which is a common use case for greenfield deployments), you will notice that these OVF properties are not available. So, why are the OVF properties missing when deploying to ESXi? The simple answer is that the vCenter Server has a database.

OVF properties work by being injected into the Virtual Appliance through VMware Tools and into the OVF run time environment when a Virtual Appliance is powered on. If a user decides not to power on the Virtual Appliance immediately after deployment, the OVF properties and their values must be persisted. For vCenter Server, we have a database in which we can store the OVF properties, but for ESXi a database does not exists which can properly store the OVF properties and this is why they are not been supported by ESXi.

UPDATE (10/22) - ovftool 4.0 has been officially released. You can download it here.

The good news is that a solution has been in the works and you can actually get a sneak peak and try it out if you have either the recent VMware Fusion 2014 or Workstation 2014 Tech Preview installed. The solution was to add a new ovftool parameter called injectOvfEnv. As the name suggest, it allows the injection of OVF property values into a Virtual Appliance during power on. I have known about this solution for some time but it was only available in an unreleased version of ovftool. Since VMware Fusion and Workstation automatically bundles ovftool, I was curious if they would include the upcoming version and it looks like they did! πŸ™‚

So now, instead of having to use the VAMI commands to setup the networking for a greenfield deployment with VCSA, you can simply add the following two parameters: --X:injectOvfEnv --powerOn along with the list of OVF property values.

I have created a simple shell script called deploy_vcsa.sh to demonstrate this functionality and you can easily create an equivalent BAT or PowerShell script for a Windows environment. You will need to modify the variables in the script to match your environment and they should all be pretty self-explanatory.

Here is an example output of running the script and deploying the VCSA directly onto my Mac Mini running ESXi 5.5u1:

ovftool-inject-ovf-1
Once the VCSA is fully booted up, we can take a look using the vSphere C# Client that it contains the IP Network information we provided through the OVF properties:

ovftool-inject-ovf-2
As you can see this new version of ovftool works without requiring anything special on the ESXi host and should technically work for the last several releases. I think this is a pretty good reason to check out the latest Fusion and Workstation Tech Previews πŸ™‚

28 thoughts on “How to finally inject OVF properties into VCSA when deploying directly onto ESXi?

  1. Amusingly I black-boxed this yesterday using a slightly different methodology:

    I set guestinfo.ovfEnv with the finished OVF Environment XML blob properly escaped in the .vmx file, then performed a vim-cmd vmsvc/reload operation, prior to first power-on of the VCSA. I didn’t come across your post until this morning. πŸ™‚

    Proper escaping means:
    double-quote is represented as vertical-pipe-character number-two number-two
    next line is represented as vertical-pipe-character number-zero uppercase-A

    -that JMills πŸ™‚

  2. Hello William
    Can you tell me what version of ovftool you used for this –X:injectOvfEnv –powerOn options ?

    • ovftool 4.0, this was mentioned in the article πŸ™‚ You can get it by downloading either the latest Tech Preview of VMware Workstation / Fusion, again this is mentioned in the article

      • Hi William
        Another question. Can we inject a new property into OVF using this method say for example something like following:

        –prop:Property1=”ite”

        In your example, you have involved preexisting (??) properties like –prop:vami.netmask0.VMware_vCenter_Server_Appliance but I have a different use-case where the property I want to inejct is something that I have created myself.

        The reason I ask is that when I tried above with ovftool command, I got this error :

        Warning:
        – OVF property with key: ‘Property1’ does not exists.
        Completed successfully

        I am using the latest tools as can be seen here on my Ubuntu Box:

        [root@dhcp~] CLIENT $ ovftool –version
        VMware ovftool 4.0.0 (build-1944234)

        Any help in this regard would be deeply appreciated.
        Thanks

        • Did you add this custom property in to the OVF? because the error message states you do not have a property called “Property1”, so if that’s the case the error is expected πŸ™‚

          • Hi William
            Thanks for replying. That’s actually the point. I want to build a generic OVF that can be deployed for both Standalone vSphere Server (because Property field is not supported ) and vCenter server. If I add the property, the OVA can no longer be deployed on a standalone vSphere server. And so I am not adding it, but rather while deploying it on vCenter, I am injecting the same property using ovftool. Is that something supported in 4.0 or am I taking it wrong i.e. you need to have the property in ovf, and just inject the value of it during deployment, instead of injecting the property itself.

            Rishabh

  3. Hello,
    William,

    Error: Failed to read from file: VMware-vCAC-Appliance-6.0.1.1-1768531_OVF10.ova
    Completed with errors

    I’ve check the path to ovftool and it’s valid (same path that yours):
    VMware ovftool 4.0.0 (build-1941623)

    My ESXo (5.5) it’s up and running (I’ve checked the IP address and authentication as well – working fine) and I’ve tried with others OVAs (vcac identity and etc) and the OVA files aren’t corrupted in fact I’ve tested then as well (they are deploying, just fine and the MD5 hash is the same).

    I need to assign hostname and IP configurations to vCAC Identity in Deploying time, then I’ve found your tutorial…

    Thanks from Brazil, your blogs is awesome and very useful indeed!

  4. Hi William

    Good post… I used this info and made a quick and dirty powershell script…

    $ovftool=”C:\Program Files\VMware\VMware OVF Tool\ovftool.exe”
    $vcenteripAddress=”10.4.3.21″
    $vcenternetmask=”255.255.0.0″
    $vcenterdatastore=”iSCSI-VMs-NAS02″
    $vcenterDNS=”10.4.5.20″
    $vcentergateway=”10.4.0.1″
    $vcenterhostname=”srvvcnt02.provider.priv”
    $vcenterdiskmode=”thin”
    $vcenternetwork= “VM Network”
    $vcenterovfile=”G:\\Software\\VMWare\\Products\\vSphere\\vSphere55U2\\VMware-vCenter-Server-Appliance-5.5.0.20200-2183109_OVF10.ova”
    $vcenterhost=”10.4.3.14″

    $option = ”
    $option += ” –X:injectOvfEnv –powerOn”
    $option += ” –prop:vami.ip0.VMware_vCenter_Server_Appliance=”+$vcenteripAddress
    $option += ” –prop:vami.netmask0.VMware_vCenter_Server_Appliance=”+$vcenternetmask
    $option += ” –datastore=”+$vcenterdatastore
    $option += ” –prop:vami.DNS.VMware_vCenter_Server_Appliance=”+$vcenterDNS
    $option += ” –prop:vami.gateway.VMware_vCenter_Server_Appliance=”+$vcentergateway
    $option += ” –prop:vami.hostname=”+$vcenterhostname
    $option += ” –diskMode=”+$vcenterdiskmode
    $option += ” –acceptAllEulas ”
    $option += ” –network=”+'”‘+$vcenternetwork+'”‘
    $option += ” “+$vcenterovfile
    $option += ” vi://root:xxxxxxx@”+$vcenterhost

    & cmd /c ‘”‘$ovftool'”‘$option

  5. Instead of using ovftool to export a specific vm in a datastore to a template, is there a way to feed the ovftool a wildcard so that it automatically exports all the VMs in a specified datastore to OVFs?

  6. Hi William,

    Thanks for the good post. For some reasons I cannot use the bash script to completes this. I am doing this manually by running below command. And it gives me the key does not exist in VOF error. Could you please help t understand this and make it work?

    [root@esxi ~]# /vmfs/volumes/datastore1/vmware-ovftool/ovftool -dm=thin -ds=datastore1 -n=myvmhost –X:injectOvfEnv –powerOn –acceptAllEulas –ipAllocationPolic
    y=fixedPolicy –prop:vami.gateway.VMware_vCenter_Server_Appliance=172.129.133.1 –prop:vami.ip0.VMware_vCenter_Server_Appliance=172.119.133.209 –prop:vami.netmask0.VMwar
    e_vCenter_Server_Appliance=255.255.0.0 /vmfs/volumes/datastore1/vmcm2.3.4.5.ova vi://root:vm098@172.119.133.201
    Opening OVA source: /vmfs/volumes/datastore1/vmc3.409.ova
    The manifest validates
    Opening VI target: vi://root@172.119.133.201:443/
    Deploying to VI: vi://root@172.119.33.1201:443/
    Transfer Completed
    Powering on VM: myvmhost
    Task Completed
    Warning:
    – OVF property with key: ‘vami.gateway.VMware_vCenter_Server_Appliance’ does not exists.
    – OVF property with key: ‘vami.ip0.VMware_vCenter_Server_Appliance’ does not exists.
    – OVF property with key: ‘vami.netmask0.VMware_vCenter_Server_Appliance’ does not exists.
    Completed successfully

  7. For those of us with complex passwords there is a need to change the special characters into Hex ASCII codes that work as part of a URL. For example, if you have a “!” in your password it needs to be “%21” in the script.

  8. Hi Again William

    Is it possible to export the VM with the (in other words include) extended properties from the ESXi host .

    For example I have done the following :
    1. Extract the OVA file from VCSA installation CD.
    2. Deploy it to ESXi Host using c# client.
    3. Added the guestinfo lines to the .vmx file.
    Did not power on.

    After this in order to try have a master template I exported the VM to a ,OVF using the c# client.

    Sadly the exported template does not contain the extended settings.

    So this begs the question … How can these settings be bundled into the deployed .OVF ?
    Should I be using OVFTOOL from the command line ? And if so how ?

    I assume the same would happen when exporting from with Workstation using the gui ?

    I have seen your posts for using (–X:injectOvfEnv –powerOn along with the list of OVF property values.)
    BUT what’s not clear is how to use this to set the guestinfo properties as I see you too used the VAMI properties.

    I would really appreciate any tips with this.

    Dina

  9. Just a few tips for anyone running this with vsphere 6 update 1, and using ovftool 4.1 :
    The command :
    C:\Program Files\VMware\VMware OVF Tool>”c:\Program Files\VMware\VMware OVF Tool
    \ovftool.exe” –acceptAllEulas –skipManifestCheck –X:injectOvfEnv –powerOn –
    -diskMode=thin -ds=datastore1 -n=vcva01 –prop:vami.hostname=vcva01.vmware.local
    –prop:vami.DNS.VMware_vCenter_Server_Appliance=192.168.1.253 –prop:vami.gatew
    ay.VMware_vCenter_Server_Appliance=192.168.1.1 –prop:vami.ip0.VMware_vCenter_Se
    rver_Appliance=192.168.1.200 –prop:vami.netmask0.VMware_vCenter_Server_Applianc
    e=255.255.255.0 f:\test\vmware-vcsa.ova “vi://root:P@ssw0rdvmware123@192.168.1.1
    51”

    The ovftool output:

    Opening OVA source: f:\test\vmware-vcsa.ova
    The manifest does not validate
    Enter login information for target vi://192.168.1.151/
    Username: root
    Password: ********
    Opening VI target: vi://root@192.168.1.151:443/
    Deploying to VI: vi://root@192.168.1.151:443/
    Transfer Completed
    Powering on VM: vcva01
    Task Completed
    Warning:
    – OVF property with key: ‘vami.hostname’ does not exists.
    – Skipping monitor as the –X:waitForIp option is not given.
    Completed successfully

    @ William ..NOTICE the vami.hostname error ?
    Is there a fix/solution for this ?

    And after final installation on the appliance screen :

    Root password is not set
    vmdir.password is not set …aborting intsallation

    Hope that helps anyone battling here in some way πŸ˜‰

    • Did you even look at the documentation/references I mentioned in my last reply? From your comments, it does not seem so.

      In fact, in the ovftool documentation there’s an explicit example on how to properly deploy VCSA 6.x directly to ESXi using ovftool not to mention I’ve written several articles with explicit details as well. I’ve already mentioned in my last post on how to obtain OVF properties of a given OVF/OVA and there is also some details about this in the ovftool docs. I would really encourage you to spend some time actually going through and reading the articles …

  10. It did not work for me. I got the following errors. Static IP address is not reflected after VM is powered on.

    – OVF property with key: ‘vami.gateway.VMware_vCenter_Server_Appliance’ does not exists.
    – OVF property with key: ‘vami.hostname’ does not exists.
    – OVF property with key: ‘vami.ip0.VMware_vCenter_Server_Appliance’ does not exists.
    – OVF property with key: ‘vami.netmask0.VMware_vCenter_Server_Appliance’ does not exists.

  11. Hi Willam,

    Thanks for this useful article it is really helpful for newbie like me in vmware world.

    I am successfully able to delpoy an ova package using this tool.

    Pardon my ignorance if this is a basic question:
    Is there any way I can get the IP of the deployed ova using the ovftool … I have searched a lot but not able to find any solution.

    • I assume you’re asking for DHCP, given Static, you would know the address πŸ™‚

      You can specify –X:waitForIp which will wait for VMware Tools to load up and it’ll print out the IP Address

  12. How do I figure out what my “VMware_vCenter_Server_Appliance” value is? I had read that it was the Instance ID when I run the ovftool with no parameters, but that is not the answer. How can I find this value?

    Also is there a way to overwrite existing VMs, or delete existing VMs through this tool?

    Thanks,
    Doug

Thanks for the comment!