Script

Deploy appliances via PowerCLI

Needed to deploy some appliances. I could have done that via a client, but it some what cumbersome and requires you to sit a wait for every step. Why not deploy appliances via Powercli? It’s easy, fast and requires only a few lines of commands.

The PowerCli cmdlet is called “Import-VApp”. The cmdlet lets you specify fields like Source, Name and OvfConfiguration. The tricky part here is to know which OvfConfiguration parameters are needed. An OVA file is just a zip file with the vmdk and configuration files in it. It can simply be opened with a tool which supports to unzip, zip files. You don’t need to extract the zip OVA file. All that is needed is the ovf file within the OVA file. The ovf file contains the configuration parameters that is going to be used as part of the deployment of the appliance. Some of them are set in stone, if you will and some of them are user configurable. The user configurable is the once we need to have a look at.

User configurable parameters can be fund by searching to ‘ovf:userConfigurable=”true”‘ in the ovf file. It just not that easy! Because we have to define the correct string for the parameter in order for it to work. As the ovf file is XML, it is structured. Although a bit annoying to read. Again search is your friend.

There a two XML clauses to be aware of ‘ovf:instance=’ and ‘ovf:class=”vami”‘. The class and instance are used together with a ‘key’. It how it structured in XML that matters. In the example below on how to deploy a vRops appliance via PowerCli. There are two strings used. {‘class’.’instance’.’key’} and {‘key’}. Its the structure of the XML file which defines how to structure the strings for the OvfConfiguration.

Below is an example of how to deploy the vRops appliance via PowerCli

Import-VApp -Source "C:\Software\VMware\vRops\vRealize-Operations-Manager-Appliance-6.2.1.3774215_OVF10.ova"`
-Name vRops01.MichaelRyom.dk`
-Datastore (Get-Datastore DSC01)`
-VMHost (Get-Cluster | Get-VMHost)[0]`
-OvfConfiguration @{
  "vami.DNS.vRealize_Operations_Manager_Appliance"="8.8.8.8,8.8.4.4";
  "vami.gateway.vRealize_Operations_Manager_Appliance"="10.10.10.1";
  "vami.ip0.vRealize_Operations_Manager_Appliance"="10.10.10.2";
  "vami.netmask0.vRealize_Operations_Manager_Appliance"="255.255.255.0";
  "vamitimezone"="Europe/Copenhagen";
  }

 

Leave a Reply

Your email address will not be published. Required fields are marked *