Command-line OVF Deployments
In the previous blog post, I showed how to deploy a multi-tiered OVF package using the Deploy OVF Template Wizard in the vSphere Client. The interactive workflow provided by the vSphere Client is hard to beat in terms of ease of use and simplicity. However, the graphical user interface also has it drawbacks. In particular, it can be fairly cumbersome to use if you have a large set of similar OVFs that needs to be deployed, or you want to automate a deployment. In those cases, a command-line utility is often preferred. Well, we have exactly the solution for that: OVF Tool 1.0.
OVF Tool provides a slew of different features, such as converting between OVF and .vmx formats and import/export of OVF 1.0 to vSphere 4.0, VirtualCenter 2.5/ESX 3.5 and earlier releases.
In the following I will show how to deploy the SugarCRM solution from the command-line and get exactly the same result as I got from the vSphere Client last week.
First, I probe the SugarCRM.ova to figure out what it contains and particular what parameters can be customized.
f:\>ovftool --hideEula http://aar-ovfrepo/ovf/SugarCRM.ova
Opening OVA source: http://aar-ovfrepo/ovf/SugarCRM.ova
OVF version: 1.0
Name: SugarCRM
Version: 4.5.1e
Full Version: 4.5.1e-build 131
Vendor: SugarCRM Inc
Product URL: http://www.sugarcrm.com/crm/products/crm-products.html
Vendor URL: http://www.sugarcrm.com/crm/
Annotation: The sweet way to manage customer relationships.
End-user License Agreements:
Present: Yes (1)
Download Size: 764.49 MB
Deployment Sizes:
Flat disks: 20.00 GB
Sparse disks: 1.55 GB
Networks:
Name: Network
Description: The network that the SugarCRM application will be available on
Virtual Hardware:
Family: vmx-04
Disk Types: SCSI-lsilogic
Properties:
Key: emailAdmin
Category: Application
Label: Administrator Email Address
Type: string
Description: Enter email address for administrator. This is displayed on the help page.
Key: theme
Category: Application
Label: Theme
Type: string["Sugar", "RipCurl", "Retro", "Paradise", "Love",
"Sunset"]
Description: Select the default color/graphic scheme
Key: concurrentSessions
Category: Performance
Label: Concurrent Sessions
Type: int(10..1000)
Description: The maximum allowed concurrent sessions.
Key: dbIp
Category: Network
Label: Database instance IP address
Type: ip:Network
Description: IP address for the database instance (in dot-notation).
Key: webIp
Category: Network
Label: SugarCRM IP Address
Type: ip:Network
Description: IP address on the SugarCRM application server. The service is made accessible at this IP address.
Deployment Options:
Id: small
Label: Evaluation
Description: Use this configuration for evaluation purposes only. The number of CPUs required and amount of memory used is minimized, making it possible to run the system on a desktop system.
Id: medium
Label: Production
Description: Standard settings for a typical product environment. This deployment option is suitable for a SMB production environment with less than 500 users.
Id: large
Label: Enterprise
Description: Settings for large enterprise production environments. This deployment option is suitable for a large enterprise production environment with more than 500 users.
IP Allocation Policy:
Schemes: ovfenv dhcp
Protocols: IPv4
Completed successfully
By examining this output, I can gather the same information as was shown in the vSphere Client, such as product information, download sizes, end-user license agreements, deployment options, properties that can be customized, and supported IP policy schemes.
The next step is to deploy this to my vSphere 4.0 server. OVF Tool provides a handy pseudo-interactive mode for probing the vSphere inventory, so I do not have to open the vSphere client to look up the inventory organization or names of networks and datastores. To get started, I simply try and deploy it:
f:\>ovftool http://aar-ovfrepo/ovf/SugarCRM.ova vi://aar-dev-cluster-vc1
Opening OVA source: http://aar-ovfrepo/ovf/SugarCRM.ova
Please enter login information for target vi://aar-dev-cluster-vc1/
Username: VMWAREM\renes
Password: *********
Error: Found wrong kind of object (Folder)
Possible completions are:
aar-dev-datacenter/
Jan's Test Datacenter/
Ok, so the first completion is: vi://aar-dev-cluster-vc1/aar-dev-datacenter/. After a few more iterations, I get to this:
f:\>ovftool --acceptAllEulas http://aar-ovfrepo/ovf/SugarCRM.ova vi://VMWAREM%5Crenes@aar-dev-cluster-vc1/aar-dev-datacenter/host/Cluster/Resources/DemoPool
Opening OVA source: http://aar-ovfrepo/ovf/SugarCRM.ova
Please enter login information for target vi://aar-dev-cluster-vc1/
Username: VMWAREM\renes
Password: *********
Opening VI target: vi://VMWAREM\renes@aar-dev-cluster-vc1/aar-dev-datacenter/host/Cluster
Error: No target datastore specified
Datastores found on target:
Cluster VMFS
Storage1
It now provides completions for datastores. Simlilarly, OVF Tool will provide completions for networks (if there are multiple choices). The final command to deploy, customize, and power-on the SugarCRM OVF package is:
f:\>ovftool "--datastore=Cluster VMFS"
"--network=VM Network"
--acceptAllEulas
-ipAllocationPolicy=transient
--prop:emailAdmin=admin@vmware.com
--prop:theme=Retro
--powerOn
http://aar-ovfrepo/ovf/SugarCRM.ova
vi://VMWAREM%5Crenes@aar-dev-cluster-vc1/aar-dev-datacenter/host/Cluster/Resources/DemoPool
Opening OVA source: http://aar-ovfrepo/ovf/SugarCRM.ova
Please enter login information for target vi://aar-dev-cluster-vc1/
Username: VMWAREM\renes
Password: *********
Opening VI target: vi://VMWAREM\renes@aar-dev-cluster-vc1/aar-dev-datacenter/host/Cluster/Resources/DemoPool
Target: vi://aar-dev-cluster-vc1/aar-dev-datacenter/host/Cluster/Resources/DemoPool
Disk Transfer Completed
Powering on vApp: SugarCRM
Completed successfully
Voila! (Standard disclaimer: I inserted a few line breaks to make it more readable. How to escape spaces in parameters varies whether you are on Linux or Windows).
This was just a very quick preview of the features of OVF Tool. Consult the documentation for more examples, and download the tool today to try it out for yourself. Next time, I will dive into the internal structure of the SugarCRM OVF package.
Great Post. I would love to see how you handle using transicent IP pools - making a Windows VM grab an IP from the pool either using the ISO or the VMware Tools method. Seem's to be very little information on to do this. All I'm seeing is highlevel information - nothing step-by-step/nitty gritty or how to...
Regards
Mike
Posted by: Mike Laverick | 07/01/2009 at 06:09 AM
Hi Mike,
Thanks for the nice comment. We are planning to do a post on how to use the OVF environment to do IP assignments, how to use the IP Pool in vCenter, and so forth. I will dump the priority up on this topic. Stay tuned.
/Rene
Posted by: Rene W. Schmidt | 07/02/2009 at 03:17 AM
I am getting following error while importing OVF which has some custom properties set.
Error:
- Line 107: Unsupported element 'Property'
Do you have any idea on this?
Regards,
Divyen Patel
Posted by: Divyen Patel | 10/15/2009 at 04:02 PM
Hi Divyen,
OVF packages that contain OVF properties need special runtime support by the virtualization platform. For instance, it needs to generate the OVF environment and mount it into the virtual machines as an ISO image.
Currently, we only support this in vCenter 4. It looks like you are trying to deploy an OVF package that uses OVF properties either directly to an ESX Server or converting it to a .vmx file.
/Rene
Posted by: Rene W. Schmidt | 10/16/2009 at 01:33 AM
Thanks for the reply Rene,
Yes I am trying to deploy OVF Package which uses some OVF properties to ESX Server.
You can find OVF file at this thread.
http://communities.vmware.com/thread/237062?tstart=0
I do have VCenter and vSphere Client installed on my windows machine.
I am able to deploy the same OVF package using vSphere Cleint connecting to vCenter server, but I want to automate this process using Command line tool.
Is there a way to do this?
Regards,
Divyen Patel
Posted by: Divyen Patel | 10/16/2009 at 11:52 AM
Rene,
Thanks for the clarification. Its now working fine with the same command line tool via vCenter.
I was trying to deploy directly on ESX server before.
Thanks Its working great!
Regards,
Divyen Patel
Posted by: Divyen Patel | 10/16/2009 at 12:10 PM
Thanks for posting, I have been using ovftool, it is a great!
Do you if it is possible to deploy multiple instances of the same OVF appliance in a single VC/Datacenter (with different names)? I would like to deploy for example loadbalanced webservers from the same OVF, but with multiple instances running in parallel. Can you rename the VM as it is deployed from ovftool?
Thanks
Endre
Posted by: Endre Sara | 11/08/2009 at 06:12 AM
Rene,
I just found the --name option, which does exactly what I needed. I am all set, as I said, great tool!
Endre
Posted by: Endre Sara | 11/08/2009 at 06:23 AM