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.
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.
#!/bin/bash # William Lam # www.virtuallyghetto.com NEW_OVTOOL="/Applications/VMware Fusion Tech Preview.app/Contents/Library/VMware OVF Tool/ovftool" VCSA_OVA=/Volumes/Storage/Images/Current/VMware-vCenter-Server-Appliance-5.5.0.5100-1312297_OVF10.ova ESXI_HOST=192.168.1.100 ESXI_USERNAME=root ESXI_PASSWORD=vmware123 VCSA_VMNAME=VCSA-5.5 VCSA_HOSTNAME=vcsa.virtuallyghetto.com VCSA_IP=192.168.1.200 VCSA_NETMASK=255.255.255.0 VCSA_GATEWAY=192.168.1.1 VCSA_DNS=192.168.1.1 VM_NETWORK="VM Network" VM_DATASTORE=mini-local-datastore-1 ### DO NOT EDIT BEYOND HERE ### "${NEW_OVTOOL}" --acceptAllEulas --skipManifestCheck --X:injectOvfEnv --powerOn "--net:Network 1=${VM_NETWORK}" --datastore=${VM_DATASTORE} --diskMode=thin --name=${VCSA_VMNAME} --prop:vami.hostname=${VCSA_HOSTNAME} --prop:vami.DNS.VMware_vCenter_Server_Appliance=${VCSA_DNS} --prop:vami.gateway.VMware_vCenter_Server_Appliance=${VCSA_GATEWAY} --prop:vami.ip0.VMware_vCenter_Server_Appliance=${VCSA_IP} --prop:vami.netmask0.VMware_vCenter_Server_Appliance=${VCSA_NETMASK} ${VCSA_OVA} "vi://${ESXI_USERNAME}:${ESXI_PASSWORD}@${ESXI_HOST}/"
Here is an example output of running the script and deploying the VCSA directly onto my Mac Mini running ESXi 5.5u1:
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:
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 🙂
VirtualJMills says
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 🙂
Rishabh Shukla says
Hello William
Can you tell me what version of ovftool you used for this --X:injectOvfEnv --powerOn options ?
William Lam says
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
Rishabh Shukla says
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
William Lam says
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 🙂
Rishabh says
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
Rishabh says
I meant standalone ESX server when I said vSpeher server.
Raphael Bertozzi says
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!
Raphael Bertozzi says
*them, *ESXi ...sorry, I'm in a hurry
Richard Sillito says
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
Rufus says
Is there a way to inject properties such as , , , , etc using a script or the ovftool?
Webrock says
HI Raphael,
Have you found solution to your problem ?
Mary says
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?
William Lam says
No there's not, but of course you can script to be able to do this and put it into a simple for loop 🙂
Hruthvik says
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:[email protected]
Opening OVA source: /vmfs/volumes/datastore1/vmc3.409.ova
The manifest validates
Opening VI target: vi://[email protected]:443/
Deploying to VI: vi://[email protected]: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
William Lam says
The ovftool is meant to be run outside of the ESXi host
tgbauer says
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.
Dina says
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
Dina says
Thanks for a great article BTW
Dina says
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@[email protected]
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://[email protected]:443/
Deploying to VI: vi://[email protected]: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 😉
William Lam says
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 ...
Uday Singh says
It failed syntactically..:(
Error: Unexpected option: --prop:vami.DNS.VMware_vCenter_Server_Appliance=10.254.36.42
Completed with errors
Abhishek Kulkarni says
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.
Ankit says
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.
William Lam says
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
Ankit says
Yes it was for DHCP address.
Thanks that option worked.
Doug says
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
swayam says
Hi How to use this option --nic:,=,,,.
can you please share sample usage
madddy says
the IP is getting assigned with the IPv6 address , eventhough i have specified various options like --ipProtocol=IPv4 and IPAllocationPolicy as fixed.Please let me know
gopalagrawal says
Hi William ... just came across your blog. I'm hopeful this will be the solution that works for me. I'm running a ESXI 5.5 and had created a OVA out of one of the Ubuntu guest VMs. Now I'm trying to deploy the ova back on to this esxi using your example script. However, like many others who commented here, I too get errors similar to "OVF property with key: ‘vami.ip0.VMware_vCenter_Server_Appliance’ does not exists.". The ova does deploy but the IP address, gateway etc. do not change. I ran just "$ovftool ubuntuserver.ova" which probes the properties and there are no such properties "vami.ip0....." listed. I have also added in --ipAllocationPolicy=fixedPolicy as well hoping to set the eth0 to static IP address.
If you get any time, would appreciate a solution to this. Thanks.
ENVIRONMENT
--------------------
- ESXI 5.5
- VSphere Client 5.5 (used for exporting existing VM to ova)
- ovftool 4.2 running on linux VM in my laptop.
SCRIPT:
----------
ovftool --disableVerification --noSSLVerify \
--name=myVM \
--X:injectOvfEnv --powerOn \
--acceptAllEulas \
--datastore=datastore1 \
--diskMode=thin \
--network="VM Network" \
--ipAllocationPolicy=fixedPolicy \
--prop:vami.hostname=myVM \
--prop:vami.gateway.VMware_vCenter_Server_Appliance=10.x.x.254 \
--prop:vami.ip0.VMware_vCenter_Server_Appliance=10.x.x.150 \
--prop:vami.netmask0.VMware_vCenter_Server_Appliance=255.255.224.0 \
--X:waitForIp \
U1404_Server.ova \
vi://${ESXI_USERNAME}:${ESXI_PASSWORD}@${ESXI_HOST}
OUTPUT
-----------
.... ...
Deploying to VI: vi://[email protected] server .... :443/
Transfer Completed
The manifest validates
Powering on VM: myVM
Task Completed
Warning:
- 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.
- No manifest entry found for: 'U1404_Server-disk1.vmdk'.
Completed successfully
gopalagrawal says
Sorry ... there is no -X:waitForIp in above script. I had edited that out.
William Lam says
I'm confused ... what does the vami.*.VMware_vCenter have to do with your Ubuntu VM, if I understand correctly?
Those OVF properties are specific to the VMware VCSA appliance that we ship, its not generic for any VM you export
gopalagrawal says
Hello William
Have tried out a few more things since my last query. Had a ova of a ubuntu VM with open-vm-tools installed.
Attempt 1: I try to deploy it with
--X:injectOvfEnv
--powerOn
--prop:testprop=1234.
The VM deploys, but I get the error:
- OVF property with key: 'testprop' does not exists.
Inside the guest VM, I verify with "vmtoolsd --cmd "info-get testprop" and it says "invalid key". So clearly nothing was sent across to the VM.
This is similar to what many others are reporting on this blog. In one of your responses to Mr. Rishab, you asked "Did you add this custom property in to the OVF?". Ok, so I need to add this property to the OVF. After lots of googling, finally found the COT tool to edit OVF/OVA. I add the property to the OVA:
cot edit-properties ubuntuserver.ova -p testprop=1234 --user_configurable
It now correctly shows the injected property in the ova file:
#cot info ubuntuserver.ova
...
Properties:
"1234" <-- inserted property shows up.
...
Attempt 2: I deploy the ova (with the injected property) with same ovftool command. This time no VM deploys and I get error:
Error: OVF Package is not supported by target:
- Line 148: Unsupported element 'Property'
Completed with errors
After lots of googling, I find a post: https://blogs.vmware.com/vapp/2009/07/commandline-ovf-deployments-.html
which basically says that we CANNOT deploy OVA's "with custom properties" to ESXI hosts directly. It can only be deployed via vcenter server. But that is also a older (2009) post. Your blog here says we can now indeed deploy such OVA's. So pretty sure I (and others here) must be doing something wrong or understanding the meaning of "properties" differently.
Thanks for any advice or course-corrections you can suggest.
rgds
GA
Jordi says
Hello!
Great posts William,
following them and the User Guide seems fine but I want to change the memory size (--memorySize:) and CPU (--numberOfCpus, --coresPerSocket:, etc) that come by default in the .ova file but when the VM is created it has those default values.
Best Regards
Jordi
Rishab Mehta says
Hey William,
I work for a network security company and we build a product in appliance format. Right now the appliance is in an OVA format and once deployed we have to carry out a few manual steps. I would like to automate the process to do the same.
I have edited the OVA file to ask for the parameters and they work perfectly when i deploy the new OVA.
Now i have created a shell script that I plan to run to automate those first time configuration steps.
2 questions for you
How can I enable OVF ENV properties for VMware Tools to access them? right now after deployment, I have to manually enable them in the VM properties.
How can I run this shell script just after the appliance is deployed and never again? Our Appliance is a Ubuntu 16.04 64 bit VM with our product running on top of that.
Thanks
Rishab
Mahendra Kamble says
after installing VM on esxi using ovftool, can we retrieve properties of that vm. i am retrieving but i didn't get it.
vmprop = vmobj.config.vAppConfig.property (it returns "None")
but if i installed VM through vcenter it will returns properties
Richard Chu says
Maybe we install vCSA via using './vcsa-deploy install --accept-eula --no-esx-ssl-verify
You can find the json template file in the vCSA installation ISO.
rama says
We are in process of deploying Centos-7.4 with Ovftool by using below command, which works fine to deploy a VM. The problem is ovftoll not mapping networks and properties specified. We are able to see the properties configured in vApp but not reflecting inside VM. The vmware tools status showing as (running 3rd party independent). is this the problem? Please help us with resolution.
/usr/lib/vmware-ovftool/ovftool.bin -q --overwrite --powerOffTarget --powerOn --acceptAllEulas --skipManifestCheck --net:web_vlan=Prod_Nw --net:Netapp_vlan=Str_Nw --diskMode=thin --datastore=PRD-CLU01 --name=prdvm14 --vmFolder=PRD/V2 --prop:fqdn=prdvm14.company.colo --prop:dns_0=10.11.18.250 --prop:dns_1=10.11.18.251 --prop:dns_2=10.11.18.252 --prop:web_ip=10.11.21.14 --prop:nm_web=255.0.0.0 --prop:gw_web=10.11.21.2 --prop:ip_storage=10.11.88.100 --prop:nm_storage=255.0.0.0 http://prdrep01/centos/7.4/ova/centos-7.4.ovf vi://admin:[email protected]/PROD/host/Cluster01/Resources/
Prabhu G says
Hi William,
I am trying to deploy VM on a ESXi host. Im using this command. ./ovftool.exe --name="TestVM-2" --X:injectOvfEnv --powerOn --acceptAllEulas -ds=datastore1 -dm=thin --X:enableHiddenProperties --noSSLVerify --machineOutput --prop:vami.dns1.ESRS=10.11.12.22 --prop:vami.dns2.ESRS=10.11.12.23 --prop:vami.gateway.ESRS=192.168.10.1 --prop:vami.ip0.ESRS=192.168.10.100 --prop:vami.netmask0.ESRS=255.255.254.0 --prop:"vami.timezone.ESRS"="America/Merida" --prop:"vami.ntp.ESRS"="10.10.45.34" --prop:"vm.rootpw.ESRS"="VMwar3!!" $newovf vi://root:[email protected]
The VM is getting deployed successfully, but the properties which i have feeded is not taken. The VM is deployed with NO properties. Any help will be appreciated. I'm using ovftool version 4.2
ahil kanna says
Hello Everyone,
I also faced the issue where ova deployment threw a warning '- OVF property with key: 'x.x' does not exists.'. Figured out the cause.
We should EXPORT OVA from VCENTER and NOT from ESX. Only then properties will be exported. 🙂