Automating the build of your vSphere 6.5 home lab

This year at VMworld SFO and BCN I was involved in organizing a couple of great hackathons with the @VMwareCode guys and William Lam, these were highly successful and I have to say the highlight of both my VMworlds.  The teams were great, the end projects were fantastic and most of all, everyone that attended told me they learned something, this if you ask me was the main objective for the hackathon.

If you attended I do want to extend a huge thanks for joining in, having fun and learning with us.

credc8rusaa8un0

To put the hacakthon together we needed to build up some environments for people to use, William came up with the idea of using Intel NUCs as these were easily transportable and packed a punch for their size, the equipment we purchased is listed below:

Quantity: 2 Crucial 16GB Single DDR4 2133 MT/s (PC4-17000) SODIMM 260-Pin Memory – CT16G4SFD8213
Quantity: 1 Intel NUC Kit NUC6i3SYH BOXNUC6I3SYH Silver/Black
Quantity: 1 Samsung 850 EVO 500GB 2.5-Inch SATA III Internal SSD (MZ-75E500B/AM) (For Capacity)
Quantity: 1 Samsung SM951 128 GB Internal Solid State Drive MZHPV128HDGM-00000 (For Performance)

For the hackathon we needed to build a lot of these units, whilst we did some parts of it manually William and I recently took the time to complete the automated deployment of these units, in fact the script is not specific to these units, it will work on any ESXi host with 2 disks, one for performance and 1 for capacity.  Of course you can also adjust the script to use more disks if you have them!

Once you have ESXi on a USB insert it into the machine and configure it to boot from the USB, after the ESXi machine is on the network you can alter the configuration settings in the start of the script and run the script in the Deployment Script section of this blog to automate the following:

  • Configure VSAN in a single node configuration (Unsupported)
    • Use the smaller SSD for performance
    • Use the larger SSD for Capacity
  • Configure NTP on the ESXi Host
  • Enable SSH on the ESXi Host for debugging
  • Configure the Syslog settings on the ESXi Host
  • Deploy the VCSA on the ESXi Host
  • Enable VSAN Traffic on the Management Network
  • Create a Datacenter
  • Create a Cluster
  • Create a subscribed content library for William Lams Nested ESXi Library
  • Enable Autostart so the VCSA VM starts when the ESXi machine powers on
  • Enable SSH on the VCSA Server

Deployment Script

Once run it should look something like this:

Home Lab Deployment

Of course this script can be extended or modified as needed, if you want to contribute then please do check out the script or add a pull request to the PowerCLI-Example-Scripts repo here.

Deleting the configuration

Of course sometimes people do not always edit the configuration variables before they hit deploy to make it how they want it so sometimes it fails to build, if this is the case you will want to make sure the ESXi host is back to normal before trying again.

BEWARE: this will remove the VMs and destroy the VSAN datastore, make sure you want to do this and are not connected to more than one host in PowerCLI, I suggest a fresh PowerShell console.

8 thoughts on “Automating the build of your vSphere 6.5 home lab”

  1. I have to say I learn something from this. The question is, can this script be run only from a Windows box or laptop with PowerCLi installed?

    I find it interesting how simple scripting can be once you have one written by someone. 29 minutes to do that via script by hand would take an hour or two…

    I learned something, scripting is the way to go!

    it looks fun too!

    1. I found my answer: The minimum configuration required for Virtual SAN is 3 ESXi hosts, or two hosts in conjunction with an external witness node
      .

Leave a Reply