Thoughts on the future of technology in and out of the datacenter

Implementation Series – Part 1: CLI Scripting for Dummies – Large Deployment

Welcome to Part 1 of a new Implementation Series to help you deploy your Pure Storage in the most efficiency and totally awesome way possible.

Part 1 of this series will focus on deploying a large environment through scripting versus the GUI. Customers absolutely love our GUI, for its amazingly simplicity, but sometimes your task is very iterative (for example provisioning 20 hosts with storage at once). If you find yourself in this position, then scripting will be your new best friend. Good news is that we created a simple and intuitive command line interface that makes iterative tasks super easy.

Recently a customer asked me to assist in deploying 20 ESX nodes for their VMware cluster they were building. They also wanted (20) 2TB volumes added to the cluster as well.

Before jumping into the scripting of this task, lets check out a few relevant commands required for this script. BTW, if you ever want to see the full details of these command, check out the Pure Storage User Admin Guide on support.purestorage.com or check out the help link in the top right corner of the GUI.

Command Overview:
purevol create –size [size] [volume_name]
Creates a volume of a specific size and name
purehost create –wwnlist [wwn hba1-port1],[wwn hba1-port2] [purehgroup name created above]
Creates a host and adds the wwns for the HBA of that host in one command
purehgroup create –hostlist [host],[host],[host] [hostgroup name]
Creates a host group and adds hosts from above
purehgroup connect –vol [volume name] [host_group]
Connect volumes to a specific host group

Let’s check out how simple this deployment can be with a quick script – done in seconds:

—————————————————
#Create all your volumes/datastores
purevol create –size 2T ESX_DS1 ESX_DS2 ESX_DS3 ESX_DS4 ESX_DS5 ESX_DS6 ESX_DS7 ESX_DS8 ESX_DS9 ESX_DS10 ESX_DS11 ESX_DS12 ESX_DS13 ESX_DS14 ESX_DS15 ESX_DS16 ESX_DS17 ESX_DS18 ESX_DS19 ESX_DS20

#Create hosts (initiators connected to each ESX node) – this one is best done in excel with all the initiators and hosts listed in separate columns
purehost create –wwnlist 0123456789abcde6,0123456789abcde7 ESX01
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX02
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX03
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX04
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX05
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX06
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX07
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX08
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX09
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX10
purehost create –wwnlist 0123456789abcde6,0123456789abcde7 ESX11
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX12
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX13
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX14
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX15
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX16
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX17
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX18
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX19
purehost create –wwnlist 0123456789abcde8,0123456789abcde9 ESX20

*note: 0123456789abcde8 and 0123456789abcde9 need to be replaced with each hosts WWN.

#Create a host group (your ESX cluster)
purehgroup create –hostlist ESX01,ESX02,ESX03,ESX04,ESX05,ESX06,ESX07,ESX08,ESX09,ESX10,ESX11,ESX12,ESX13,ESX14,ESX15,ESX16,ESX17,ESX18,ESX19,ESX20 ESX_Cluster01

#Adding hosts and volumes to your host group
purehgroup connect –vol ESX_DS1 ESX_Cluster01
purehgroup connect –vol ESX_DS2 ESX_Cluster01
purehgroup connect –vol ESX_DS3 ESX_Cluster01
purehgroup connect –vol ESX_DS4 ESX_Cluster01
purehgroup connect –vol ESX_DS5 ESX_Cluster01
purehgroup connect –vol ESX_DS6 ESX_Cluster01
purehgroup connect –vol ESX_DS7 ESX_Cluster01
purehgroup connect –vol ESX_DS8 ESX_Cluster01
purehgroup connect –vol ESX_DS9 ESX_Cluster01
purehgroup connect –vol ESX_DS10 ESX_Cluster01
purehgroup connect –vol ESX_DS11 ESX_Cluster01
purehgroup connect –vol ESX_DS12 ESX_Cluster01
purehgroup connect –vol ESX_DS13 ESX_Cluster01
purehgroup connect –vol ESX_DS14 ESX_Cluster01
purehgroup connect –vol ESX_DS15 ESX_Cluster01
purehgroup connect –vol ESX_DS16 ESX_Cluster01
purehgroup connect –vol ESX_DS17 ESX_Cluster01
purehgroup connect –vol ESX_DS18 ESX_Cluster01
purehgroup connect –vol ESX_DS19 ESX_Cluster01
purehgroup connect –vol ESX_DS20 ESX_Cluster01
—————————————————

So, how do you deploy this script?

You have a few of options here:
1.) Copy and paste each set section of commands to the CLI directly
2.) Save to a text file and send a remote ssh command as follows: ssh pureuser@<Pure Array IP Address> SCRIPT.txt

Where can I go to for help?

We are always happy to help. Please feel free to comment, reach out to your local Pure Storage Systems Engineer, or Support Representative at support@purestorage.com