Automating VxRail with VxRail API Powershell Modules

For this blog post I wanted to go through some sample use cases for leveraging the VxRail API’s via Powershell Modules.


This post is targeted towards users who are familiar with VxRail and are looking to automate some of those tasks that they are already performing today, via the UI.


VxRail includes APIs that can be used to automate many tasks from initial deployment, expanding the cluster, LCM as well as various health checks and much more.


These are the tasks we are going to look at today, which cover some of the Day 0 to Day X tasks.

1. Set-VxRailManagerNetworkAddr

2. Get-AutoDiscoveryHosts

3. Start-SystemBringup

4. Add-Host

5. Remove-ClusterHost

6. Start-LcmUpgrade


Set- VxRailManagerNetworkAddr

This module is used to change the initial IP Address of the VxRail Manager VM (VXRM).


By default, the VXRM has an IP Address of 192.168.10.200. This works fine in some cases, but in many cases the customer network requires the VXRM have an actual address that can be reached on their network.


This API will connect to the iDRAC for the node hosting the VXRM and change the IP address, Subnet Mask, Gateway & VLAN (if required) in one simple step.



The command used is:

· Set-VxRailManagerNetworkAddr -Server 10.245.96.43 -Username root -Password calvin -IP 192.1.0.32 -Netmask 255.255.255.0 -Gateway 192.1.0.1 -VlanID 99

This will connect to the iDRAC @ 10.245.96.43, using the credentials of ‘root’ and ‘calvin’ and then changes the VXRM VM network details.

Once initiated, the ‘Get-VxRailManagerNetworkStatus’ command can be used to check the status of the task. Once configuration is complete you can see the VM responding to a ‘ping’ and then be available on that new IP address for use in the following steps.


Get-AutoDiscoveryHosts

This module will return a list of hosts that the VXRM is able to discover on the network.


By using the IPV6 Multicast protocol, the ‘loudmouth’ service will discover any VxRail hosts (that are in a factory default state). It will also return the components in each host.

The command used is:

· Get-AutoDiscoveryHosts -Server 192.1.0.32

In the video, you see the GUI of the VXRM showing the hosts it has discovered and on the right you see the list that is returned after running the module.


Start-SystemBringup

This module will start the initial deployment of the VxRail cluster.


For this module we require a pre-built JSON configuration file. We then pass that file to the VxRail Manager and start the deployment.



The command used is:

· Start-SystemBringup -Server 192.1.0.32 -Conf C:\Users\allan\Documents\JSON\GEO-Rack01_VxR-Cluster02_VxRail_Configuration.json

As seen in the video, you can add the ‘-Dryrun’ flag to the end of the command which will perform the validation step that you would have to run when deploying from the UI.


Once the build has been initiated we can use the ‘Get-BringupProgressStatus -Server 192.1.0.32’ command to watch the deployment status in real time.


Once complete, you can log into the vCenter server of your newly deployed VxRail Cluster.


Add-Host

This module enables you to add a new host to your VxRail Cluster.


This module requires that we already have a new (factory default) node racked, cabled and powered on. VxRail Manager will use the loudmouth service to discover the new node.



The command used is:

  • Add-Host -Server 192.1.0.32 -Username administrator@vsphere.local -Password YourPassword -VxrailVersion 7.0.200 -VcAdminUsername administrator@vsphere.local -VcAdminPassword YourPassword -Hosts @(@{host_psnt="DE300190624108";hostname="r1c2-node-4.vcf.vxrail.local";accounts=@{root=@{username="root";password="YourPassword"};management=@{username="esxmgmt";password="YourPassword"}};network=@(@{type="management";ip="192.1.0.17"} ,@{type="vsan";ip="192.1.2.17"},@{type="vmotion";ip="192.1.1.17"});is_maintenance_mode="true";geo_location=@{rack_name="rack1";order_number="39"};nic_mappings=@(@{vds_name="VMware HCIA Distributed Switch";name="uplink1";physical_nic="vmnic0"};@{vds_name="VMware HCIA Distributed Switch";name="uplink2";physical_nic="vmnic1"};@{vds_name="VMware HCIA Distributed Switch";name="uplink3";physical_nic="vmnic2"};@{vds_name="VMware HCIA Distributed Switch";name="uplink4";physical_nic="vmnic3"})})


Given the size of this command, let’s look at some of the flags:

  • host_psnt: This is the VxRail serial number of the new node to be added

  • VxrailVersion: Version of VxRail software on the new host

  • accounts: The credentials to be set on the new host

  • network: IP Addresses for the Management, vMotion and vSAN VMK’s

  • vds_name: Name of the VDS the host will connect to

  • uplinkx: Physical to virtual nic mapping

After running the command, we will get a ‘Request ID’ that we can then use with the ‘Get-Requests’ command to check on the status.


Remove-ClusterHost

This module will remove a host from the cluster.


Before running this command, make sure the host you want to remove is in maintenance mode and all of the data has been evacuated.



The command used is:

· Remove-ClusterHost -Server 192.1.0.34 -Username administrator@vsphere.local -Password YourPassword -vcAdminUserUsername administrator@vsphere.local -VcAdminUserPassword YourPassword -VcsaRootUserUsername root -VcsaRootUserPassword YourPassword -SerialNumber 8QTYHQ2


This will remove the host with the Service Tag# ‘8QTYHQ2’ from the cluster. The Service Tag# can be found by selecting the host to be removed and then navigating to ‘Monitor -> VxRail -> Physical View’


Start-LcmUpgrade

This module will perform an upgrade to the VxRail Cluster.


An important pre-requisite here is that you have already transferred the Upgrade Bundle to VxRail Manager. You can use a tool like WinSCP or similar. The should go to ‘/tmp’ directory or similar, but not the root directory.


The command used is:


- Start-LcmUpgrade -Server 192.1.0.34 -Username administrator@vsphere.local -Password YourPassword -BundleFilePath /tmp/VXRAIL_COMPOSITE-7.0.201-27039822_for_7.0.x.zip -VxmRootUsername root -VxmRootPassword YourPassword -VcAdminUsername administrator@vsphere.local -VcAdminPassword YourPassword -VcsaRootUsername root -VcsaRootPassword YourPassword

Once initiated, we again get a request ID that we can use with the ‘Get-Requests’ command to check on the status.

Aside from the modules shown here, there are many more that are provided for you to help automate your VxRail infrastructure.

Please visit this page to download the VxRail Powershell Module Package.

122 views0 comments

Recent Posts

See All