Cisco PowerTool for setting up FlashStack Virtual Server Infrastructure

This is a great example of using the Cisco UCS PowerTool Suite for Microsoft PowerShell to setup a FlashStack. The Cisco UCS manager can be a bit overwhelming with all of the various tabs, dialogs, etc. and being able to create a setup PowerShell script makes life a lot easier for an administrator to create a repeatable workflow. Check out the white paper at FlashStack Virtual Server Infrastructure Deployment Guide: Cisco PowerTool Addendum.

There are some areas of this paper that can be automated with the Pure Storage PowerShell SDK. One example is when creating boot policies the information from the FlashArray can be retrieved and either set via a variable or through the pipeline by using:

$f = New-PfaArray -EndPoint 1.1.1.1 -Credentials (Get-Credential) -IgnoreCertificateError
Get-PfaArrayPorts -Array $f | Format-Table -AutoSize 

Output:

Get-PfaArrayPorts -Array $f | Format-Table -AutoSize

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
iqn failover wwn              portal name   
--- -------- ---              ------ ----   
             524A937B2909F400        CT0.FC0
             524A937B2909F401        CT0.FC1
             524A937B2909F410        CT1.FC0
             524A937B2909F411        CT1.FC1

As you can see from the above output that the WWN does not come back in correct format. The below script adds the “:” as appropriate to have a well formed WWN.

$f = New-PfaArray -EndPoint 1.1.1.1 -Credentials (Get-Credential) -IgnoreCertificateError
$wwn = @()
$ArrayPorts = Get-PfaArrayPorts -Array $f
For($port=0;$port -lt $ArrayPorts.Count) {
    $wwn += ($ArrayPorts.Item($port).wwn) -replace '(..(?!$))','$1:'
    $port++
}

Modified Cisco PowerShell with the added wwns.

Start-UcsTransaction
$mo = Get-UcsOrg -Level root  | Add-UcsBootPolicy -Name "Boot-FC-A"
$mo_1 = $mo | Add-UcsLsbootVirtualMedia -Access "read-only-remote" -LunId "0" -Order 1
$mo_2 = $mo | Add-UcsLsbootSan -Order 2
$mo_2_1 = $mo_2 | Add-UcsLsbootSanCatSanImage -Type "primary" -VnicName "Fabric-A"
$mo_2_1_1 = $mo_2_1 | Add-UcsLsbootSanCatSanImagePath -Lun "1" -Type "primary" -Wwn $wwn[0]
$mo_2_1_2 = $mo_2_1 | Add-UcsLsbootSanCatSanImagePath -Lun "1" -Type "secondary" -Wwn $wwn[1]
$mo_2_2 = $mo_2 | Add-UcsLsbootSanCatSanImage -Type "secondary" -VnicName "Fabric-B"
$mo_2_2_1 = $mo_2_2 | Add-UcsLsbootSanCatSanImagePath -Lun "1" -Type "primary" -Wwn $wwn[2]
$mo_2_2_2 = $mo_2_2 | Add-UcsLsbootSanCatSanImagePath -Lun "1" -Type "secondary" -Wwn $wwn[4]
$mo_3 = $mo | Add-UcsLsbootVirtualMedia -Access "read-only-remote-cimc" -LunId "0" -Order 3
Complete-UcsTransaction

The PowerShell example above for the Pure Storage FlashArray is using Get-Credential which I would suggest against for full automation. There is an example in the following post on how to automate the login to the FlashArray using PowerShell at https://www.purepowershellguy.com/?p=8431.

Once the Cisco UCS infrastructure has been setup then there are other actions that can be automated as well:

  1. Creating SAN boot volumes (How-To)
  2. Creating Hosts and/or Host Groups (How-To)
  3. Create data volumes for newly created Hosts (How-To)
  4. Connecting volumes to Hosts and/or Host Groups (How-To)
  5. Using DesiredStateConfiguration (DSC) to setup Windows Server

A suggestion for the Cisco UCS PowerTools team; put the Cisco UCS PowerTool Suite on the PowerShell Gallery. Easy Install-Module CiscoUCSPowerTool

Thanks,
Barkz

Add Comment

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.