Performing Scripted ESXi Installation

Interactive installations of ESXi are great in theory but what about when the datacenter scales in size? There are a few options when it comes to automating ESXi installation- one is the scripted installation.

Scripted installs rely on a ks.cfg file being specified to provide installation parameters. The following default script is held on RAM disk at /etc/vmware/weasel/ks.cfg

#
# Sample scripted installation file
#

# Accept the VMware End User License Agreement
vmaccepteula

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

# 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

# A sample post-install script
%post --interpreter=python --ignorefailure=true
import time
stampFile = open('/finished.stamp', mode='w')
stampFile.write( time.asctime() )

This will install ESXi on the first detected disk, set the root password to mypassword, set the management interface to be the first vmnic and get an address with DHCP.

Grab an ESXi ISO from My VMware.

When the Loading ESXi installer screen appears, press shift + o to enter boot options.

Enter the following to use the default ks.cfg script

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

Note- installation will pause and require interaction if no DHCP server is available.

The Kickstart script can also be placed on a FTP, HTTP, HTTPS or NFS server and grabbed using the following syntax. Note the IP configuration, which is given to the host in order to establish a connection to the network location

ks=nfs://10.0.104.2/volume1/scripts/ks.cfg nameserver=10.0.62.10 ip=10.0.62.60 netmask=255.255.255.0 gateway=10.0.62.254

Kickstart script options are available in VMware docs. Management network configuration may be specified, for example

network --bootproto=static --ip=10.0.62.61 --gateway=10.0.62.254 --netmask=255.255.255.0 --nameserver=10.0.62.10 --hostname=esxi01 --device=vmnic0

If all goes well, the final interaction will involve a simple slap on the old enter key

2 Comments

  1. Can you clarify a little for me? Can you specify management IP to use when actually calling the kickstart? I’m curious how others handle building hosts with static IP’s in a more automated fashion.

    1. You can specify a persistent management IP with the final code block in the article- “network –bootproto=static –ip=10.0.62.61 –gateway=10.0.62.254 –netmask=255.255.255.0 –nameserver=10.0.62.10 –hostname=esxi01 –device=vmnic0”

      How I’d automate building hosts depends on the scenario. I’ve managed a number of environments that use temporary IPs until they’re attached to host profiles with a static IP as part of the host customization; some hosts get their IPs with DHCP reservations, some are just done by hand.

      Hope this helps!

Leave a Reply

Your email address will not be published. Required fields are marked *