Synchronize UCS Objects
Cisco UCS supports many compute nodes, in a data center there most likely will be more than one UCS system, managing hundreds of compute nodes. These UCS domains will probably have very similar requirements for VLANs, VSANs, vNIC and vHBA templates, Service Profiles templates, boot polices and etc.
Are you tired of cutting and pasting, or clicking until your fingers are calloused over? Are you trying to duplicate or synchronize settings across all your UCS domains? Do you lose track of the changes you made and where? Not to worry UCS PowerTool to the rescue. UCS PowerTool is the Cisco UCS PowerShell Cmdlet library. UCS PowerTool 220.127.116.11 has just been released, download it and make sure to get the release notes and the user guide.
UCS Components and configuration are defined by an XML schema and this schema is used to generate the majority of the UCS PowerTool Cmdlets. However there are a several special Cmdlets that take UCS PowerTool from a great set of cmdlets to a must have cmdlet library for all UCS administrators. The cmdlets I’m focusing on today are Sync-UcsManagedObject and Compare-UcsManagedObject.
There are several ways to synchronize or duplicate objects across UCS domains, manually, configuration export and import, CLI cut and paste, UCS PowerTool, etc. Obviously I picked UCS PowerTool for the job and want to share the script, the process and point out a caveat or two.
From the user guide here is an example of Sync-UcsManagedObject and embedded within the example a call to Compare-UcsManagedObject. This is the example;
Sync-UcsManagedObject -Ucs SYSB (Compare-UcsManagedObject (Get-UcsOrg -Ucs SYSB) (Get-UcsOrg -Ucs SYSA)) -Force
The command is going to get the Orgs from SYSB (the target) and the Orgs from SYSA (the source) and compare them,
- Orgs on SYSA that are not on SYSB will be created on SYSB
- Orgs on SYSA that are on SYSB will be modified on SYSB to match SYSA
- Orgs on SYSB that do not exist on SYSA will NOT be created on SYSA
The “sync” is a one-way sync and the sync is a full object create or modify such that the objects on the target UCS match completely with the objects on the source UCS. The compare is not just a compare on the name of the object but an attribute by attribute compare of the source and target object. Whatever objects that are not on the target that are on the source are going to be created on the target. Whatever objects that are on the target that are on the source are going to be modified on the target.
- This command is not going to create Orgs are on the Source that are on the Target.
- This command is not going to create supporting objects, for example Service Profiles can be organized in Orgs. For a service profile to be created on a target UCS the Org needs to already exist on the target.
I took the example from the user guide wrapped it in a script to login to both the source and target UCS Domains, provided options for the WhatIf and Force switches. I also extended the command a little by making the UCS object to sync a parameter. The object to sync is the noun part of the respective UCS PowerTool Get cmdlet for that UCS object. From the example above the Get-UcsOrg cmdlet is used to get the Org objects from each UCS. In my script the UcsObject parameter value would be Org.
As always I hope that helps your automation needs.