When I earned my VCAP5.5 DCA, Auto Deploy was not given much weightage and it sulked at the bottom of the list. Tables turned, not only it leads the exam objectives, significant chunk is about it. So on this post, we’ll try to set it up and understand the concept behind vSphere Auto Deploy.
For this setup I used a similar Nested Virtual Infrastructure lab that’s running entirely on a lone MacBook Pro, only this time, it’s vSphere 6.0 with vCenter Server 6.0 in Windows Server 2008. Before we list out all of the steps, I find it helpful (especially after having completed it) to visually comprehend what we are actually going to build:
In a nutshell, Auto Deploy is a system / infrastructure that should allow us to watch a new ESXi host auto-magically appear on our vSphere environment to contribute its resources. Everything is done for us autonomously after we mount an ESXi host in our datacenter, connect it to the appropriate network, and turn it on.
I was like, “What?! Are you kidding me? How about adding it to the cluster and other gazillion ESXi setting?” Turns out those can be taken care of, together with the majority of configuration stuffs, depending on the amount of ingredients you bake into Auto Deploy. Now on to a way to get it all set.
Dealing with the pre-requisites:
1. We need a TFTP server, and for this post I used SolarWinds’ TFTP Server installed on my vCenter Server. I tried using the built-in TFTP feature of my MBP but it took me several hours to NOT get it work – ran into some path issues, and then permissions issues before I gave up on it. On the contrary, it merely took me seconds to get SolarWinds’ TFTP Server to work.
2. Next, log in to vSphere Web Client, click on System Configuration under Administration section, change the Startup Type to Automatic and start the following services:
vSphere ESXi Dump Collector
3. Navigate to vCenter Inventory List, select the vCenter Server instance, go to the Settings under the Manage tab, choose Auto Deploy, and lastly, click on Download TFTP Boot zip.
4. Extract the contents of the zip file to the working path / root of the TFTP Server, which happens to be the vCenter Server as well in my lab.
5. Add the necessary Server Options in the DHCP Server by opening DHCP MMC, expand IPv4, right-click Server Options, and then select Configure Options… Set the following option accordingly:
066 should have the IP address of your TFTP Server.
067 should show the boot file which is undionly.kpxe.vmw-hardwired (from what we downloaded form Auto Deploy)
Now, if the machine you want to do PXE boot is a virtual machine in a Nested VI (i.e. VM running on VMware Fusion), use this method.
6. Part of the pre-requisites of Auto Deploy is having VMware PowerCLI, so I installed the following items on my Windows Server 2008 vCenter Server as well:
Windows Installer 3.0
Microsoft .NET 3.0
Microsoft PowerShell 3.0
vSphere PoweCLI 6.0
At this point, we should’ve built us an infra that can PXE boot a machine for Auto Deploy. If you turn on a new machine, it will boot using the Auto Deploy boot files, but that’s all it’s going to do. The rest of the steps are necessary to actually configure vSphere Auto Deploy and have it provision the new machine.
Set up a Software Depot & Create Image Profiles
We need to create an ESXi image for Auto Deploy use, and a step before that is to set up a software depot:
1. Use either Online or Offline ESXi bundles, I’ll go with the later for this post for a few reasons. Download the appropriate ESX(i) offline bundle (i.e. ESXi600-201706001.zip) from the VMware Patch Download Portal, or from the OEM Bundles.
2. Place the .zip file somewhere easily accessible (i.e. vCenter Server’s C:\vSphereSWDepot\) and run this command in PowerCLI:
And just like that, we have created for ourselves an offline software depot.
3. Next, list out the profiles available from the recently created software depot:
At this point, we can choose to truly customize an ESXi image by adding or removing VIBs using the cmdlets Add-ESXSoftwarePackage / Remove-ESXSoftwarePackage, and then export it using Export-ESXImageProfile.
No need for me to do that in my lab and for this test. I’ll just stick with the default image.
Provision ESXi Hosts using Auto Deploy
To provide the VIBs that we packed into an image a while ago to a host that’s connecting to Auto Deploy, we need to…
1. Create Deploy Rule(s)
New-DeployRule -Name "FirstAutoDeployRule" -Item "ESXi-6.0.0-20170601001s-standard" -Pattern "ipv4=10.0.0.129-10.0.0.254"
- ESXi-6.0.0-20170601001s-standard is an image profile that came with the ESXi600-201706001.zip that I’ve downloaded from VMware Patch Download Portal.
- ipv4=10.0.0.129-10.0.0.254 is something I got from dhcpd.conf of my VMware Fusion. Whenever I create a new VM in VMware Fusion, set its network interface to vmnet2, and set it to DHCP it will have a random IP within this range – which is a behavior we can expect from an infra that does PXE boot.
A way to interpret this Deploy Rule: If a machine PXE boots using Auto Deploy boot files, has an IP address within 10.0.0.129 – 254, and connects to the Auto Deploy Server – this server will load ESXi-6.0.0-20170601001s-standard image according to FirstAutoDeployRule .
We can keep coming up with more Deploy Rules that will trigger certain actions or provision items to a host (-Item like add to cluster, apply Host Profiles, etc) when the criteria (-Pattern) is met. There are other patterns that can be used to filter or validate a host that connects to the Auto Deploy.
2. Add the Deploy Rule(s) to Auto Deploy working rule sets
Add-DeployRule FirstAutoDeployRule Add-DeployRule SecondAutoDeployRule Add-DeployRule NthAutoDeployRule
That’s it. Hopefully you also get to have a fully working Auto Deploy system by following this post.
Acknowledgement: This buildVirtual post has tremendously helped me with this guide.