Provision ESXi Hosts using Auto Deploy Server

by admin

Once you have your Auto Deploy Server infrastructure configured, and you have your customised image profile, the next step is to create your deployment rules.

Deployment rules are used to link image profiles and host profiles to your physical hosts. When you create a deployment rule, the VIBs identified in the image profile are uploaded to the Auto Deploy server so that they can can used by the hosts. The rules tie everything together. Once there are in place you can begin to use Auto Deploy to provision your ESXi hosts.

As with other Auto Deploy and Image Profile configuration, the work is done from the PowerCLI console. The New-DeployRule cmdlet is used to create a new deployment rule.  For example, and referencing the image profile created here, this is the command I used in my test lab:

New-DeployRule -Name “AutoDeploy_Rule” -Item “MyAutoDeploy_Profile” -Pattern “ipv4=192.168.0.140-192.168.0.145″

This rule uses the MyAutoDeploy_Profile Image Profile I created, and matches the physical host by their IP address. This rule will apply to any hosts that connect to the Auto Deploy server using an IP address specified in the rule. There are other options you can use to match your hosts  when creating your deployment rule. This screen shot from the Auto Deploy GUI Fling shows the options that are available to you:

autodeploy

As mentioned earlier, when you run the command to create your rule, the vibs associated with your rule will be uploaded to the Auto Deploy server’s repository:

autodeploy2

This process can take a little while as the software is uploaded. Once complete you should see the following:

autodeploy3

The next step is to create a cluster rule to define which cluster our Auto Deployed hosts join. The command below will join all hosts provisioned through Auto Deploy to the AD Cluster I have set up in vCenter.

New-DeployRule -Name “Cluster_Rule” -Item “AD-CLUSTER″ -AllHosts

If you are using host profiles you can also create a deployment rule to apply a host profile to your hosts as part of the provisioning process:

New-DeployRule -Name “Host_Profile_Rule” -Item “AD-HostProfile” -Pattern “ipv4=192.168.0.140-192.168.0.145″

Add your Deployment Rules to the Working Ruleset

Now that you have your rules in place you need to add them to Auto Deploy’s working rule set by using the Add-DeployRule cmdlet. The following command adds the two deployment rules we have just created to the working rule set:

Add-DeployRule AutoDeploy_Rule

Add-DeployRule Cluster_Rule

autodeploy4

You can verify the working ruleset by running Get-DeployRuleSetOutput should be similar to below.

autodeploy5

Finally, after all the prep work, this is the bit were we can start the deployment!

Provisioning your Hosts

Now were can power on our host. So long as DHCP is configured so that it gets an address that matches the rule we created earlier then it should connect to our TFTP server, then begin to download it’s image from the auto deploy server. Having powered on our host we can see from out TFTP log that it has connected and has loaded the boot files:

tftp-log-auto-deploy

Looking at the console of the host, we can see that it has connected to the Auto Deploy server and has begun to download the image:

autodeploy6

Shortly after, we can see the familiar ESXi loading screen:

autodeploy7

Once it has booted, looking in vCenter we can verify that it has joined the correct cluster, as specified in the deployment rule:

autodeploy8

The host’s Summary tab verifies that it was deployed by Auto Deploy:

autodeploy9

Auto Deploy CMDLETs

There are many more auto deploy cmdlets than the ones I’ve used here, so here is the full list for reference:

Command Description
Get-DeployCommand Returns a list of Auto Deploy cmdlets.
New-DeployRule Creates a new rule with the specified items and patterns
Set-DeployRule Updates an existing rule with the specified items and patterns. Rules that belong to a working ruleset can not be updated.
Get-DeployRule Retrieves rules as specified by an administrator.
Copy-DeployRule Clones and updates an existing rule.
Add-DeployRule Adds one or more rules to the working and active ruleset(s). The NoActivate parameter can be specified to add a rule only to the working ruleset.
Remove-DeployRule Removes one or more rules from the working and active rule set. The rule(s) can be deleted by using the -Delete parameter.
Set-DeployRuleSet Explicitly sets the list of rules in the working rule set.
Get-DeployRuleSet Retrieves the current working rule set or active rule set.
Switch-ActiveDeployRuleSet Activates a rule set so that any new requests are evaluated through the rule set.
Get-VMHostMatchingValues Retrieves rules matching a pattern. For example, all rules that apply to hosts can be retrieved.
Test-DeployRulesetCompliance Checks whether items associated with a specified host are in compliance with an active rule set.
Repair-DeployRuleSetCompliance Updates the image profile, host profile and location for each host in the vCenter Server inventory based on the results of Test-DeployRulesetCompliance.  
Apply-EsxImageProfile Associates the specified image profile with the specified host.
Get-VMHostImageProfile Retrieves the image profile in use by a specified host.
Repair-DeployImageCache Command can be used if the image cache is accidentally deleted.
Get-VMHostAttributes Returns attributes for a host that are used when the Auto Deploy server evaluates the rules.

Configure an Auto Deploy Reference Host

A reference host helps you configure multiple hosts with the same configuration. You configure the host with all the required settings such as networking, syslog settings, NTP, storage configuration etc, then capture those settings to a host profile. The host profile can then be deployed to other ESXi hosts to guarantee a consistent configuration. See this article for more on working with host profiles.


Keep up to date with new posts on Buildvirtual.net - Follow us on Twitter:
Be Sociable, Share!

Leave a Comment

*

{ 1 trackback }

Previous post:

Next post: