Automate ESXi deployment with ks.cfg and IIS

Hi

In my previous post I discussed the procedure to deploy EFI-based ESXi through WDS (Windows Deployment Services). Make sure to go through that post before diving into this one

There are some great documents online discussing the way to use ks.cfg file to automate your ESXi deployment. If you’re unfamiliar with the concept of a scripted ESXi installation or the use of a ks.cfg file, I suggest you start here and get yourself familiarized with the idea

I’m not here to teach you about ks.cfg. Honestly, I’m just starting to use it myself and getting to know it’s full potential. What I wanted to do is take the setup I prepared in my previous post and embed the ks.cfg into it.

Meaning, I already deploy ESXi through WDS. The missing step to make the deployment fully automatic is to host the ks.cfg file on the WDS server to make it accessible to the ESXi host during deployment.

The ks.cfg file should be stored in a network-accessible location so the ESXi host can reach it. There are several options (Website, FTP Site, NFS share and a few others). I decided to use the website option and store it on the WDS. Why? Same reason as before – to keep my deployment mechanism centralize, simple and easy to manage for a windows admin

So what we will do?

  • Prepare a simple ks.cfg file
  • Install IIS (Microsoft Web Server) on the WDS server and store the ks.cfg on the website
  • Configure the boot.cfg file (used in the previous post) to point the ESXi to the ks.cfg file

KS.CFG Preperations

This is simple. Create a file in notepad and save it with the name ks.cfg in a folder on your WDS server. Here is a sample configuration:

#
# JungoPro scripted installation file
#

# Accept the VMware End User License Agreement
vmaccepteula

# Set the root password for the DCUI and Tech Support Mode
rootpw pleasechangeme

# Install on the first local disk available on machine
install --firstdisk --overwritevmfs

# Set the network to DHCP on the first network adapter
network --bootproto=dhcp --device=vmnic0

This is the basic ks.cfg you get from the VMware documentation. It configures the following steps in the installation:

  • Accepts the EULA
  • Sets the password for the root user (that you use to login to the ESXi)
  • Installs the vSphere OS on the first disk in the server
  • Sets the first Network adapter to use DHCP

Obviously there is a lot more to this file and you can get very creative. Also, it may not be a good practice to use a single ks.cfg for multiple ESXi deployments. As I said, I’m not going to dive deep into the ks.cfg configuration and options. I’m here for the WDS integration piece

Website Installation & Configuration

  • Open Server Manager, Click Add Roles and Features, Select Web Server (IIS), Click Install.
  • Create folder inside C:\inetpub\wwwroot\ and name it kickstart. Place the ks.cfg file inside kickstart folder.
  • Open IIS manager. Right click the Default web site and choose Add virtual directory. Specify physical path as C:\inetpub\wwwroot\kickstart
  • Double-click the MIME Types icon. In the Actions pane, click Add. Fill the File Name Extension box with * and the MIME Type box with application/octet-stream

Boot.cfg Configuration

Boot.cfg is located under RemotInst\Boot\x64\ESXi6U2 (assuming you used the setup in my previous post. If you changed locations, it should be in the folder where you extracted the contents of the ESXi ISO)

You should have a line stating

kernelopt=runweasel

Change it to

kernelopt=ks=http://192.168.1.100/kickstart/ks.cfg

Where 192.168.1.100 is the IP of your Website and /kickstart/ks.cfg is the relative path to the location of the ks.cfg file.

Your final boot.cfg file (after the changes in the the previous post and this post) should look like this:

bootstate=0
title=Loading ESXi installer
timeout=5
kernel=tboot.b00
kernelopt=ks=http://192.168.1.100/kickstart/ks.cfg
prefix=/Boot/x64/ESXi6U2
modules=b.b00 --- jumpstrt.gz --- useropts.gz --- k.b00 --- chardevs.b00 --- a.b00 --- user.b00 --- uc_intel.b00 --- uc_amd.b00 --- sb.v00 --- s.v00 --- mtip32xx.v00 --- ata_pata.v00 --- ata_pata.v01 --- ata_pata.v02 --- ata_pata.v03 --- ata_pata.v04 --- ata_pata.v05 --- ata_pata.v06 --- ata_pata.v07 --- block_cc.v00 --- ehci_ehc.v00 --- elxnet.v00 --- emulex_e.v00 --- weaselin.t00 --- esx_dvfi.v00 --- esx_ui.v00 --- ima_qla4.v00 --- ipmi_ipm.v00 --- ipmi_ipm.v01 --- ipmi_ipm.v02 --- lpfc.v00 --- lsi_mr3.v00 --- lsi_msgp.v00 --- lsu_hp_h.v00 --- lsu_lsi_.v00 --- lsu_lsi_.v01 --- lsu_lsi_.v02 --- lsu_lsi_.v03 --- lsu_lsi_.v04 --- misc_cni.v00 --- misc_dri.v00 --- net_bnx2.v00 --- net_bnx2.v01 --- net_cnic.v00 --- net_e100.v00 --- net_e100.v01 --- net_enic.v00 --- net_forc.v00 --- net_igb.v00 --- net_ixgb.v00 --- net_mlx4.v00 --- net_mlx4.v01 --- net_nx_n.v00 --- net_tg3.v00 --- net_vmxn.v00 --- nmlx4_co.v00 --- nmlx4_en.v00 --- nmlx4_rd.v00 --- nvme.v00 --- ohci_usb.v00 --- qlnative.v00 --- rste.v00 --- sata_ahc.v00 --- sata_ata.v00 --- sata_sat.v00 --- sata_sat.v01 --- sata_sat.v02 --- sata_sat.v03 --- sata_sat.v04 --- scsi_aac.v00 --- scsi_adp.v00 --- scsi_aic.v00 --- scsi_bnx.v00 --- scsi_bnx.v01 --- scsi_fni.v00 --- scsi_hps.v00 --- scsi_ips.v00 --- scsi_meg.v00 --- scsi_meg.v01 --- scsi_meg.v02 --- scsi_mpt.v00 --- scsi_mpt.v01 --- scsi_mpt.v02 --- scsi_qla.v00 --- uhci_usb.v00 --- vsan.v00 --- vsanheal.v00 --- vsanmgmt.v00 --- xhci_xhc.v00 --- tools.t00 --- xorg.v00 --- imgdb.tgz --- imgpayld.tgz
build=
updated=0

Done!

Go ahead and deploy your ESXi through WDS. At this point you should just boot from network when you start the ESXi host. If you followed the steps in the previous post and assigned the mboot.efi as the NBP, the entire installation will continue without any user intervention.

Quick Tip

To simplify my deployment automation and to avoid dealing with different ks.cfg configuration or user input for the IP assignment, I simply use reservations on my DHCP server. By doing this I can leave the DHCP configuration in the ks.cfg file while still keeping the same IP for the ESXi host

Good luck!

Advertisements

One thought on “Automate ESXi deployment with ks.cfg and IIS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s