VCP 6 Study Note – Multiple ways to install ESXi

All of us know the direct installation via media, which is the most used by many folks during “poor” cluster installation (up to 6 nodes installation). But in this post I would highlight other installation methods, extracting pieces of infos from official docs:

https://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vsphere.install.doc/GUID-D0A72192-ED00-4A5D-970F-E44B1ED586C7.html

Scripted installation

It’s possible to perform scripted way to install and upgrade esxi host. The installation/upgrade script must reside in these location:

  • FTP server
  • HTTP/HTTPS server
  • NFS server
  • USB Flash drive
  • CD-ROM drive

Scripted installation could be performed with these options:

  • Install on first disk on multiple machines (one script)
  • Install on different machine disks for each machine

The way to perform scripted installation are:

image

 

About script

The installation script ks.cfg contains commands to be used during installation:

  • accepteula or vmaccepteula (required)
  • clearpart (optional) –> clear existing partitions
  • dryrun (optional)  -> check only
  • install –> fresh installation
  • installorupgrade
  • keyboard (optional)
  • serialnum or vmserialnum –> specify license key
  • network (optional)
  • paranoid (optional) –> waring messages interrupts installation
  • part or partition (optional) –> creates additional VMFS datastore
  • reboot (optional)
  • rootpw (required) –> root password
  • upgrade
  • %include or include (optional) –> include more file cfg (example %include part.cfg)
  • %pre (optional) –> script to run before the kickstart configuration is evaluated
  • %post (optional) –> script after package installation is complete
  • %firstboot –> init script that runs only during the first boot

Boot loader confg file is located in boot.cfg., and includes kernel options and modules to use during installation.

Example:

Auto Deploy

Auto deploy method is useful to deploy hundred of ESXi hosts, specifying image to deploy and the host to provision and optionally attach an host profile.

Auto Deploy uses PXE boot infrastructure in conjunction with vSphere host profiles to provision and customize that host. It stores the information for the ESXi hosts to be provisioned in different locations. Following the sotres information:

  • Image state (exec to run ESXi host and created with PowerCLI Image Builder)
  • Configuration state (Config settings eg: vSwitch, driver settings and boot parameters)
  • Dynamic State (Runtime state like generate private keys)
  • Virtual machine state (VM stored on a host and VM autostart info)
  • User input (store based on user input like IP address,… )

It’s possible to specify the behavior of the Auto Deploy server by using a set of rules written in PowerCLI. Rules engine maps software and configuration settings to hosts based on the attributes of the host. The rules engine includes rules and rule sets:

  • Rules: can assign image profiles and host profiles to a set of hosts, or specify the location (folder or cluster) of a host on the target vCenter Server system. can identify hosts by:
    • boot MAX address
    • SMBIOS info
    • BIOS UUID
    • Vendor
    • Model
    • fixed DHCP IP address
  • Active Rule Set: when host contacts auto  deploy server, active rule set will checks before provide image profile.
  • Working Rule Set: allows to test changes before making change active.

Rule workflow:

  1. Make changes to working rule set
  2. Use cmdlets to execute the working rule
  3. Refine and retest the rules
  4. Activate the rules in working rule set

There are some prerequisite for the First Boot:

  • 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 iPXE boot loader from
  • Verify that the Auto Deploy server has an IPv4 address. PXE booting is supported only with IPv4
  • Identify an image profile to be used (ESXi profile public image or create new with PowerCLI Image Builder )
  • 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 active rule set

First Boot process:

image

Boot process:

  1. When the administrator turns on a host, the host starts a PXE boot sequence –> DHCP assign IP to cotact TFTP server
  2. The host contacts the TFTP server and downloads the iPXE file and iPXE config file
  3. iPXE starts executing –> make HTTP boot request to Auto Deploy Server
  4. Auto Deploy perform_
    1. query rules engine
    2. Streams components specified in image profile (and optional vCenter location  info)
  5. The host boots using the image profile
  6. Auto Deploy adds the host to the vCenter Server system that Auto Deploy is registered with.
  7. 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. It is necessary to reapply host profile and update host customization before exit maintenance mode.
  8. If the host is part of a DRS cluster, virtual machines from other hosts might be migrated to the host after the host has successfully been added to the vCenter Server system

 

image

 

Quickstart

  1. Install vCenter and vCenter Server components (or vCenter Server Appliance) –> Auto Deploy is included in management node
  2. Install PowerCLI
  3. Find image profile that includes VIBs you want deploy to hosts:
    1. Add the depots containing the required software to your vSphere PowerCLI session
    2. To create a custom image profile, use Image Builder cmdlets to clone an existing image profile and add the custom VIBs to the clone
  4. Use the New-DeployRule vSphere PowerCLI cmdlet to write a rule that assigns the image profile to one host, to multiple hosts specified by a pattern, or to all hosts
  5. Power on the host to have Auto Deploy provision the host with the specified image profile.
  6. Set up the host you provisioned as a reference host for your host profile
  7. Create and export a host profile for the reference host.
  8. To provision multiple hosts, you can use the Copy-DeployRule cmdlet
  9. Power on the hosts that you want to provision
  10. Verify that the hosts you provisioned meet the following requirements
    1. Each host connected to vCenter
    2. hosts are not in maintenance mode
    3. hosts have no compliance failures
    4. each host with host profile with user input has up-to-date informations

In depth there are more steps to do preparing a vSphere with Auto Deploy environment:

Auto Deploy Proof of Concept Setup: https://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vsphere.install.doc/GUID-A9FFEDEE-1A3D-4EFD-A130-F6E78C727380.html

 

Image Builder

vSphere ESXi Image Builder is a set of vSphere PowerCLI cmdlets that you can use to manage vSphere image profiles and VIB packages, such as driver VIBs and update VIBs. Before you can run vSphere ESXi Image Builder cmdlets, you must install vSphere PowerCLI and all prerequisite software: ESXi Image Builder snap-in is included with the vSphere PowerCLI installation.

With ESXi Image Builder is possible to:

  • Clone Image Profile (New-EsxImageProfile –CloneProfile …  )
  • Add VIBs to an Image Profile (Add-EsxSoftwarePackage -ImageProfile My_Profile…)
  • Export Image Profile to ISO (or Offline ZIP Bundle) (Export-EsxImageProfile -ImageProfile “myprofile”…)
  • Preserve Image Profile Across Sessions
  • Compare Image Profiles
  • Compare VIBs

Here vSphere Image Builder Workflows: https://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vsphere.install.doc/GUID-724A9B8F-968F-42C0-A286-1F5197E0604E.html