One of the main areas of PowerShell that always impresses me is the integration of applications which were not designed to work together, it is often an overlooked and yet very powerful feature which enables products from the same company and even products from multiple companies to be glued together by PowerShell and integrate data and automation actions to perform some fantastic integration.
Recently I worked with Eric Williams from Cisco and we collaborated on some PowerShell scripts which used both Cisco PowerTool (PowerShell snap-in for managing Cisco UCS) and PowerCLI to integrate the Cisco UCS devices with VMware vSphere. With this combination we were able to use a mixture of technologies to create some scripts which automated the deployment of Cisco UCS blades from bare metal all the way up into vCenter.
These scripts not only deployed the Cisco UCS blades but also downloaded the latest version of ESXi from the VMware website, used this to PXE boot the UCS blades with VMware Auto Deploy and then finally applied created and utilized a host configuration using Host Profiles.
There was very minimal pre-work performed for both UCS and VMware in the environment being demoed in the video below.
For UCS, the pre-work that was performed was racking, stacking, and cabling the physical UCS gear and performing an initial configuration of UCS manager. On the storage side, a 200 GB LUN was created and zoned to a range of 18 WWPN's as well, of course this could also have been done with PowerShell snapins from some of the storage vendors if needed.
For VMware, vSphere and Auto-Deploy software were both installed and configured inside of a Windows 2008 R2 server that had DNS, DHCP, and TFTP installed and configured to best practices from VMware for AutoDeploy.
From there, PowerShell utilizing the Cisco UCS PowerTool module and VMware PowerCLI snap-ins takes over!!!
Three different scripts were created to perform the following functions:
- Initial Configuration – The first scripts configures all of the pools, policies, VLANs, VSANs, Service Profile Templates, etc. needed on the UCS side to create new servers to be used in the cluster to be created in VMware. On the VMware side, this script will download the latest ESXi hypervisor, as well as create separate AutoDeploy Hypervisor and Cluster rules that define the hypervisor version and destination cluster for net new servers with the Service Profile Template name provided in the OEM strings like "oemstring=$SPT:CL2012", where CL2012 is the service profile template name. The script will create a new service profile from a template, associate it with a server from a pool, monitor the progress of the association and addition of the host into the cluster, perform initial configuration of the new host in the cluster and create a host profile from the configuration, and create a rule for the cluster to use the new host profile.
- Addition of New Hypervisors – The second script is run to add new hypervisors to the cluster created in step one. This script accomplishes that by creating a new service profile from the template created in script one, associating it, and booting it which will cause the server to boot via AutoDeploy based on the AutoDeploy and cluster rules created from script one, which are triggered from the service profile template name. The script will verify the host is added to the cluster and is fully compliant with the host profile created in step one.
- Rolling Hypervisor and Server Firmware Upgrade of a Cluster – The third script will download the newest version of a ESXi hypervisor from VMware, create a new AutoDeploy rule utilizing it for servers that are created from the Service Profile Template created in step one. Once the rules are updated, the script will loop through each hypervisor one by one in the cluster by first setting the hypervisor in maintenance which will trigger VM evacuation, shutting the hypervisor down, change the host firmware pack on the service profile which upgrades the firmware on the server, powering the server on which will cause the server to boot the updated version of ESXi via AutoDeploy and rejoin the cluster.
These scripts can be downloaded from here and are provided freely as examples of how you can use both UCS PowerTool and VMware PowerCLI together to achieve end to end automation. Please feel free to modify and utilize them as examples of how you might automate UCS and VMware in your own datacenter.
Get notification of new blog postings and more by following VMware PowerCLI on Twitter: @PowerCLI
The post VMware and Cisco UCS Integration appeared first on VMware PowerCLI Blog.