posted

28 Comments

Kyle Gleed, Sr. Technical Marketing Architect, VMware

I’ve had several requests for a brief tutorial on using the vSphere ESXi Image Builder CLI. I hope this post will help people better understand the power of the Image Builder CLI and how easy it is create and maintain custom ESXi installation images.

Before I get into using the Image Builder CLI lets review some basic terminology:

  • vSphere Installation Bundle (VIB): VIBs are the building blocks of the ESXi image. A VIB is akin to a tarball or ZIP archive in that it is a collection of files packaged into a single archive. A detailed description of a VIB can be found here.
  • Software Depot: Software depots are used to package and distribute VIBs. A Software Depot (sometimes referred to as a Software Bundle) is a collection VIBs specially packaged for distribution. There are two types of depots – online and offline. An online software depot is accessed remotely using HTTP. An offline software depot is downloaded and accessed locally.
  • Image Profile: An Image Profile is the logical collection of VMware and third-party VIBs needed to install an ESXi host. Image profiles created with the Image Builder CLI can be saved as ZIP archives or ISO files.


A quick note about working with individual VIBs vs. Software Depots.  You can download individual VIBs, and you can use the vSphere Update Manager or ESXCLI command to install them on your ESXi hosts.  However, there is no way to import a standalone VIB into an Image Builder CLI session without first packaging the VIB into a Software Depot.  So remember, when working with the Image Builder CLI you need to download the software depot (.zip) and not the individual VIBs (.vib).   

Along with the terminology it also helps to understand that the ESXi Image Builder CLI is part of PowerCLI. To install Image Builder you simply need to install PowerCLI.  PowerCLI 5.0 includes all the Image Builder cmdlets necessary to import software depots, create image profiles and add and remove VIBs in order to create custom ESXi installation images.

There are five basic steps to creating a custom ESXi installation image:

Step 1: Download the software depots.

Typically, you will start by downloading the VMware software depot from http://www.vmware.com/downloads. This depot contains the ESXi VIBs provided by VMware.

clip_image002

In addition you will need to download the pertinent software depots from your other vendors. These depots have the vendor specific VIBs that you will need to combine with the VMware VIBs in order to create your custom installation image. Here’s an example showing how to download an offline software depot from HP:

clip_image004

———————————————————————————————————-

Note: If you are using an online software depot you don’t need to download the ZIP file. You just need the URL for the depot. An example showing how to use HP’s online Software Depot is available here.

———————————————————————————————————-

Step 2: Import the software depots

Next, start your PowerCLI session and import the software depots using the “Add-EsxSoftwareDepot” cmdlet.  Import all the software depots you have downloaded.

clip_image006

Step 3: Create an Image Profile

After the software depots have been imported the next step is to create an image profile using the “New-EsxImageProfile” cmdlet. There are two ways to create a new image profile, you can create an empty image profile and manually specify the VIBs you want to add, or you can clone an existing image profile and use that as your starting point:

Creating a New Image Profile

clip_image008

Cloning an Existing Image Profile

clip_image010

 

Step 4: Add/Remove VIBs

Next, you use the “Add-EsxSoftwarePackage” and “Remove-EsxSoftwarePackage” cmdlets to add and remove VIBs to/from your image profile. In the example below I first list all the VIBs that were provided by HP and then add them to the custom profile I created by cloning the “VMware ESXi-5.0.0-20120302001-no-tools” image profile provided by VMware:

clip_image012

This is a quick example to show how to remove a package from an Image Profile:

clip_image014

 

———————————————————————————————————-

Note that each VIB contains an XML descriptor file that has information about the VIB to include any dependencies or conflicts it may have with other VIBs. When adding and removing VIBs you will need to ensure that conflicts are avoided and dependencies are met. You can use the “Get-EsxSoftwarePackage” cmdlet to identify VIB compatibility or dependency requirements.

clip_image016

———————————————————————————————————-

Step 5: Save the Image Profile

After adding the VIBs you need the next step is to export the image profile. You can export the Image Profile as a software depot (.zip) or as an ISO file (.iso).

clip_image018

You now have a custom Image Profile. You can use the ISO file to boot your new hosts and install ESXi. You can use the ZIP file with Update Manager or Auto Deploy. When new hosts are installed using the custom image profile all the VIBs you added will be installed on the host as part of the install.

For reference I’ve included a brief summary showing some of  the more common Image Builder commands below:

Image Builder CLI cmdlet Examples:

Add-EsxSoftwareDepot

PowerCLI C:> Add-EsxSoftwareDepot C:ESXi-Depotupdate-from-esxi5.0-5.0_update01.zip

Remove-EsxSoftwareDepot

PowerCLI C:> Remove-EsxSoftwareDepot zip:C:ESXi-Depotupdate-from-esxi5.0-5.0_update01.zip?index.xml

Get-EsxSoftwarePackage

 

PowerCLI C:> Get-EsxSoftwarePackage

 

PowerCLI C:> Get-EsxSoftwarePackage | where {$_.Vendor -eq "VMware"}

 

PowerCLI C:> Get-EsxSoftwarePackage net-e1000 | Select -ExpandProperty Depends

PowerCLI C:> Get-EsxSoftwarePackage net-e1000 | Select -ExpandProperty Conflicts

 

Add-EsxSoftwarePackage

PowerCLI C:> Add-EsxSoftwarePackage -ImageProfile CustomProfile -SoftwarePackage tools-light

 

Remove-EsxSoftwarePackage

PowerCLI C:> Remove-EsxSoftwarePackage -ImageProfile CustomProfile -SoftwarePackage tools-light

New-EsxImageProfile

PowerCLI C:> New-EsxImageProfile -CloneProfile ESXi-5.0.0-20120302001-standard -Name CustomProfile -AcceptanceLevel PartnerSupported

PowerCLI C:> New-EsxImageProfile -NewProfile -Name MinInstall -Vendor Custom -SoftwarePackage esx-base,esx-tboot,misc-drivers

Get-EsxImageProfile

PowerCLI C:> Get-EsxImageProfile

Compare-EsxImageProfile

PowerCLI C:> Compare-EsxImageProfile ESXi-5.0.0-20120302001-standard ESXi-5.0.0-20120302001-no-tools

Export-EsxImageProfile

 

PowerCLI C:> Export-EsxImageProfile -ImageProfile CustomProfile -ExportToIso -FilePath C:ESXi-DepotCustomProfile.iso

PowerCLI C:> Export-EsxImageProfile -ImageProfile CustomProfile –ExportToBundle -FilePath C:ESXi-DepotCustomProfile.zip

 

To get updates on future posts follow me on Twitter @VMwareESXI