Category Archives: Auto Deploy

Auto Deploy Boot Process

When you turn on a host that you want to provision or reprovision with vSphere Auto Deploy, the Auto Deploy infrastructure supplies the image and, optionally, a host profile and a location for that host. The process is different for hosts that have not yet been provisioned with Auto Deploy (first boot) and for hosts that have been provisioned with Auto Deploy and added to a vCenter Server system (subsequent boot). For subsequent boots, the vCenter Server system stores the information for the host.

First Boot Prerequisites

Before a first boot process, you must set up your system. Setup includes the following tasks, which are discussed in more detail in “Preparing for vSphere Auto Deploy,” on page 67.

  • Set up a DHCP server that assigns an IP address to each host upon startup and that points the host to the TFTP server to download the gPXE boot loader from.
  • Ensure that the Auto Deploy server has an IPv4 address. PXE booting is supported only with IPv4.
  • Identify an image profile to be used in one of the following ways.
  • Choose an ESXi image profile in a public depot.
  • (Optional) Create a custom image profile using the Image Builder PowerCLI, and place the image profile in a depot the Auto Deploy server can access. The image profile must include a base ESXi VIB.
  • (Optional) If you have a reference host in your environment, export the host profile of the reference host and define a rule that applies the host profile to one or more hosts.
  • Specify rules for the deployment of the host and add the rules to the Auto Deploy rules engine.

First Boot Overview

When a host that has not yet been provisioned with vSphere Auto Deploy boots (first boot), the host interactswith several Auto Deploy components.

1. When the administrator turns on a host, the host starts a PXE boot sequence.

The DHCP Server assigns an IP address to the host and instructs the host to contact the TFTP server.

2. The host contacts the TFTP server and downloads the gPXE file (executable boot loader) and a gPXEconfiguration file.

3. gPXE starts executing.

The configuration file instructs the host to make a HTTP boot request to the Auto Deploy server. The HTTPrequest includes hardware and network information.

4. In response, the Auto Deploy server performs these tasks:

     a. Queries the rule engine for information about the host.

     b. Streams the components specified in the image profile, the optional host profile, and optional vCenterServer location information.

5. The host boots using the image profile.

If the Auto Deploy server provided a host profile, the host profile is applied to the host.

image

 

8. Auto Deploy assigns the host to the vCenter Server system that Auto Deploy is registered with.

9.If a rule specifies a target folder or cluster on the vCenter Server system, the host is placed in that folder or cluster. If no rule exists that specifies a vCenter Server inventory location, Auto Deploy adds the host to the first datacenter displayed in the   vSphere Client UI.

image

 

(Optional) If the host profile requires the user to specify certain information, such as a static IP address,the host is placed in maintenance mode when the host is added to the vCenter Server system.You must reapply the host profile and answer any questions to have the host exit maintenance mode. If a host required user input during a previous boot, the answers are saved with the vCenter Server in an answer file. If you want to prompt the user for new information, you reapply the host profile.

If the host is part of a DRS cluster, virtual machines from other hosts might be assigned to the host after the host has successfully been added to the vCenter Server system.

Subsequent Boots Without Updates

For hosts that are provisioned with Auto Deploy and managed by a vCenter Server system, subsequent boots can become completely automatic. The host is provisioned by the vCenter Server system, which stores information about the image profile and host profile for each host in the database.

The boot process proceeds as follows.

1. The administrator reboots the host.

2. As the host boots up, Auto Deploy provisions the host with its image and host profile, which are stored in vCenter Server. It means Auto Deploy doesn’t query for image in the rule engine

image

 

3. Virtual machines are brought up or migrated to the host based on the settings of the host.

      a. Standalone host. Virtual machines are powered on according to autostart rules defined on the host.

      b. DRS cluster host. Virtual machines that were successfully migrated to other hosts stay there. Virtual machines for which no host had enough resources are registered to the rebooted host.

If the hosts specified by the pattern are not currently managed by a vCenter Server system, Auto Deploy provisions them with the already stored image profile and the specified host profile and adds them to the target cluster. After the host has been added to a vCenter Server system, the boot configuration is determined by the vCenter Server system

Reregister Auto Deploy (advance task)

Regardless of whether you are using the vCenter Server Appliance or a vCenter Server system installed on Windows, you must reregister Auto Deploy if the vCenter Server IP address changes.

For Windows based vCenter

Edit the setup file located at c:\ProgramData\VMware\VMware vCenter Auto Deploy\vmconfig-autodeploy.xml and specify the new IP address.

You do not have to edit the file if you reregister for other reasons than a new IP address.

image

 

Run the autodepoy-register.exe command-line tool, specifying all required options.

autodeploy-register.exe -R -a vCenter-IP -p vCenter-Port -u user_name -w password -s setup-file-path

image

Though above example talks about the –setupfile, I have not found this setup file. It may or may not work, worth checking.

VMware vCenter Server Appliance

As per VMware KB you also need to run /usr/bin/autodeploy-register with same syntax mentioned above. Then restart the Auto Deploy daemon /etc/init.d/vmware-rbd-watchdog. You can start the daemon directly or use the Start ESXi Services and Stop ESXi Services vCenter Server Appliance buttons.

Use Hosts with Static IP Addresses–AUTODEPLOY

By default, hosts provisioned with Auto Deploy are assigned DHCP addresses by a DHCP server. You can use the Auto Deploy answer file mechanism to assign static IP addresses to hosts.

Procedure

1. Boot a host using Auto Deploy.

2. With vSphere Client, connect to the vCenter Server that manages the Auto Deploy host, select the host, and select View > Management > Host Profiles to display the host profile.

3. Select a host, select Edit Profile, and select Networking configuration > Host port group > Management Network > IP address settings > IP address.

4. Select User specified IP address to be used while applying the configuration.

image

5. Select Networking configuration > DNS configuration > DNS settings and make sure the Flag indicating if DHCP should be used check box is not selected.

image

6. Export the host profile and modify the rule that assigns a host profile to the hosts for which you want to use a static IP address.

7. In the vSphere Client, apply the host profile to be prompted for the information without rebooting.

    a. Right-click the host, select Host Profiles > Manage Profile, select the profile to attach, and click OK.

    b. Right-click the host and select Enter Maintenance Mode.

    c. Right-click the host and select Host Profiles > Apply Profile.

    d. When prompted, provide the IP address.

    e. Right-click the host and select Exit Maintenance Mode.

8. The IP address is saved in an answer file. The next time you boot, the answer file information is applied to the host. One answer file per host is available.

Setting Host Profiles to Prompt for User Input–AUTO DEPLOY

Host profiles allow you to pre-specify information, for example, the storage setup or Syslog setup in a reference host and apply the host profile to a set of target hosts that share the same settings. But sometimes certain settings are host-dependent e.g. IP Address, Hostname. If there is information which is unique to the host and it is missing, the host comes up in maintenance mode when you provision it with Auto Deploy. Apply the host profile or update the answer file to be prompted for input. The system stores your input and uses it the next time the host boots.

NOTE The answer file is not stored in a location or format that administrators can access. Use the Host Profiles UI in the vSphere Client to manage answer files.


When the host profile is set to prompt for user input, you must specify a value in the dialog that appears. An error results if you do not specify a value.

1. If you wish to have unique Administrator password for ESXi host when the host boots for the first time, use following host profile setting, so that you are prompted for root password for first time

image

Prompts for the password for root user on each host when the host boots for the first time.

Prompt the user for the DNS name of the host.

You can have the system prompt the user in all cases (User specified host name…) or prompt the user only if no default is available

1. Open Networking configuration.

2. Open DNS configuration.

3. In the right panel, click Edit next to What is the name of this host.

image

Select how the system manages the DNS configuration.

  • Prompt the user for host name if default is not available
  • User specified host name to be used while applying the configuration

Highly available auto deploy (from techpubs)

Courtesy: VMware

Techbus today released a very good video on how to make high available auto deploy solution. Forbes (from vReference.com fame) here has raised some design challenges and hope this video addresses them.

You can watch video directly from here

Auto Deploy for vmware workstation

I have created 4 post blog to learn auto deploy. I have used VMware workstation to do the entire exercise. Here is the environment details

Software: VMware Workstation 7.x hosted on

OS: Windows 7.0 SP1

Guest OS: Windows 2003 SP2 x32 for Active Directory, DHCP and DNS

Guest OS: Windows 2008 R2 SP1 for vCenter5.0, Auto  Deploy

Guest OS: ESXi for testing Auto Deploy

Auto Deploy software from VMware which is vCenter ISO/CD

TFTP from Solarwinds

 

Schematic view of my Virtual Lab

Figure Schematic view of my virtual lab for Auto Deploy

First Post : Preparing auto deploy environment

Second Post : Installing auto deploy server configuring tftp server

Third Post : Configuring DHCP server and testing auto deployment

Fourth Post : Auto deploying ESXi

Please note my environment takes 18-20 minutes to boot ESXi host i.e. it is the time taken to stream ESXi image from auto deploy server.

how TO USE TEST & repair deploy RULE

 

Whenever new image is released by VMware you may want to patch ESXi. This will be happening probably 4 or 5 times in year. In this case you just need to modify deploy rule, test it and repair it.

When you change deploy rule it applies to all ESXi hosts, instead first test the patch on test server.

Use Apply-ESXImageProfile for testing VIB/Updates. Apply-ESXImageProfile updates the associations between the host and image profile. Take one of the least important host, e.g. test host. Use below CMDLET

First you may want to create software depot as shown below

SNAGHTML249aec32

$NewImage=Get-EsxImageProfile –Name “NewImageName”

Apply-EsxImageProfile -$NewImage (Get-VMHost “Test ESXi Host”)

Reboot the host (evacuated any VM’s before you reboot)

Check the host stability after reboot

Check if the new image is applied by using following cmdlet

Get-VMHostImageProfile -Entity (Get-VMHost “Test ESXi Host”)

Follow below method for all other ESXi Host

Once new image looks stable you can proceed to apply ESXi image to other remaining hosts

Copy-DeployRule –DeployRule “NameOfYourRule” –ReplaceItem “NewImageName”

Use Test and Repair Rule compliance cmdlet now. This is necessary as ESXi host information is already stored in vCenter, so even if you update the rule, new rule will not be applied to already up & running hosts.

Test-DeployRuleSetCompliance “HostName”

SNAGHTML24a467d7

For large number of host, divide host as per cluster and check the compliance of all host per cluster

Get-Cluster | Get-VMhost | Test-DeployRuleSetCompliance | format-table –autosize

SNAGHTML24a6d394

Repair the deploy rule using command

Repair-DeployRuleCompliance

SNAGHTML24aaa0d1

Check the compliance after repairing the rule, it is worth noting compliance has passed but actually image is not still yet used by ESXi. ESXi host will use this new image only when you reboot the host

image

Let’s check the image of ESXi host before rebooting the host

SNAGHTML24ade224

Reboot the host

image

ESXi version after reboot is updated as seen below

image

Auto Deploying ESXi

1. Create a software depot

Download ESXi image from VMware website. This is zip file and available only for those who have purchased software. ISO file wouldn’t help you in creating software depot. Download zip file and extract it to suitable folder of your choice.

clip_image001

I have extracted the file to C:\vSphere5.0\ImageBuilder\201111001 as shown below

clip_image002

Now create software depot using power cli CMDLET’s

clip_image004

 

SNAGHTML242caa31

 

SNAGHTML242ed823

 

 

 

 

SNAGHTML2432bd34

Rules can be created in various ways. Below you can find various examples of the rules and their explanations.


Examples


New-DeployRule –Name “AssignImageRule” –Item “ESXi-5.0.0-381646- standard” –Pattern “ipv4=10.91.243.1-10.91.243.254”

Above CMDLET creates deployrule  “AssignImageRule”, assigns a profile “ESXi-5.0.0-381646-standard” to all ESXi host which boots in 10.91.243.1-10.91.243.254 subnet

 

Add-DeployRule AssignImageRule

Above CMDLET moves the rule ”AssignImageRule” into active rule set

 

New-DeployRule –Name “AssignClusterRule” –Item “DC1-CLUS1” –Pattern “ipv4=10.91.243.1-10.91.243.254”

Above cmdlet creates a new rule “AssignClusterRule”, which moves the host in the subnet 10.91.243.1 – 10.91.243.254 into DC1-CLUS1 cluster. Activate this rule by using

Add-DeployRule “AssignClusterRule”

 

New-DeployRule –Name “AssignHostProfileRule” –Item “ADS-Host- Profile-1” –Pattern “ipv4=10.91.243.1-10.91.243.254”

Above cmdlet creates a new rule ”AssignHostProfileRule”, which assigns host profile “ADS-Host-Profile-1” to all hosts which boots from 10.91.243.1-10.91.243.254 subnet. Activate this rule by using

Add-DeployRule “AssignHostProfileRule”

As seen above we have created three rules, these rules have been activated.To check which rules are active use

Get-DeployRuleSet command

When the host is PXE’ed, first rule “AssignImageRule” will assign image to all host in 10.91.243.x subnet, then second rule “AssignClusterRule” will add these hosts to DC1-CLUS1 cluster and finally third rule “AssignHostProfileRule” will apply the host profile “ADS-Host- Profile”-to all these hosts.­­



Create DHCP reservation for ESXi hosts

Open DHCP Console, right click the “Reservations” and select “New Reservations”

clip_image011

Enter “Reservation Name”

Enter “IP Address”. This IP is offered by DHCP server every time based on “Mac Address” which is to be entered next.

Enter “Description” and press “Add”

clip_image012

Create DNS Record

Now create a DNS record. Please note when ESXi host is added to vCenter (using Auto Deploy mechanism), it does a reverse lookup check. If reverse lookup is not resolved, it adds the host using IP address.

1. Open DNS Console

2. Browse to your dns name/domain name. e.g. coalclub.com (in my case)

3. Right click on white space and select new Host (A) ….

clip_image014

clip_image015

clip_image016

Power On ESXi host

image

 

image

image

image

Configuring dhcp server and plain test of auto deployment process

Configure DHCP Server

One of the requirement of Auto Deploy is DHCP offer. We must have DHCP server in the environment. Below I have selected Windows 2003 DHCP server.

1. Open DHCP console, Select DHCP server

2. Right click and select “New Scope” 

clip_image001

3. Wizard starts for new scope, press Next to continue

clip_image002

4. Give suitable name to DHCP scope and press Next to continue

clip_image003

5. Provide the scope IP address with start and end range as shown below

clip_image004

6. Unless you want to exclude some address, keep this field as blank.

clip_image005

7. Provide the lease duration, I’ve left it default

clip_image006

8. Select Yes to configure settings specific for this scope options now

clip_image007

9. Enter Router details i.e. Gateway IP addresses here

clip_image008

10. Enter the “Server name” below and select resolve. This will confirm lookup entries in DNS

clip_image009

11. Provide WINS details if there is any in your environment. This option is not valid for Scope used for ESXi, therefore leave it blank.

clip_image010

12. Activate this scope, this will be active only when you authorize DHCP server

clip_image011

Now configure options for TFTP Server(66) and Bootfile name (67)

1. Select the scope you just configured, right click and select “Configure Options…”

clip_image012

2. Scroll down to select 066 check box for Boot Server Host Name i.e. TFTP server

clip_image013

3. Select the next option i.e. “067 Bootfile Name”

clip_image014

4. Below is what your screen should look at the DHCP Scope level

clip_image016

 

Test the TFTP, DHCP and Auto Deploy Server

At this stage we have not yet use image profiles to create image and use deploy rules. Simple test involves

1.) Powering on server

2.) Check DHCP is offering IP address

3.) DHCP is directing it to TFTP Server & Boot file File

4.) Boot file boots up and contacts Auto Deploy Server

5.) Since Auto Deploy server is not configured for image profile it will give warning and reboot

image

image

image

image

This confirm DHCP, TFTP and Auto deploy server are working. Now environment is ready. This environment will hardly change. So better you design this environment less changes will be needed in future. Next step will be to create image profile, assign image profile and play with Deploy Rules.

Installing auto deploy server & configuring tftp server

Installing Auto Deploy Server

1.Start vCenter Installer by double clicking on autorun.exe
2.Select VMware Auto Deploy and click Install below to start Installation

clip_image002[4]

3.Choose language of your choice, for me it is English

clip_image003[4]

4.vSphere Auto Deploy Installation Wizard starts, Press “Next >”

clip_image004[4]

Accept End-User Patent Agreement by pressing “Next > ”

clip_image005[4]

5.Accept EULA by pressing “Next >”

clip_image006[4]

6.Accept the location to install Auto Deploy

clip_image007[4]

7.I prefer/recommend to change the image repository, simple to be able to locate when needed. Select size as per your requirement, 2 GB will be more than enough for most of the environment

clip_image008

8. Provide vCenter credentials. Please note only one Auto Deploy can be associated with vCenter

clip_image009[4]

9. Provide the Auto Deploy Server Port

clip_image010[4]

IP address is the only option, I think in next version they might come up with FQDN

clip_image011

10. Review the screen, press Install to proceed with installation.

clip_image012[4]

11. Screen below shows installation in progress

clip_image013

12. Installation is completed at this stage

clip_image014[4]

13. Login to vCenter, go to home screen as show and confirm Auto Deploy Icon is present

image

14. You will see the pop up for certificate warning, click the checkbox as shown below and click Ignore button to proceed further

clip_image017

15. Optionally for troubleshooting purpose you can check if the plug-in is registered with the vCenter by selecting Plug-in from menu bar and reviewing the Plug-in Manager as shown below screen

image

Configure Auto Deploy Server with TFTP Server and DHCP Server

1. Double click Auto Deploy Icon as shown in the above screen.

2. Hover over to “Download TFTP Boot Zip” file and Download TFTP file as shown below

clip_image002[6]

3.As this is Zip file, extract the file using your zip utility.

clip_image003[6]

4.Extract the content of TFTP Boot file directly into TFTP root directory

clip_image004[6]

5. Select the TFTP Root directory which you might have configured as discussed in this post 

clip_image005[6]

6. Screen below shows you the extracted files, and Boot file which is the most important file.

clip_image007[6]

Next > is to configure DHCP Server, TFTP Server, Auto Deploy Server and Simple Test