Archive for Objective 9 Advanced vSphere Installation

Configure an Auto Deploy Reference Host

Cloud

Introduction

In an environment where no state is stored on the host, a reference host helps you set up multiple hosts with the same configuration. You configure the reference host with the logging, coredump, and other settings that you want, save the host profile, and write a rule that applies the host profile to other hosts as needed.

You can configure the storage, networking, and security settings on the reference host and set up services such as syslog and NTP. The exact setup of your reference host depends on your environment, but you might consider the following customization.

custom

Auto Deploy Reference Host Setup

custom

Configuring an Auto Deploy Reference Host

  • vSphere Client

The vSphere Client supports setup of networking, storage, security, and most other aspects of an ESXi host. You can completely set up your environment and export the host profile for use by Auto Deploy.

  • vSphere Command Line Interface

You can use vCLI commands for setup of many aspects of your host. vCLI is especially suitable for configuring some of the services in the vSphere environment. Commands include vicfg-ntp (set up an NTP server), esxcli system syslog (set up a syslog server), and vicfg-route (set up the default route).

  • Host Profile Interface

You can either set up a host with vSphere Client or vCLI and save the host profile for that host, or you can configure the host profiles directly with the Host Profiles interface in the vSphere Client

Provision/Reprovision ESXi Hosts using AutoDeploy

index

Provisioning and Reprovisioning

Provisioning a host that has never been provisioned with Auto Deploy (first boot) differs from subsequent boot processes. You must prepare the host, define the image using the Image Builder PowerCLI, and fulfill all other prerequisites before you can provision the host.

vSphere Auto Deploy supports multiple reprovisioning options. You can perform a simple reboot or reprovision with a different image or a different host profile.

Provisioning for the first time

Capture2

Subsequent boot of an AutoDeployed ESXi Host

depot

Reprovisoning

vSphere Auto Deploy supports multiple reprovisioning options. You can perform a simple reboot or reprovision with a different image or a different host profile.

The following reprovisioning operations are available.

  • Simple reboot.
  • Reboot of hosts for which the user answered questions during the boot operation.
  • Reprovision with a different image profile.
  • Reprovision with a different host profile.

Test and Repair Rule Compliance

  • When you add a rule to the Auto Deploy rule set or make changes to one or more rules, unprovisioned hosts that you boot are automatically provisioned according to the new rules. For all other hosts, Auto Deploy applies the new rules only when you test their rule compliance and perform remediation.
    This task assumes that your infrastructure includes one or more ESXi hosts provisioned with Auto Deploy, and that the host on which you installed VMware PowerCLI can access those ESXi hosts.

Prerequisites

  • Install VMware PowerCLI and all prerequisite software.
  • If you encounter problems running PowerCLI cmdlets, consider changing the execution policy.

Procedure changing the host profile used in the rule

  • Check which Auto Deploy rules are currently available. The system returns the rules and the associated items and patterns
  • Get-DeployRule
  • Make a change to one of the available rules, for example, you might change the image profile and the name of the rule. You cannot edit a rule already added to a rule set. Instead, you copy the rule and replace the item you want to change.
  • Copy-DeployRule -DeployRule testruleimageprofile -ReplaceItem DACVESX002_Host_Profile
  • Verify that the host that you want to test rule set compliance for is accessible.
    Get-VMHost -Name 10.1.1.100
  • Test the rule set compliance for that host and bind the return value to a variable for later use.
  • $tr = Test-DeployRuleSetCompliance 10.1.1.100
  • Examine the differences between what is in the rule set and what the host is currently using $tr.itemlist The system returns a table of current and expected items.
  • Remediate the host to use the revised rule set the next time you boot the host.
  • Repair-DeployRuleSetCompliance $tr

deployrulescompliance

What to do next

If the rule you changed specified the inventory location, the change takes effect immediately. For all other changes, boot your host to have Auto Deploy apply the new rule and to achieve compliance between the rule set and the host.

Please see Pages 81-85 of the vSphere Installation and Setup Guide

Configure Bulk Licensing

images

You can use the vSphere Client or ESXi Shell to specify individual license keys, or you can set up bulk licensing by using PowerCLI cmdlets. Bulk licensing works for all ESXi hosts, but is especially useful for hosts provisioned with Auto Deploy.

Assigning license keys through the vSphere Client or assigning licensing by using PowerCLI cmdlets functions differently as shown in the table below

license

Procedure

lic

Demo

  • Connect to vCenter and create the following 2 variables
  • $licenseDataManager = Get-LicenseDataManager
  • $hostContainer = Get-DataCenter -Name DataCenterName

bulklicense

  • Note this is as far as I can go as I don’t have any license keys 🙂

Utilise AutoDeploy cmdlets to deploy ESXi Hosts

index

Introduction

When you start a physical host set up for Auto Deploy, Auto Deploy uses a PXE boot infrastructure in conjunction with vSphere host profiles to provision and customize that host. No state is stored on the host itself, instead, the Auto Deploy server manages state information for each host.

  • The ESXi host’s state and configuration is run in memory
  • When the host is shutdown the state information is cleared from memory
  • Based on PXE Boot environments
  • Works with Image Buillder, vCenter Server and Host Profiles
  • Eliminates the need for a boot device
  • Common image across all hosts

With Autodeploy the previous boot device information is stored on the host and managed by vCenter

Image

Autodeploy Architecture

Capture

What does what?

Capture

 Rules engine

You specify the behavior of the Auto Deploy server by using a set of rules written in Power CLI. The Auto Deploy rule engine checks the rule set for matching host patterns to decide which items (image profile, host profile, or vCenter Server location) to provision each host with.

PowerCLI cmdlets are used to set, evaulate and update image profile and host profile rules

The Rules engine maps software images and host profiles to hosts based on the attributes of the host. For example

  • Rules can be based on IP or MAC Address
  • The -AllHosts option can be used for every host

What’s in the Rules engine?

Capture

What else is required?

req

Boot Process

process

AutoDeploy First Boot Process

Capture

AutoDeploy cmdlets

cmdlets

 Procedure

  • Log into PowerCLI and follow the below steps
  • Note to be careful with syntax and case sensitivity

Capture2

Demo

  • Log into PowerCLI
  • Type add-esxsoftwaredepot E:\Depot\VMware-ESXi-5.1.0-799733-depot.zip
  • Type get-esximageprofile
  • Type new-deployrule -name testruleimageprofile – item VMware-ESXi-5.1.0-799733-standard -allhosts

The above commands will add a software depot, get the ESXi image profiles then create a deployment rule named “testruleimageprofile” and will use the “VMware-ESXi-5.1.0-799733-standard” image profile or type in the customprofile you have created and will apply the rule to “Allhosts” or any ESXi host boots from it.

depot

  • Or
  • Log into PowerCLI
  • Type add-esxsoftwaredepot E:\Depot\VMware-ESXi-5.1.0-799733-depot.zip
  • Type get-esximageprofile
  • Type new-deployrule -name testruleimageprofile – item “ESXi-5.1.0-799733-standard”,”Cluster”,”DACVESX001 Host Profile” -pattern “ipv4=10.1.1.100-10.1.1.105”

The above commands will add a software depot, get the ESXi image profiles then create a deployment rule named “testruleimageprofile” and will use the “VMware-ESXi-5.1.0-799733-standard” image profile,  The Cluster Name “Cluster” and the Host Profile Name DACVESX001 Host Profile with a pattern to apply this to the IP range 10.1.1.100-10.1.1.105

autodeploynewrule

  • Click Enter and you should see the following screen appear

Capture

  • Add the second cluster rule

depot3

  • Once the deployment rules have been created successfully, add them to the working rule set by using the Add-DeployRule cmdlet. The following example adds the two deployment rules created previously to the working rule set
  • Add the Rules to the Working Rule Set
  • By default deploy rules are added to the active rule set. You add rules to the working rule set by including the -NoActivate flag when using the Add-DeployRule cmdlet.

depot2

  • Use the Get-DeployRuleSet to verify the rules were created

depot4

  • When the deployment rules have been added to the working rule set successfully, vSphere Auto Deploy will commence copying VIBs to the Auto Deploy server as required. In our case the VIBs associated with Brocade will be copied
  • Type Exit to Quit PowerCLI

Install the Auto Deploy Server

robot

What is Auto Deploy?

vSphere Auto Deploy can provision hundreds of physical hosts with ESXi software. You can specify the image to deploy and the hosts to provision with the image. Optionally, you can specify host profiles to apply to the hosts, and a vCenter Server folder or cluster for each host.

When a physical host set up for Auto Deploy is turned on, Auto Deploy uses a PXE boot infrastructure in conjunction with vSphere host profiles to provision and customize that host. No state is stored on the host itself. Instead, the Auto Deploy server manages state information for each host

Auto Deploy stores the information for the ESXi hosts to be provisioned in different locations. Information about the location of image profiles and host profiles is initially specified in the rules that map machines to image profiles and host profiles. When a host boots for the first time, the vCenter Server system creates a corresponding host object and stores the information in the database.

AutoDeploy Requirements

  • DHCP
  • DHCP Option 66: FQDN or IP Address of TFTP Server
  • DHCP Option 67: udionly.kpxe.vmw-hardwired – Name of GPXE Config file which we need the TFTP Server to direct the host to
  • Router Configuration – A setting to allow the DHCP
  • PXE
  • TFTP

Installation Instructions

  • Attach the vCenter ISO
  • Select AutoDeploy

Autodeploy1

  • Click Next

Autodeploy2

  • Click Next to the End User Patent Agreement

Autodeploy3

  • Click I accept to the Licensing agreement

Autodeploy4

  • Check Auto Deploy repository directory and repository maximum size

Autodeploy5

  • Put in vCenter Information

Autodeploy6

  • Trust the SSL Certificate

Autodeploy7

  • Check the ports

Autodeploy8

  • Check how your server is identified on the network

Autodeploy9

  • nn

Autodeploy10

  • Finish

Configure Advanced Boot Loader and Kernel Options

LogIcon

You can quickly deploy ESXi hosts using scripted, unattended installations or upgrades. Scripted installations, upgrades, or migrations provide an efficient way to deploy multiple hosts.
The installation or upgrade script contains the installation settings for ESXi. You can apply the script to all hosts that you want to have a similar configuration.

The installation or upgrade script can reside in one of the following locations:

  • FTP
  • HTTP/HTTPS
  • NFS
  • USB flash drive
  • CDROM

Enter Boot Options to Start an Installation or Upgrade Script

You can start an installation or upgrade script by typing boot command-line options at the boot command line.
At boot time you might need to specify options to access the kickstart file.

Procedure

  • You can enter boot options by pressing Shift+O in the boot loader.
  • For a PXE boot installation, you can pass options through the kernelopts line of the boot.cfg file.

KS

  • At the runweasel command prompt, type ks=location of installation script plus boot command line options
  • Example: ks=http://192.168.0.10/kickstart/ks_test.cfg nameserver=192.168.0.100 ip=192.168.0.210 netmask=255.255.255.0 gateway=192.168.0.254

The ESXi installer includes a default installation script that performs a standard installation to the first detected disk.

The default ks.cfg installation script is located in the initial RAM disk at /etc/vmware/weasel/ks.cfg. You can specify the location of the default ks.cfg file with the ks=file://etc/vmware/weasel/ks.cfg boot option

To get an idea how things work without writing installation script etc. Try installing a (virtual) ESXi host with the default ks.cfg installation script. At the weasel prompt, type:

ks=file://etc/vmware/weasel/ks.cfg

Kernel Options

The boot loader configuration file boot.cfg specifies

  • The kernel
  • The kernel options
  • The boot modules that the mboot.c32 boot loader uses in an ESXi installation.

The boot.cfg file is provided in the ESXi installer. You can modify the kernelopt line of the boot.cfg file to specify the location of an installation script or to pass other boot options.

This is useful while:

  • Creating an Installation .ISO with a custom installation or upgrade script;
  • Working with PXE booting the ESXi installer, using PXELINUX and a PXE or isolinux.cfg PXE configuration file.

Boot.cfg

The commands in boot.cfg configure the boot loader.

Capture

Identify ESXi Image Builder requirements

images

What is ESXi Image Builder CLI?

The ESXi Image Builder CLI is a set of PowerCLI cmdlets that you can use to manage vSphere image profiles and VIB packages, such as driver VIBs and update VIBs. You can also use Image Builder cmdlets to export an image profile to an ISO or offline depot ZIP file that you can use to install ESXi with a customized set of updates, patches, and drivers.

  • Manage software depots
  • Manage image profiles
  • Manage Software packages (VIBs).
  • Image profiles and VIBs specify the software you want to use during installation or upgrade of an ESXi host.

ESXi Image Builder Requirements

  • Microsoft .NET 2.0
  • Microsoft PowerShell 1.0 or 2.0
  • vSphere PowerCLI (includes Image Builder cmdlets)
  • Turn off IE ESC in Server Manager – Allows you to download TFTP Boot Zip file and AutoDeploy Log Files

Image Builder Overview

You use Image Builder cmdlets for managing the software to deploy to your ESXi hosts in several different scenarios.

scenario

The Image Builder PowerCLI cmdlets take image profiles and VIBs as input and produce different outputs.

inputoutput

Image Builder Architecture

Imagebuilder3

Terms and Definitions

VIB

Requirements

You can create a custom image profile from scratch or clone an existing profile and add or remove VIBs. A profile must meet the following requirements to be valid.

  • Each image profile must have a unique name and vendor combination.
  • Each image profile has an acceptance level. When you add a VIB to an image profile with an Image Builder PowerCLI cmdlet, Image Builder checks that the VIB matches the acceptance level defined for the profile.
  • You cannot remove VIBs that are required by other VIBs.
  • You cannot include two versions of the same VIB in an image profile. When you add a new version of a VIB, the new version replaces the existing version of the VIB.

Image Profile Validation

An image profile and its VIBs must meet several criteria to be valid.

  • Image profiles must contain at least one base VIB and one bootable kernel module
  • If any VIB in the image profile depends on another VIB, that other VIB must also be included in the image profile. VIB creators store that information in the SoftwarePackage object’s Depends property.
  • VIBs must not conflict with each other. VIB creators store conflict information in the SoftwarePackage object’s Conflicts property.
  • Two VIBs with the same name, but two different versions, cannot coexist. When you add a new version of a VIB, the new version replaces the existing version of the VIB.
  • No acceptance level validation issues exist.

When you make a change to an image profile, Image Builder checks that the change does not invalidate the profile.

Acceptance Levels

Each VIB is released with an acceptance level that cannot be changed. The host acceptance level determines which VIBs can be installed to a host. You can change the host acceptance levels with esxcli commands.

acceptancelevel

Create an Image Profile

Cloning a published profile is the easiest way to create a custom image profile. Cloning a profile is especially useful if you want to remove a few VIBs from a profile, or if you want to use hosts from different vendors and want to use the same basic profile, but want to add vendor-specific VIBs. VMware partners or large installations might consider creating a profile from scratch.

addprofile

Add VIBs to an Image Profile

You can add one or more VIBs to an image profile if that image profile is not set to ReadOnly. If the new VIB depends on other VIBs or conflicts with other VIBs in the profile, a message is displayed at the PowerShell prompt and the VIB is not added.
You can add VIBs from VMware or from VMware partners to an image profile. If you add VMware VIBs, the Image Builder PowerCLI performs validation. If you add VIBs from two or more OEM partners, no errors are reported but the resulting image profile might not work. Install VIBs from only one OEM vendor at a time.

Custom drivers can be found in the “Drivers & Tools” section in the vSphere 5.0 “Support and Downloads” pages.

Capture

Export an Image Profile to ISO or Offline Bundle ZIP

You can export an image profile to an ISO image or a ZIP file of component files and folders. You cannot create both by running the cmdlet once. You can use the ISO image as an ESXi installer or upload the ISO into vSphere Update Manager for upgrades. You can use the ZIP file, which contains metadata and the VIBs specified in the image profile, for upgrades to ESXi 5.0 and later.

Export an image profile to ISO from the PowerCLI prompt.

builder3

Export an image profile to an offline bundle ZIP from the PowerCLI prompt.

builder4

Demo

  • Log in to the console of the Windows system on which vCenter Server is installed with administrator privileges, either directly or by using RDP.
  • Download the ESXi Depot ZIP file from the VMware Web site to a location the PowerCLI Windows system can access.
  • Typically, you will start by downloading the VMware software depot from http://www.vmware.com/downloads. This depot contains the ESXi VIBs provided by VMware. Choose the zip file

zipfile

Capture

  • The file has a name that follows this pattern: VMware-Esxi-5.0.0-xxxxx-depot.zip.
  • Save the ZIP file to your local D:\ drive or any volume with enough space and note the location of the file. I am using E:\depot
  • Download a VIB from a manufacturers website like Brocade and save this into your depot

brocade

  • Start a PowerCLI session and run the following cmdlets at the prompt.
  • Connect-VIServer -Server your_vc_hostname -User username -Password password
  • Add-EsxSoftwareDepot E:\Depot\VMware-ESXi-5.1.0-799733-depot.zip
  • Add-EsxSoftwareDepot E:\Depot\BCD-bna-3.2.0.0-00000-offline_bundle-944129.zip

depot

  • Run Get-EsxImageProfile

depot2

  • Clone an existing profile to use as your starting point
  • New-EsxImageProfile -CloneProfile ESXi-5.1.0-799733-standard -name mycustomprofile -AcceptanceLevel PartnerSupported

DEPOT3

  • Next add the Brocade software package to the mycustomprofile
  • Type Get-ESXSoftwarePackage | where {$_.vendor -eq Brocade} to see your software

depot4

  • Then type Add-EsxSoftwarePackage -ImageProfile mycustomprofile -SoftwarePackage net-bna
  • Note you can also remove software by typing remove-esxsoftwarepackage -imageprofile mycustomprofile -softwarepackage net-bna

depot5

  • If you want you can compare the original profile with your custom profile to check the Software Package has been added
  • compare-esximageprofile and then input the Reference profile                                (ESXi-5.1.0-799733-standard) with the Comparison profile (mycustomprofile)

compare

  • After adding the VIBs, you need to save/export the Image Profile which you can do to a zip file or an ISO file

See below 2 commands (ZIP and ISO)

  • For ISO, type Export-EsxImageProfile -ImageProfile mycustomprofile -ExportToIso -FilePath E:\depot\MyCustomImage.iso
  • For ZIP, type Export-EsxImageProfile -ImageProfile mycustomprofile -ExportToIso -FilePath E:\depot\MyCustomImage.zip

Capture

  • Check the depot for your new custom iso

Capture

Given a Scenario, Determine when to Customize a Configuration

  • If you are deploying a single or a few hosts, you will tend to go for an interactive install.
  • When deploying a larger number of hosts, it is a good idea to choose a scripted installation or use Auto Deploy
  • Auto Deploy is under the highest licensing package VMware offer so the functionality depends on what licensing you have
  • Staff will require skills in command line configuration
  • Time taken to write scripts and test custom builds may be not feasible in some IT Departments

 

Identify custom installation options

index

Installing ESXi

vSphere 5.0 provides various options for installation and setup. To ensure a successful vSphere deployment, understand the installation and setup options, and the sequence of tasks required.
You have several options for installing and setting up ESXi, for managing vSphere with vCenter Server, the vSphere Client, and the vSphere Web Client, and for the database setup that you use with vCenter Server.

Options for installing ESXi

  • Interactive ESXi Installation

Interactive installations are recommended for small deployments of fewer than five hosts. You boot the installer from a CD or DVD, from a bootable USB device, or by PXE booting the installer from a location on the network. You follow the prompts in the installation wizard to install ESXi to disk.

  • Scripted ESXi Installation

Running a script is an efficient way to deploy multiple ESXi hosts with an unattended installation. The installation script contains the host configuration settings. You can use the script to configure multiple hosts with the same settings.  The installation script must be stored in a location that the host can access by HTTP, HTTPS, FTP, NFS, CDROM, or USB. You can PXE boot the ESXi installer or boot it from a CD/DVD or USB drive.

script

  • vSphere Auto Deploy ESXi Installation Option

With the vSphere Auto Deploy ESXi Installation, you can provision and reprovision large numbers of ESXi hosts efficiently with vCenter Server. Using the Auto Deploy feature, vCenter Server loads the ESXi image directly into the host memory. Auto Deploy does not store the ESXi state on the host disk. vCenter Server stores and manages ESXi updates and patching through an image profile, and, optionally, the host configuration through a host profile. You can create image profiles with ESXi Image Builder CLI, and host profiles using the vSphere Client.

The first time you install a host with Auto Deploy, the host PXE boots and establishes contact with the AutoDeploy server, which streams the image profile and any host profile to the host. The host starts, using the image profile, and Auto Deploy assigns the host to the appropriate vCenter Server system.
When you restart the host, vCenter Server uses the Auto Deploy feature to provision the host with the appropriate image and host profile. If the image profile changes, for example, for an update or patch, the administrator can propagate the change to all hosts that are provisioned with Auto Deploy and managed by a vCenter Server system. This ability makes Auto Deploy an efficient way to provision and reprovision large numbers of hosts, and to enforce compliance to a master ESXi image.