Home > Blogs > VMware vApp Developer Blog


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 on
ly. 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.

18 thoughts on “Command-line OVF Deployments

  1. Mike Laverick

    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

  2. Rene W. Schmidt

    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

  3. Divyen Patel

    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

  4. Rene W. Schmidt

    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

  5. Divyen Patel

    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

  6. Divyen Patel

    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

  7. Endre Sara

    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

  8. Endre Sara

    Rene,
    I just found the –name option, which does exactly what I needed. I am all set, as I said, great tool!
    Endre

  9. jbarkley

    I am in the same boat as Divyen: I want to deploy an OVF directly to an ESX server and am encountering the ‘Property’ unsupported error message.
    I realize this isn’t supported, but the behavior sucks! I want ovftool to ignore the property tags and deploy it anyway. After all, property tags are a valid part of the OVF spec, so it is reasonable to expect users to encounter OVF files with these tags.
    Is there a –disableStrictChecking option somewhere I don’t know about? Or am I expected to go into every OVF file I’m ever given and strip out the property tags if I want to use ovftool? Kind of defeats the purpose of automation….

  10. renes

    The OVF standard is designed so the OVF package author is in charge of specifying what OVF sections are important to ensuring a correct deployment (ie., a deployment where the application actually works afterwards). Thus, if the OVF properties are important they are marked as required using the ovf:required attribute (defaults to true). If an OVF package can be deployed correctly without using a particuar OVF section it can be marked as ovf:required=”false”.
    On the good news front, in the upcoming OVF Tool 2.0 release, we do support a –lax mode flag, which (among other things) makes OVF Tool interpret all sections as ovf:required=”false”.
    Note: OVF Tool 2.0 is already bundled with the latest versions of VMware Workstation and VMware Fusion.
    /Rene

  11. Shauni

    Hi Rene-
    I attended you VMworld talk on OVF and vApps and was wondering whether the actual xml for the example vApp you used in the demo (and in the blogpost above) is available somewhere, namely the SugarCRM OVA or OVF files. We’re trying to do similar things with ovf:properties and specifying options in vSphere for our own vApps as you did with the “themes” in your demo and an example of the raw XML would be very helpful.
    Thanks,
    shauni

  12. ben

    I have a OVF with a dozen deploymentOptions, is there a way I can convert this multi-purpose OVF into just one of the options ? I dont understand the –deploymentOption flag and cant find examples. (note, my vSphere interface does not give me the option of selecting the deploymentOptions, so I need to effectively remove the options and just have one (hope makes sense) BEFORE uploading to cloud.

  13. Rene W. Schmidt

    Hi Ben,
    I assume you mean dozen of OVF properties. If I understand your question right, you want to create an OVF that has no OVF properties (e.g., customized with a specific set of OVF propertty values), so it can be uploaded to vCloud Director?
    The good news is that you no longer need to worry about that, as the just released vCloud Directory 1.5 does support OVF properties directly.
    If you don’t want to prompt for all of the properties in the UI, you can use the ovf:userConfigurable=”false” attribute on the element.
    BTW, The OVF Whitepaper [1] has an example of a deployment option (see section starting on line 491)
    [1] http://www.dmtf.org/sites/default/files/standards/documents/DSP2017_1.0.0.pdf

  14. Andy

    I got the following error when i tried the first step “ovftool –hideEula ”
    ‘Error: Failed to open OVF descriptor’
    Does this mean the the ovf is missing something? Could you please throw some light on this?

  15. Rene W. Schmidt

    > Can I use ovf tool to deloy ovftemplate on ESXi server?
    Yes. Simply use the hostname/IP address of the ESX server, e.g.
    ovftool MyGreatApp.ovf vi:///
    Note that an ESX host does not support vApps nor OVF properties.

Comments are closed.