Automated ESXi Cisco UCS Firmware Upgrade using Powertool

I have completed a script that will allow you to put a host into maintenance mode, verify service profile based on MAC address, and then change your firmware policy.

Requirements for the Script:
Cisco Powertool 1.x or later
Vmware Powercli 5.x or later
Maintenance Policy is User Ack
Ensure your VMNIC0 is matched up with your first Vnic template in order.

In line 34 you will need to modify the hardcoded VNIC to whatever you have named as your 1st PCI vnic on your Service Profile Template. This also assumes you have connected to UCS manager in a Powertool window.

Now for the script!
Read more of this post

Advertisements

ESXi Kickstart while completely ignoring remote disks

Ever worried that your kickstart install might accidentally overwrite your SAN luns?  There are a couple of options around this, but I prefer the option  where you don’t have to involve your SAN team. Now, this won’t work if you are booting from SAN as you will need your HBA driver. I will be testing how to and ignore any non boot luns on a boot from SAN scenario hopefully in the near future.

This article assumes you already are familiar with the kickstart process.

Option 1: For all hosts you want to run a kickstart installation on, ask your SAN team to unmask the luns to this host and then remask when the host is finished upgrading. Or have cables unplugged and plugged back in.

Option 2: Remove your HBA driver from your image using PowerCli ImageBuilder and then reinstall driver using your %firstboot script and a web server.

In order to do Option 2, you will need to have the following components downloaded:
1. Powercli (preferably the latest version)
2. Offline Bundle for the ESXi installation from Vmware’s downloads page. (will be in .zip format). This is where you will get the vib to reinstall either during kickstart or after install.

Let’s get started!

Part I – Create ISO with no FC driver using PowerCLI Image Builder

1. You can determine what your HBA driver is by SSH’ing into one of your current hosts and running this command: esxcli storage core adapter list.

FC_driver
2. Now, we will be creating the new ISO that has the FC driver removed.
3. Login to an existing host and determine what the driver is for your HBA. In our case it is the lpfc driver.
4. Open Powercli and cd to the working directory.
5. Add the online software depot from Vmware which will contain the ESXi Images: Add-EsxSoftwareDepot https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xmladd-depot
6. Get a list of Images from the depot: Get-ESxImageProfile |Select Name,CreationTime|Sort CreationTime.

get-profile
7. Create a new profile to work on: New-EsxImageProfile –CloneProfile ESXi-5.1.0-20130504001-standard –Name “Test”.

new_profile
8. You can search for all the drivers in the image by doing Get-ESXSoftwarePackage. Search for the driver your HBA uses. Normally, this will be the scsi-lpfc driver.
9. You can then remove the driver: Remove-EsxSoftwarePackage –imageprofile Test –SoftwarePackage scsi-lpfc820.remove_fc
10. Now, export your new ISO without the FC driver: Export-ESXImageProfile –ImageProfile “test” –ExporttoIso .\No_HBA.iso

export_iso

Part II – Make VIB available

1. Copy your ESXi offline bundle into the directory you want to work in. This includes the ESXi installation and the driver for your HBA.
2. Extract the fibre channel lpfc .vib from the offline bundle. It should be under the vib sub directory.
3. Place this .vib in an accessible web server either in IIS or apache so that your kickstart post install can reinstall the driver.

Part III – Reinstall FC driver during Kickstart

1. In your kickstart file, add this line to your %firstboot file to install the FC vib from your web server:
#Install FC driver
esxcli software vib install -v http://webserver/VMware_bootbank_scsi-lpfc820_8.2.3.1-127vmw.510.0.0.799733.vib
2. Boot to your new ISO with the HBA removed.
3. Run your normal kickstart install and you now no longer have to worry about accidentally overwriting a lun!

VisualESXtop Installation/Usage

So, I was reading the tech blog o’ sphere recently and came across a fling I’d heard a bit about, but hadn’t really looked at. I just recently downloaded it and I have to say it is pretty cool for a V1 release.

The VMware Fling I am talking about is: Visual ESXTop

What is Visual ESXtop? It is a java based gui that will give you real time data just like ESXTOP without having to use resxtop on yoru VMA or directly onto the host. That’s right, you can run this from your linux or windows desktop.

Where can I get it? http://labs.vmware.com/flings/visualesxtop

How do I run it? First, extract the folder to the directtory of your choosing. On windows, you will need java (1.6) although I got it working with 1.7 and you need to put java into your path Variable.

Read more of this post

Running Dell DSET Remotely on ESXi 5.1 / 5.5

UPDATE: These instructions do work for ESXi 5.5 U1

These instructions will allow you to get a DSET for ESXi from the command line of a windows server.  In order to do this, you will need to have your Dell OMSA VIB package installed.  For 5.1 the current version is 7.2 at the time of this writing.  The package can be found here:  http://www.dell.com/support/drivers/us/en/19/driverdetails?driverid=MMPDK

Next, you will need to download the Dell Windows DSET utility which can be found here: http://www.dell.com/support/drivers/us/en/19/driverdetails?driverid=44rty .  Once downloaded, run the installer and install the DSET Collector.
Open the CLI from your program files per screenshot below.

dset-1

At the command prompt enter this line and it will prompt for password: C:\Program Files (x86)\Dell\AdvDiags\DSET\bin>DellSystemInfo.exe -s HOSTNAME -u root -d hw -n root/dcim/sysman -r dset-name.zip   .  I have seen issues if your password has special characters at the beginning.  So, if it keeps failing try changing root to something different and then change back after collection.

dset-3Dset will collect information and put it into a filename that was specified in the command to your Desktop or you can point it to where you want it exported to.

dset-2

Upload your DSET and troubleshoot your issues!

Automating ESXi Host Profile and Answer File with Powercli

Recently we have had an influx of hosts that need to be built out and I am trying to automate as much of the process as possible.  In this post will go over how the answer file works.  Next post I will talk about passing a CSV file to do multiple hosts.  Unfortunately, we do not use DHCP, PXE or Autodeploy so we have to have some manual input for both the install phase and the host profile phase.  So far, I have not found too much information out there on doing this so I have been doing some digging of my own.

Using the great Vmware Vsphere Powercli Reference book, by LucD, Alan Renouf I took their section on automating esxi deploys and tailored it to our needs.  The hardest part is that for our host profile there were answers that the host profile needed.   Namely, Management IP for the 1000v (DVS), VMotion address, and Subnet masks.

Using the Cmdlet Apply-VMHostProfile we are able to get the hash table keys that your host profile needs for input.

For example attach your host profile to your host: Apply-VMHostProfile -profile $profilename -entity $VMhost -AssociateOnly

You can then find out find out what keys are needed for your host profile.  In our case I have disabled the isci parameter and the MAC address parameter  so the only need information will be for our 1000v DVS which we have not added these hosts to yet.  To disable asking for a mac address you can follow this guide: http://blogs.vmware.com/vsphere/2013/03/how-to-prevent-host-profiles-from-prompting-for-mac-addresses.html

$AdditionalConfiguration = Apply-VMHostProfile -profile $profilname -entity $VMHost -ApplyOnly -confirm:$false

The out put will look like below, which as you can see with the key names so long you can’t get the whole key.

PowerCLI U:\powercli\hostprofile> $AdditionalConfiguration.GetEnumerator()| select Name

Name
—-
network.dvsHostNic[“key-vim-profile-host-DvsHostVnicProfile-VSM03–management-management…
network.dvsHostNic[“key-vim-profile-host-DvsHostVnicProfile-VSM03–vmotion-vmotion”].ipC…
network.dvsHostNic[“key-vim-profile-host-DvsHostVnicProfile-VSM03-vmotion-vmotion”].ipC…
network.dvsHostNic[“key-vim-profile-host-DvsHostVnicProfile-VSM03-management-management…
network.dvsHostNic[“key-vim-profile-host-DvsHostVnicProfile-VSM03-vmotion-vmotion”].Mac…
network.dvsHostNic[“key-vim-profile-host-DvsHostVnicProfile-VSM03-management-management…

A better output would be to pipe the output to a list:

$AdditionalConfiguration.GetEnumerator()| fl

Once you have the key names, you can then create an answer file.  To create an answer file run the first command and apply it to a variable which is a hash table

$AdditionalConfiguration=Apply-VMHostProfile -profile $profilname -entity $VMHost -ApplyOnly -confirm:$false

From here there are 2 options.  You can either assign the hashtable values manually or you can create a new hash table using wildcards for the key name and assign your variables. Once, you have your hash table created you can apply the host profile.  I did have an issue where if you don’t answer all the questions needed it will not apply the host profile it will just print out your keys and values plus the empty ones.

Assigning directly:

$AdditionalConfiguration[‘network.dvsHostNic[“key-vim-profile-host-DvsHostVnicProfile-SVD-VSM03-management-management”].ipConfig.IpAddressPolicy.address’] = “10.10.10.10”
$AdditionalConfiguration[‘network.dvsHostNic[“key-vim-profile-host-DvsHostVnicProfile-SVD-VSM03-management-management”].ipConfig.IpAddressPolicy.subnetmask’] = “255.255.255.0”
$AdditionalConfiguration[‘network.dvsHostNic[“key-vim-profile-host-DvsHostVnicProfile-SVD-VSM03-vmotion-vmotion”].ipConfig.IpAddressPolicy.address’] = “10.10.10.11”
$AdditionalConfiguration[‘network.dvsHostNic[“key-vim-profile-host-DvsHostVnicProfile-SVD-VSM03-vmotion-vmotion”].ipConfig.IpAddressPolicy.subnetmask’] = “255.255.255.0”

Or create a switch and looking for a wildcard for your variables that need answers:

$var = @{}
switch ($AdditionalConfiguration.GetEnumerator())
{
{$_.name -like ‘*management*.address’ }    {
$var += @{$_.Name = “10.10.10.10”}
}
{$_.name -like ‘*management*.subnetmask’}    {
$var += @{$_.Name = “255.255.255.0”}
}
{$_.name -like ‘*vmotion*.address’}    {
$var += @{$_.Name = “10.10.10.11”}
}
{$_.name -like ‘*vmotion*.subnetmask’}    {
$var += @{$_.Name = “255.255.255.0”}
}
{$_.name -like ‘*vmotion*.mac’}    {
$var += @{$_.Name = “”}
}
{$_.name -like ‘*management*.mac’}    {
$var += @{$_.Name = “”}

Depending on whichever method you used you could run either of these commands to actually apply your profile. Your host must be in maintenance mode first and we can go over how to automate that in the next post.

Apply-VMHostProfile -Entity $hostname -Variable $var -Confirm:$false

Apply-VMHostProfile -Entity $hostname -Variable $AdditionalConfiguration -Confirm:$false

I have part 2 linked below that shows how to pass a csv file with the information and apply profiles to hosts:

Automating ESXi Host Profile and Answer File with Powercli (Part 2)