One of the new features of VMware vSphere is booting the ESXi hosts from PXE. This feature is called Auto-Deploy and gives you the ability to use stateless ESXi servers.

Below is a step-by-step guide to get you started. It assumes you use the vCenter Virtual Appliance. of course auto deploy also works with any other DHCP/TFTP server and auto-deploy itself can be installed on a Windows vCenter server as well.

  1. Open the vCenter administration webpage (https://<vcenter>:5480), Go to the services tab and make sure the ESXi services are started. If not click “Start ESXi Services”.
  2. Configure DHCPd in /etc/dhcpd.conf. Configure at least the following items.
    1. DNS / GW
    2. Subnet
    3. scope or reservations
    4. next-server
    5. filename: undinonly.kpxe.vmw-hardwired
    6. uncomment or add the keyword autoritative;
    7. My dhcpd.conflooks like this:

option domain-name “vmtopia.lab”;
default-lease-time 600;
max-lease-time 7200;
autoritative;

log-facility local7;
allow booting;
subnet 192.168.16.0 netmask 255.255.255.0 {
range 192.168.16.150 192.168.16.160;
next-server 192.168.16.100;
filename “/tftpboot/undionly.kpxe.vmw-hardwired”;
}

  1. bind dhcp to network interface by editing the /etc/sysconfig/dhcpd file
    Add or change this line: DHCPD_INTERFACE = “ANY”
  2. Start DHCP: service dhcpd start
  3. Make sure the boot files are in /tftpboot. The VCVA comes with the right files.
  4. Start atftpd: service atftpd start
  5. Open file /tftpboot/tramp to check if hostname is used. If no DNS available replace vcenter hostname for IP address
  6. If you want to make sure your hosts can access tftpd even if DNS fails or when hostname is not in DNS you have to edit /etc/hosts.allow. At the bottom of the file change ALL : KNOWN to ALL : ALL
  7. Poweron an ESX server. Check if it loads gPXE. As the information screen shows, it won’t boot because there is no autodeploy rule associated with that host. The host will keep rebooting so power it off for now
  8. The next step is to create autodeploy rules which associate the hosts to a boot image, host profile and a cluster or folder. The only way to create those rules is by using PowerCLI. So install the vSphere5 PowerCLI on a windows box, start it and login to vCenter using the  connect-viserver commandlet
  9. Now we have to load an ESXi depot. The default ESXi depot can be downloaded from the Vmware site <<LINK>>. Now load the depot using the following powershell command:
    Add-esxsoftwaredepot <path to depot file>
  10. In the default depot there are two image profiles. An image profile is basically a collection of VIB files. A VIB file can contain the base system, Vmware tools, drivers etc. We can show the profiles available in the depot by using:
    get-esximageprofile
  11. To make a new ESX server boot from one of the profiles we have to create a rule. A rule has three properties:
    1. Rule name: Just give a descriptive name here like “imageprofilerule”
    2. Item: this is the object you want to associate with a host or group of hosts. In this case it will be an image profile (ESXi-5.0.0-381646-standard)
    3. Pattern: The pattern defines to which hosts this rule will apply. There are a lot of different variables you can put into the pattern like: Vendor, Model, MAC, Asset Tag and IP range. For now we will just use the IP range.
  12. Create a new rule:
    new-deployrule -name imageprofilerule -item ESXi-5.0.0-381646-standard -pattern “ipv4=192.16.0.100-192.168.0.200”
  13. After creating the rule, the rule has to be added to the active rule set:
    add-deployrule imageprofilerule
    To show the current rule set use: get-deployrule
  14. Now autodeploy knows which image to boot. The host will be added to vCenter automatically but we have to tell autodeploy where to put the host (which datacenter or cluster). So let’s add another rule:
    new-deployrule -name clusterrule -item cluster1 -pattern “Model=”BL 460c G6”
    Note that i used the server model in the matching pattern here so there will be only one type of machines in the cluster.
  15. And add it to the ruleset: add-deployrule clusterrule
  16. Now poweron your ESX server and watch the magic happen 🙂
  17. Ater your first ESX server is started you can configure it, create a hostprofile from it and create a rule to make sure all your servers will use that hostprofile. I will discuss host profiles in another post.
    new-deployrule -name profilerule -item <hostprofilename> -ALLservers
    add-deployrule profilerule
    If you don’t want all your servers to use the same profile you can also use a pattern here instead  of “allservers”
  18. Now poweron all 10000 ESX servers, don’t tell your boss you’re ready installing all servers, leave the office pretending you need to be in the datacenter and enjoy you afternoon in the pub 🙂

cheers!

 

Christiaan Roeleveld Virtualization Consultant

Let's talk!

Knowledge is key for our existence. This knowledge we use for disruptive innovation and changing organizations. Are you ready for change?

"*" indicates required fields

First name*
Last name*
Hidden