I’ve been spending a fair bit of time recently looking at, and writing about, Auto Deploy as part of my VCAP5-DCA preparations. Having written the following posts:
- AutoDeploy Stateless Caching and Stateful Installs
- Provisioning ESXi hosts using Auto Deploy
- Working with ESXi Image Profiles
- Installing Auto Deploy
I thought there is still room to do an overview/cheat sheet type guide to cover the basics from creating a image profile to delivering it with Auto Deploy. Basically the minimum steps to get a host up and running with Auto Deploy (with the assumption that the Auto Deploy server and supporting technologies such as DHCP and TFTP are already configured).
Add-EsxSoftwareDepot https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml
This will add the online software depot. Equally you could point at a local depot, or just at a single .zip file you may already have previously downloaded/exported such as:
Add-EsxSoftwareDepot c:\tmp\VMware-Esxi-5.1.0.zip
You can add the depot containing the vmware-fdm package using:
Add-ESXSoftwareDepot -DepotUrl https://vcenteripaddress:80/vSphere-HA-depot
Next, list the available image profiles from the depot(s) that have been configured in the previous step, using the ‘get-esximageprofile’ cmdlet. I tend to run the cmdlet with the following select statement, to more easily view the image profile names:
get-esximageprofile | select name
After identifying an image profile you want to use with Auto Deploy, clone it using:
New-EsxImageProfile -CloneProfile "ESXi-5.0.0-20140104001-standard" -name "ESXiAutoDeployImage"
Now we have a image profile which can be modified, in this case by adding the vmware-fdm package:
Add-EsxSoftwarePackage -ImageProfile "ESXiAutoDeployImage" -SoftwarePackage vmware-fdm
At this point we can export the image profile for later use.
Export-Esximageprofile -name "ESXiAutoDeployImage" -exporttobundle -filepath c:\tmp\esxiautodeployimage.zip
Now we can move on to configuring the auto deploy rules. Generally we will want to configure host profiles so that the autodeployed hosts all use a consistent configuration. To do so we will use the first autodeployed host as a reference host for the profile. Start by creating a generic auto deploy rule before powering on the first host:
new-deployrule -name "referencehost" -item "ESXiAutoDeployImage" -AllHosts add-deployrule -deployrule referencehost
After booting the host, configure a host profile for it – named something like ‘autodeployprofile’. The host profile should contain all configuration that you wish to have applied to the autodeployed hosts. The next step is to create new deploy rules to be used now that we have a host profile. We’ll also make the new rule more specific, using the -pattern attribute.
new-deployrule -name "Production" -item "ESXiAutoDeployImage" -Pattern “ipv4=192.168.0.140-192.168.0.145″ add-deployrule -deployrule Production
The above rule specifies that hosts that have an IP address in the above range assigned by DHCP, will boot using the “ESXiAutoDeployImage” image. Now I’ll add a rule to ensure that these hosts get assigned the host profile:
new-deployrule -name "ProductionHP" -item "autodeployprofile" -Pattern “ipv4=192.168.0.140-192.168.0.145″ add-deployrule -deployrule ProductionHP
Another rule can be used to add the autodeployed hosts to a specified cluster:
new-deployrule -name "ProductionCluster" -item "clustername" -Pattern “ipv4=192.168.0.140-192.168.0.145″ add-deployrule -deployrule ProductionCluster
Finally, we can delete the first rule created which was only used when creating the reference host.
Remove-DeployRule -DeployRule "ReferenceHost" -delete
At this point, all hosts that match whatever pattern was specified (in this case the IP address range) will boot using the new host profile. All that remains is to create host profile answer files for each host.