Automate Cluster Setup in 12-Steps with ONTAP PowerShell Toolkit 4.1

With the latest release of the ONTAP PowerShell Toolkit, a new set of cluster cmdlets are now available that support cluster setup.
The following cmdlets can be used for cluster setup:

  • Add-NcCluster
  • Add-NcClusterNode
  • Get-NcClusterCreateProgress
  • New-NcCluster

Let’s walk through the process of using these cmdlets. A FAS2552 two-node switchless cluster will be the example system. The prerequisites for this example are:

  1. The latest NetApp PowerShell Toolkit (4.3) has been installed
  2. Node setup has been run on each node
  3. The same admin password has been assigned to each node (security login password)
  4. ONTAP 9.1 GA release (but this should work with 8.3 and higher)
  5. A cluster base license is required

Let’s get started!

Step 1 – Import the DataONTAP module

Open a PowerShell console with “Run as Administrator” and go to your desired script directory (for this example I’ll use c:\Scripts) and import the toolkit:

For our example use the following variables/values:

Step 2 – Connect to Node A

Use the IP Address you assigned to the first node. Provide credentials at the prompt.

Step 3 – Create the cluster

Start the creation process on the first node. Provide your own base license key (below is an example only)

Step 4 – Monitor the creation process

We’ll need to check on the status periodically until it completes successfully. Watch the Status and IsComplete fields.

Step 5 – Switchless cluster mode

Step 6 – Create Cluster Management Interface

This will create a new management interface using the cluster IP address defined earlier. The –Role setting is critical since it impacts the default failover policy.

Step 7 – Connect to the second node

Step 8 – Join the second node to the cluster

As before, use the Get-NcClusterCreateProgress to monitor the status of the join.

Step 9 – Connect to the Cluster

Step 10 – Enable Cluster HA Mode on each node

Respond “Y” to each prompt to confirm the change. There’s a warning to re-boot the node for the change to take effect.

Step 11 – Reboot the Cluster

Now let’s restart each node to satisfy the HA mode changes. Reboot the currently connected node LAST or the connection will drop before the other node is restarted. Since we just connected to the cluster, the home node is Node A. Enter “Y” at each prompt to confirm the restart.

To verify the cluster has rebooted try the test-connection cmdlet or open a serial console.

Step 12 – Enable Cluster HA

Currently there is no cmdlet to do this so let’s use the Invoke-NcSsh cmdlet to send the CLI command. By default, on 9.1, ssh is NOT enabled for the admin account so we’ll need to add that application first. Connect to the cluster, enable ssh for admin, and enable cluster HA.

To disable ssh for admin use the Remove-NcUser cmdlet.

That’s it! The cluster is setup and ready for use. Go to System Manager to verify the cluster is functional.

BONUS CODE

Here’s a full script utilizing the same commands plus some interaction, looping, colorful output, error handling, and lots of re-usability. The required variables are passed on the command line. Add additional cmdlets to create aggregates, SVMS, LIFs, etc and you’ll have an end-to-end automated solution.

This is SAMPLE CODE so use it as a basis to develop – and remember – TEST, TEST, TEST before placing in production!

John Champion
Professional Services Consultant at NetApp
John joined NetApp in February 2015 as a DoD Professional Services Consultant and has worked in the IT industry for over 30 years. He has extensive experience with automation, virtualization, and system integration. Currently involved with software defined storage and an active contributor to the ONTAP Select project.

Leave a Reply