Auto deploy is used for PXE booting/installation of Esxi over the network. When a host is deployed using Auto Deploy the state information is loaded to memory upon boot, the state is not permanently stored on the physical host by default.
We can use Host Profiles with Auto Deploy to customize your ESXi host state. Also from Esxi host advanced configuration menu, we can configure host for stateless or stateful booting.
In this post we will learn how to configure auto deploy and use it to provision Esxi hosts. Configuring Auto Deploy is a 3 step process which includes:
1: Enabling Auto Deploy in vCenter/vCSA.
2: Configuring DHCP and TFTP
3: Creating Auto Deploy rules using PowerCLI
Lets walk through each section one by one.
Enabling Auto Deploy in vCenter/vCSA
In my lab I am using windows based vCenter installation. Steps for enabling auto deploy are pretty much same for vCSA deployments as well.
To enable the Auto Deploy service login to vCenter Web-Client and navigate to Administration > System Configuration > Services. Select “Auto Deploy” from the Services Menu.
Click the Actions drop-down menu and click Start. This will enable the Auto Deploy service.
Enabling Auto Deploy on vCSA through SSH
- Login to vCSA appliance via ssh and using ROOT account.
- Enable BASH Access: “shell.set –enabled True”
- Launch BASH: “shell”
- Enable the Auto Deploy service by typing: “service vmware-rbd-watchdog start“
Once Auto Deploy service is started, we can configure additional options like “Edit Startup Type” and chose whether auto deploy service will be started automatically or manually.
Additional settings like Cache Size and log level etc can be configured by clicking on Edit button (upper left corner). In my lab I am going with default settings.
Auto Deploy Configuration
In the web client navigate to Home > vCenter Inventory lists > Select vCenter Server > Manage tab > Settings > Auto Deploy
Download the TFTP Boot Zip file from here and upload to the server where your dhcp/tftp service is running. Also make a note of the BIOS DHCP File Name. We need this name when configuring DHCP server.
Once auto deploy service is started/configured, next is to deploy/configure dhcp and tftp for PXE booting of Esxi host.
In my last blog post I have covered overview of how PXE booting works. Feel free to have a look into that.
I am using windows server 2012 in my lab for DHCP and TFTP configuration. I have my windows server deployed and hostname/static IP set. This windows server is on same subnet on which my vCenter server and other infrastructure components like AD/DNS/NTP/Management Esxi hosts are connected.
First we will configure tftp settings. I am using the SolarWinds TFTP Server which is a free version and a very handy software from SolarWinds. This software can be downloaded from here.
Install the tftp server and launch the application. In my case tftp icon was not created on desktop so I navigated to C:\Program Files (x86)\SolarWinds\TFTP Server and created a shortcut of application on my desktop. Although there is not much to configure here, but if you want you can change the “TFTP Server Root Directory”.
Also if your server have more than one NIC and you want to bind TFTP traffic to a specific NIC, then you can do so from Server Bindings tab.
Now we have to unzip the TFTP Boot Zip file (which we downloaded from Auto Deploy server in previous steps) to TFTP Root Directory. Your configuration should look like this.
Now we are done with TFTP configuration. Next is to configure DHCP Server.
If you are using windows based DHCP server then add the DHCP Role from server manager. Post installation of the DHCP role, launch the dhcp server settings by typing dhcpmgmt.msc in command line.
Expand IPv4 and right click on it and select New Scope.
The New Scope Wizard appears. Hit Next and give your scope a name and a description, click Next.
Here we have to define a pool of IP’s which our Esxi hosts will get when they boot over the network. I have created a very small pool of 11 IP’s in my lab.
In production you might even define the entire subnet if you have a huge infrastructure and have 100’s of Esxi hosts.
If you want to exclude any IP or range of IP’s from above defined pool, you can do it here.
Specify the lease duration. I went with default settings in my lab.
Under Configure DHCP options, you can chose to configure the options right away or can do it later. I chose the former.
Specify the default gateway which your esxi hosts will use to communicate with DHCP/TFTP server to get IP etc.
Fill in the parent domain name. This name will be appended after the hostname of the esxi hosts.
Also specify the domain controller name and click on Resolve. Once the corresponding IP address is resolved, click on Add button and hit Next.
I dont have any WINS server in my environment so I left the settings blank and proceed to Next step.
Activate the newly created scope and hit finish to complete the “Add New Scope” wizard
Once the scope is created, configuration looks like below.
Now right click on Scope Options and Click Configure Options
Define the boot server. This is nothing but the IP/FQDN of the TFTP server. In my case both DHCP and TFTP are running on same node so I have given hostname of dhcp server.
Click 067 Bootfile Name and enter undionly.kpxe.vmw-hardwired. The undionly.kpxe.vmw-hardwired gPXE binary will be used to boot the ESXi hosts.
Additionally from Server Options you can define options 005,006,012,015 and 042. These values will be then applicable on all scopes which you create on this DHCP server. If you want these values to be local to each scope, then define them under Scope Options only.
My configuration looks like below.
Now we are done with DHCP configuration.
Creating Auto Deploy Rules
A: List all deploy rule by typing : Get-DeployCommand
B: Download an ESXi Offline Bundle
Go to www.vmware.com and click on the version of ESXi you wish to use. Download the “ESXi Offline Bundle” ZIP file”. I am using Esxi 6.0 U3 in my lab and it can be downloaded from here
Place the zip file anywhere in your system, but remember the path. Do not unzip this file as you will need the full ZIP file for Auto Deploy.
C: Add ESXi to the Software Depot
Once you have the ESXi Offline Bundle, you will need to add it to the Software Depot.
To add the Offline Bundle to the Software Depot, we have to use the “Add-EsxSoftwareDepot” cmdlet along with the location of the bundle:
D: Retrieve Image profile name
Use the Get-EsxImageProfile cmdlet to see the versions of ESXi available from the bundle that we just uploaded.
We have two versions of ESXi 6.0 here; standard, and no-tools:
E: Create a new profile from the existing profile using New-EsxImageProfile cmdlet as shown below
New-EsxImageProfile -CloneProfile “ESXi-6.0.0-20170202001-standard” -Name “New_Profile”
F: Create Deploy Rules
A Deploy rule is used to determine which hosts boot a specific version of ESXi. There are two important pieces of information needed to create the deploy rule; items and patterns.
The items determine what object to associate to the ESXi host and the patterns determine which ESXi hosts are a part of the specific rule.
An example of deploy rule is shown below:
New-DeployRule -Name "Esxi6.0U3" -Item "New_Profile" -Pattern "ipv4=192.168.109.100-192.168.109.110
You will see a number of files being uploaded to Auto Deploy once the rule is created.
If you want to add your hosts to a specific cluster, you can do so by defining a new deploy rule as shown below. Staging is the name of cluster where I want to put my esxi hosts that are deployed using Auto Deploy.
New-DeployRule -Name "Default-Cluster" -Item "Staging" -AllHosts
G: Activate the Rule set as shown below
And that’s it. Now it’s time to test our configuration.
I have created a blank VM in my vCenter, selecting Esxi 6.0 as underlying OS and powered on the VM.
I can see it’s getting the IP from DHCP and contacting TFTP server for the boot image.
And finally Esxi was loading
If this is the first host in your environment and you do not have any host profiles created yet, you will see below warnings on your Esxi hosts as the host was booted in a stateless configuration.
In next post of this series, we will look into creating host profile and changing the Esxi host boot settings from stateless to stateful.
I hope you enjoyed reading this post. Feel free to share this on social media if it is worth sharing. Be sociable 🙂