Featured image of post HPE Firmware Management for VMware ESXi - Server Profile Install Method

HPE Firmware Management for VMware ESXi - Server Profile Install Method

This post will show some examples of how to use VMware PowerCLI in combination with the HPE OneVew PowerShell Module to automate these tasks.

As described in my previous blog post, the firmware deployment method needs to be configured on two components. The OneView Server Profile Install Method and the HPE Smart Update Tools Install Mode. changing the HPE OneView Server Profile or updating the Server Profile from the modified Template might be a time-consuming and annoying task without proper automation. This post will show some examples of how to use VMware PowerCLI in combination with the HPE OneVew PowerShell Module to automate these tasks.

For the following explanation, I assume that the current configuration is Install Method “Manual” and all ESXi Hosts Server Profiles should be switched to Install Method “Firmware Only”.

Note:

If the HPE Smart Update Tools Install Mode is already set to “AutoDeploy, or AutoDeployReboot” the Deployment process will start right after the reconfiguration of the Server Profile Install Method. In the case you have enable the ESXi Lockdown Mode the firmware deploment will fail. For more details please have a look at the introduction to this series.

In my environment, I have prepared the next step by copying the current OneView Server Profile Template and only switching the Install Method to “Firmware Only” in the new template.

Server Profile Install Method - Copy Server Profile Template

# Script - Switch to the new OneView Server Profile Template

From my perspective, it is the most transparent procedure to switch from a Server Profile Template with the Install Method “Manual” to a new Server Profile Template with Firmware Install Method “Firmware only using Smart Update Tools”. With this procedure, you are able to monitor the progress of the reconfiguration (how many Server Profiles are assigned to the old Server Profile Template) and not all Server Profiles are raising a warning (differ from Template) at the time you change the template. Another method might be changing the current Server Profile Template and then applying the changes to all dependent Server Profiles - See next chapter.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
## Preperation
# Import VMware Modukes
Get-Module -ListAvailable -Name VMware* | Import-Module
# Connect vCenter Server
Connect-VIServer vcenter.lab.local
# Import OneView Modules
Get-Module -ListAvailable -Name HPEOneView.* | Import-Module
# Connect to OneView appliance
Connect-OVMgmt -Hostname oneview.lab.local -AuthLoginDomain "LAB.LOCAL"

## Vars
[String]$ClusterName = "lab"
[String]$NewHPESeverProfileTemplateName = "DL380-SUT"

$VMHosts = Get-Cluster -Name $ClusterName | Get-VMHost | Sort-Object name
Clear-Variable VMHost, OVServer, OVSResponse, OVServerProfile, OVServerProfiles, NewHPESeverProfileTemplate -ErrorAction SilentlyContinue


$NewHPESeverProfileTemplate = Get-OVServerProfileTemplate -name $NewHPESeverProfileTemplateName
[Array] $OVServerProfiles = Get-OVServerProfile
foreach ($VMHost in $VMHosts) {
    Clear-Variable OVServer, OVSResponse, OVServerProfile, Task -ErrorAction SilentlyContinue
    $OVServer = Get-OVServer -ServerName $VMHost.Name -ErrorAction SilentlyContinue
    if ($OVServer) {
        $OVSResponse = Send-OVRequest -uri $OVServer.uri
    }
    $OVServerProfile = $OVServerProfiles | Where-Object {$_.Uri -eq $OVSResponse.serverProfileUri}


    #region: Reconfigure Server Profile with new Template
    $OVServerProfile.serverProfileTemplateUri = $NewHPESeverProfileTemplate.uri
    $OVServerProfile.firmware.manageFirmware = "True"
    $OVServerProfile.firmware.forceInstallFirmware = "False"
    $OVServerProfile.firmware.firmwareInstallType = "FirmwareOnly"
    $Task = Save-OVServerProfile -InputObject $OVServerProfile -Async
    $Task | Wait-OVTaskComplete
    #endregion


    #region: Update Server Profile
    $Task = Get-OVServerProfile -Name $OVServerProfile.name | Update-OVServerProfile -Confirm:$false -Async
    $Task | Wait-OVTaskStart
    #endregion

    }

The script is designed to apply the changes on all Hosts of a vSphere Cluster.

You can see in the script region “Reconfigure Server Profile with new Template” that the Firmware config is updated. This seems to be redundant as already the new Profile should contain these changes. I had a few situations where the updated firmware settings in the profile had not been applied, this workaround solved that issue for me.

# Script - Update Server Profile from Template

Updating server profiles from their templates may be necessary in various situations:

  • Modified Settings in the Server Profile Template

  • New Firmware Baseline in the Server Profile Template

  • New Hardware installed with the wrong firmware

  • Error when applying settings or installing the firmware

And like the other scripts of this blog post series, it is designed to be applied to a vSphere Cluster.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## Preperation
# Import VMware Modukes
Get-Module -ListAvailable -Name VMware* | Import-Module
# Connect vCenter Server
Connect-VIServer vcenter.lab.local
# Import OneView Modules
Get-Module -ListAvailable -Name HPEOneView.* | Import-Module
# Connect to OneView appliance
Connect-OVMgmt -Hostname oneview.lab.local -AuthLoginDomain "LAB.LOCAL"

## Vars
[String]$ClusterName = "lab"

$VMHosts = Get-Cluster -Name $ClusterName | Get-VMHost | Sort-Object Name
Clear-Variable VMHost, OVServer, OVSResponse, OVServerProfile, OVServerProfiles, Task -ErrorAction SilentlyContinue

[Array] $OVServerProfiles = Get-OVServerProfile
foreach ($VMHost in $VMHosts) {
    #region: Get OneView ServerProfile
    Clear-Variable OVServer, OVSResponse, OVServerProfile -ErrorAction SilentlyContinue
    $OVServer = Get-OVServer -ServerName $VMHost.Name -ErrorAction SilentlyContinue
    if ($OVServer) {
        $OVSResponse = Send-OVRequest -uri $OVServer.uri
    }
    $OVServerProfile = $OVServerProfiles | Where-Object {$_.Uri -eq $OVSResponse.serverProfileUri}
    #endregion

    #region: Update Server Profile
    $Task = $OVServerProfile | Update-OVServerProfile -Confirm:$false -Async
    $Task | Wait-OVTaskStart
    #endregion
    }

# Other Parts of this series

Built with Hugo
Theme Stack designed by Jimmy