Cisco UCS Automation Series, Part I – Getting Started with UCS PowerTool

UCS PowerTool Suite

UCS PowerTool is a set of PowerShell modules engineered specifically for UCS Manager, UCS Central, and the Cisco Integrated Management Controller (CIMC) of stand-alone/rack-mount servers. UCS PowerTool provides literally thousands of Cmdlets to manage, monitor, migrate, and mitigate anything on your UCS systems. The fact is that if you can do something in a UCS GUI, you can do it with PowerTool.

I did say there are thousands of Cmdlets in the UCS PowerTool Suite. Let’s focus on just the UCS Manager PowerTool module. In the 2.2.18 release there are only 2,326 Cmdlets. That of course is a much more manageable number, right?… Just Kidding. The truth is there really is no way to know them all, or which one to use. But get this, you can ask UCS PowerTool to tell you which Cmdlets to use!

ConvertTo-UcsCmdlet

ConvertTo-UcsCmdlet is a specialized UCS PowerTool Cmdlet that will literally tell you how to configure a pool, policy, vlan, really any object in UCS Manager just by asking. It works a few different ways; however, the easiest way is outlined below.

• Create something in UCS Manager GUI or CLI, for example a Boot Policy that can be consumed by a Service Profile or Service Profile Template.

• Get the Boot Policy configuration from UCS Manager using the UCS PowerTool Cmdlet Get-UcsBootPolicy with the “-Hierarchy” parameter and send the output of Get-UcsBootPolicy to ConvertTo-UcsCmdlet

• ConvertTo-UcsCmdlet will output the Cmdlets and the required parameter settings to make the Boot Policy

That’s it! It is really that easy. Now if you want to, take that output and turn it into a script.  Then whenever you need that kind of Boot Policy on a UCS Manager you can just run the script when you are connected to the UCS Manager where you would like the Boot Policy.

Try It Out

Here is what the Boot Policy creation looks like in UCS Manager to boot from a local disk first, then a CD/DVD, then CIMC Mounted Virtual Media.

Here is the code that you would run in the UCS PowerTool Console to get the Boot Policy and then Convert it to UCS PowerTool Cmdlets. In the example the Boot Policy is named “Local-DVD-Virt”

Get-UcsBootPolicy -Name Local-DVD-Virt -Hierachy | ConvertTo-UcsCmdlet

Here is what the output of ConvertTo-UcsCmdlet looks like when Get-UcsBootPolicy is run to retrieve that boot policy and then piped to ConvertTo-UcsCmdlet.

Networkking4u

This process removes the guesswork and also shows you a good UCS PowerTool practice of wrapping your configurations in a UCS Transaction.

This is the code that was generated

Start-UcsTransaction

$mo = Get-UcsOrg -Level root | Add-UcsBootPolicy -ModifyPresent -BootMode “legacy” -Descr “Local Disk then Local CD/DVD then Virtual Media” -EnforceVnicName “yes” -Name “Local-DVD-Virt” -PolicyOwner “local” -Purpose “operational” -RebootOnUpdate “yes”

$mo_1 = $mo | Add-UcsLsbootVirtualMedia -ModifyPresent -Access “read-only-local” -LunId “0” -MappingName “” -Order 2

$mo_2 = $mo | Add-UcsLsbootVirtualMedia -ModifyPresent -Access “read-only-remote-cimc” -LunId “0” -MappingName “” -Order 3

$mo_3 = $mo | Add-UcsLsbootStorage -ModifyPresent -Order 1

$mo_3_1 = $mo_3 | Add-UcsLsbootLocalStorage -ModifyPresent

$mo_3_1_1 = $mo_3_1 | Add-UcsLsbootLocalHddImage -ModifyPresent -Order 1

Complete-UcsTransaction

What’s Next?

The next blog in the UCS Automation with UCS PowerTool series, will be all about UCS Connections,

• Interactive

• Automated

• Saved

• Multiple

• Default and Non-Default

• Named

So exciting!! When is it coming out? I’ll tweet it out and so will DevNet, so if you want to be in the know, follow me and DevNet below.

One thought on “Cisco UCS Automation Series, Part I – Getting Started with UCS PowerTool

Leave a Reply

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

%d bloggers like this: