vSphere 5 AutoDeploy BasicsJune 5, 2012
vSphere AutoDeploy always seemed like a lot of work to setup just to deploy a few VMware hosts, but in my current job I don’t setup hosts very often. If you are constantly deploying new hosts to get out in front of performance issues, or are building a new datacenter and deploying many hosts at once, AutoDeploy can be a great way to get up and running quickly.
In order to use AutoDeploy, you’ll first need vSphere5, the AutoDeploy Install (which is on the vCenter Media), the vSphere5 Offline Bundle, PowerCLI, a DHCP Server and a TFTP server for starters.
Install the AutoDeploy plugin and configure it so that it points to the correct vCenter instance. I installed my AutoDeploy instance on my vCenter Server.
Setup your TFTP server and the root folder. I used a program called TFTPd32 and installed it on the vCenter Server. Be sure to open up the Windows Firewall for tftp if it’s running.
Open up the vCenter client and go to the AutoDeploy module. Download the tftp boot zip files to your root directory that was created in the previous step.
Setup your DHCP server so that the scope your ESXi hosts will be on have options 66 and 67 setup. For option 67 enter “undionly.kpxe.vmw-hardwired” and for option 66 enter the server name for your tftp server.
Lastly, place the ESXi vSphere offline bundle in your tftp root directory. Leave it in the zip file.
To setup the images for the ESXi hosts to boot from, we need to do a little PowerCLI. Open up your PowerCLI console and connect to your vCenter server. Don’t forget to set your execution policy if you haven’t already.
[sourcecode language=”PowerShell”] set-executionpolicy remotesigned
connect-viserver prodvcenter [/sourcecode]
First, we’ll setup the software depot. This is the actual hypervisor software that will be installed on the server.
[sourcecode language=”PowerShell”] add-esxsoftwaredepot c:tftptftp-deployVMware-ESXi-5.0.0-469512-depot [/sourcecode]
Once the software depot has been setup, we can run
[sourcecode language=”PowerShell”] get-ESXiImageProfile[/sourcecode]
which will show us our installation options.
I’ll be using the ESXi-5.0.0-469512-standard image profile because I want the option to install VMware Tools later.
Now we need to setup a rule so that when the ESXi hosts boot up and get the image that is designed for it. In my case I’ve setup a DHCP reservation for one of my hosts that is set to the IP address 192.168.160.200.
We create a rule designed for this IP address and the software depot that I setup earlier. I’m also adding two items named AutoDeployProfile01 and AutoDeployCluster which adds a Host Profile and puts the host into the AutoDeploy Cluster I’ve created in vSphere.
[sourcecode language=”PowerShell”] New-DeployRule –Name “ProductionAutoDeploy” –Item “ESXi-5.0.0-469512-standard”, AutoDeployProfile01, AutoDeployCluster –Pattern “ipv4=192.168.160.200" [/sourcecode]
Notice that the -pattern option can be any of the following, to meet your needs.
The command you have just entered, has setup a deploy rule for what VMware calls “The Working set.” If you try to boot up your host at this point, you’ll see that the host can’t finish the boot process. A message like the one below will be displayed, showing the patterns that can be matched for the specific hardware that’s being used.
To finish the autodeploy setup, you must take your “working set” and make it the “Active Set.” To do this we run
[sourcecode language=”PowerShell”] Add-DeployRule -deployrule ProductionAutoDeploy [/sourcecode]
When we boot up the host now we’ll see the ESXi hypervisor start to install and when it’s done the host will be added to our AutoDeploy Cluster.
I won’t go into much detail in this post about Host Profiles, but for AutoDeploy to be truly effective a host profile is a must have. Just getting your hypervisor installed is nice, but in the end, you want to have your host added to a cluster, have the DNS settings configured, NTP configured, datastores setup, and virtual switches all setup. The easiest way to arrange this is build a reference host and create a host profile with all of your desired settings and then attach that profile during your boot process.