HOWTO: Automate the installation of the External Platform Services Controller using PowerCLI & JSON - Part 1


Platform Services Controller PowerCLI PowerShell PSC VMware vSphere

Published on 3 July 2016 by Christopher Lewis. Words: 443. Reading Time: 3 mins.

As a follow on to my previous article on how to deploy HOWTO: Deploy the VMware vSphere 6.0 Platform Services Controller, I thought I would share a way to automate the delivery of the vSphere Platform Services Controller using PowerCLI/Powershell.

The main credit for this article goes to the information in the brilliant PowerCLI Reference 2nd Edition (see my review here) of which my colleague Jonathan Medd (www.jonathanmedd.net / @JonathanMedd) was a co-author.

On the VMware ISO for the VMware vCenter Server Appliance (VCSA) (within the vcsa-cli-installer\templates\install folder) you will find templates (JSON files) to silently install different variations on the VCSA.

In this article I will concentrate on my my specific use case which was to install the External PSC on vSphere ESXi. This will require either a Standard vSwitch or a Distributed vSwitch with Ephemeral binding (so that it is visible to ESXi host).

The basic idea is to import the JSON template, update it and write back a custom JSON file and then call setup and specify the JSON file.

VMware’s Example JSON Template

The example JSON template I am using for the single PSC is the “PSC_on_ESXi.Json” file.

PowerCLI/PowerShell Script

The PowerShell script is based on the example script from the PowerCLI Reference book but I have updated it (through trial and error) to update the JSON file correctly before attempting the installation.

As you will see the $json = (Get-Content -Raw $ConfigLoc) | ConvertFrom-Json line converts the JSON file into a powershell object which is then systematically updated using the notation in the JSON file. I am sure you will spot there is a hierarchy in play, target.vcsa -> SSO -> Password in the JSON file becomes $json."target.vcsa".sso.password in the PowerShell Script. Once updated, the PowerShell object is then converted back to a JSON file which can then be used in the command line installation.

Silent Installation

The command line for silently installing the VCSA is:

.\vcsa-deploy.exe "Custom-JSON-Template" --accept-eula --no-esx-ssl-verify

The two additional command line arguments are self explanatory, however for clarity:

–accept-eula automatically accept the EULA - this is a required argument

–no-esx-ssl-verify skips the SSL verification of the esxi connections - this is optional but using this will mean the user doesn’t get prompted to accept the thumbprint for the esx host server.

Summary

This makes deploying the VCSA (or in my case the PSC) so much simpler and easier! Why use PowerShell/PowerCLI when you can just update the template manually? Good question and it comes down to preference. Using Powershell will mean it can form part of a larger deployment script or something you could prompt user import for rather than using that horrid wizard!


Blog Categories: VMware vSphere PowerCLI PowerShell

See Also: