A common question I hear is “can I install the Pure vSphere Plugin via PowerShell?” and my answer has been up until now, “sorry no :(”
But I was asked it twice last week and I decided to actually think about it? Why couldn’t it be automated? Just because we host in in the FlashArray and it is normally installed via our GUI? That GUI has to be executing code to do the install.
Installing a vSphere plugin is really two steps. First registering the plugin as an extension (this says what the plugin is, what version, etc). And then actually installing the plugin files to the vCenter. In a normal situation, someone logs into our GUI, connect to the vCenter and then runs the “install” which is really just registering the extension. In that registered extension, there is a link to where the plugin files can be downloaded from. This is step 2. At some point after registration, the vSphere Client downloads the files. In the Flash version, it happened the next time you logged in (this is why logging in took so long the first time you logged in after installing plugin). In the HTML-5 vSphere Client, this happens in the background, so there is no delay in logging in.
Okay. So there are two hurdles to doing this:
The first problem was easy to solve. There is an API method in ExtensionManager called updateExtension() and registerExtension(). These respectively update a plugin and register a new one.
In PowerCLI, (once you’ve connected to vCenter) you can get this fairly easily:
$services = Get-view 'ServiceInstance'
$extensionMgr = Get-view $services.Content.ExtensionManager
#to install new:
How to build the extension spec will of course vary between every vendors plugins, but the key part is registering the download location. Which is problem #2.
So on the FlashArray, we host the plugin on the array controllers, and someone can login to the GUI (or CLI) and run the installation. That process registers the extension and the download URL is that arrays management IP and the plugin zip. Will look like this:
Nothing special about this. So what I did is bypassed the GUI and just rewrote it in PowerShell.
In the module I manage (PureStorage.FlashArray.VMware) I added two new cmdlets, Install-PfavSpherePlugin and Get-PfavSpherePlugin in the 184.108.40.206 release.
Let’s walk through those, but first another point.
We are working on changing how the plugin is offered and delivered, but I made a small step in improving this process. As it stands, if you want a new plugin installed, you have to open a case with Pure support and we load the latest plugin on your array, and then you can push it to your various vCenters. Not the greatest system–which is what we are changing. But the full implementation of the change is still in the future.
So what I did is host the latest plugin versions on an S3 bucket, that is publicly accessible. So If you want the latest plugin, you do not even need to get it loaded on your array. Just run the cmdlet! I will post the latest versions of the plugins there as they release.
This tells you what plugins you have on an array, or what is out there hosted.
If you just run it without any parameters, you will only get what is on the cloud.
Of course, if your organization does not let you route out to this URL over 443, then it will return nothing.
Or you can pass in FlashArray connections, or IPs, or domain names. In this case, it will query the arrays for what versions they have. This will return the versions on those arrays and the ones on the cloud.
If you have connected arrays using new-pfaconnection, it will pick those up and query those arrays too
Also, there are two switch parameters. HTML and Flash. This will allow you to only return arrays that have that type of plugin:
Lastly, version. If you want to see who has what version, enter in the version.
Install-PfavSpherePlugin actually installs the plugin.
Here is its behavior:
In my vCenter, I do not have any plugins installed:
So, I run the following:
connect-viserver -Server test-vc -Credential $creds
The cmdlet returns the extension object, so you can store it, or out-null if you don’t need it.
And you will see it download:
Ready to use!
So the cmdlet has very similar options to the other one, specify the plugin type (-html or -flash) or the version (-version). It can also take in specific sources (FlashArray connections, FlashArray FQDNs or IPs).