ESX ISO Builder CE: one unattended installer ISO per host, from a CSV

ESX ISO Builder CE logo

Installing ESX by hand is fine once. On the fourth host you start making typos: a wrong VLAN, a wrong IP, NTP forgotten, the self-signed certificate still on localhost.localdomain, and then the VCF Installer refuses the host. A kickstart file fixes that, but getting a kickstart file into the installer is the annoying part. You need a PXE setup, a web server the installer can reach, or you rebuild the ISO by hand for every host. That’s why I wrote ESX ISO Builder.

I’ve now published it as a community edition: ESX ISO Builder CE. It’s a container with a web UI. You give it a CSV with your hosts and a profile per hardware type, and it builds one bootable, fully unattended installer ISO per host. You mount that ISO as virtual media through the iDRAC, or through a GL.iNet Comet KVM on a mini PC, boot, and walk away. The host comes up with its static IP, VLAN, FQDN, DNS, NTP and a certificate that matches its name.

The code is on my GitHub: gertvangorp/ESX-ISO-Builder-CE. MIT license.

Read this first. The generated kickstart wipes all local disks of the host it boots (clearpart --alldrives): the boot disk, the vSAN disks, the NVMe tier device. That’s what you want for a clean vSAN ESA claim, and it’s exactly what you don’t want on a host with data you still need. It’s a community project, not supported by Broadcom, and some options in the example profiles are not supported on production hardware.

How it works

 CSV + profiles.yaml ──► KS.CFG per host ──► <host>-<version>.iso (BIOS + UEFI) ──► download / virtual media URL

Three things go in:

  • An inventory: a CSV with one row per host. Name, FQDN, IP, mask, gateway, VLAN, DNS, NTP, boot disk, ESX version, BMC address.
  • A profile per hardware type in profiles.yaml: the boot disk model, which vmnic carries management, advanced and kernel settings, extra lines for /etc/vmware/config, firstboot commands.
  • The base ISO: the ESX installer ISO you download from the Broadcom support portal yourself (or a vendor or custom image). No Broadcom bits are in the repo.

The effective setting for a host is defaults ← profile ← CSV cell. A non-empty CSV cell always wins. So the profile says “Dell R640 boots from DELLBOSS VD on vmnic1″, and you only override it for the one host that’s different.

Out comes a file like esx01-9.1.1.0.25714478.iso: the original ISO with a KS.CFG and patched BOOT.CFG files added. The version is in the name, so you can see at a glance what’s on a host.

The Hosts tab of ESX ISO Builder CE with the demo Dell R640 inventory
The Hosts tab with the demo Dell R640 inventory.

No extract, no rebuild

The classic way to customise an ESX ISO is: extract it, add the kickstart, edit boot.cfg, then rebuild it with mkisofs or genisoimage and the right El Torito flags for BIOS and UEFI. That works until Broadcom changes something in the ISO layout and your flags are wrong.

I didn’t want that. The builder uses xorriso to copy the original image and replay its own boot records (-boot_image any replay). It only maps three files into the new image: KS.CFG, /BOOT.CFG and /EFI/BOOT/BOOT.CFG. Whatever the original ISO does to boot on BIOS and UEFI, the new one does the same.

In both boot.cfg files the kernelopt line gets ks=cdrom:/KS.CFG, plus a few extra options I’ll come back to. After the build the tool reads the KS.CFG back out of the new ISO and compares it, and it checks that both the BIOS and the UEFI boot entries are still there. If either check fails, you get an error instead of an ISO that doesn’t boot.

What’s in the kickstart

You can preview the kickstart for every host in the UI (the KS button) before you build anything. For a demo R640 host it starts like this:

# boot.cfg kernelopt += netdevice=vmnic1 ip=10.0.10.11 netmask=255.255.255.0 gateway=10.0.10.1 nameserver=10.0.0.53 vlanid=10 ks=cdrom:/KS.CFG
vmaccepteula
rootpw --iscrypted <sha512-hash-of-ESXI_ROOT_PASSWORD>

clearpart --alldrives --overwritevmfs
install --firstdisk="DELLBOSS VD" --overwritevmfs --ignoreprereqwarnings

network --bootproto=static --device=vmnic1 --vlanid=10 --ip=10.0.10.11 --netmask=255.255.255.0 --gateway=10.0.10.1 --hostname=demo-r640-01.lab.example.com --nameserver="10.0.0.53,10.0.0.54" --addvmportgroup=0

reboot

A few details that cost me time to get right:

  • No clear-text root password in the ISO. The password sits in .env on the builder and is hashed with SHA-512 at build time. Only the hash goes in (rootpw --iscrypted).
  • No --overwritevsan. You’d expect it on a vSAN host, but the installer aborts with “disk … is not claimed by vSAN” when the boot disk itself is not a vSAN disk, like a Dell BOSS. clearpart --alldrives already wipes the vSAN disks, so the flag isn’t needed.
  • --firstdisk wants the full model string. FIKWOT FN955 1TB matches, FIKWOT doesn’t. When a host has several identical disks, use disk:<device id> in the CSV to point at one exact device.
  • The installer itself needs a network before it reads the kickstart. Without help it tries DHCP and sits on “Could not bring up network (Did not get an IP Address from DHCP server)” on a management VLAN without DHCP. The builder adds the same static IP, mask, gateway, DNS and VLAN as boot options in boot.cfg (netdevice=, ip=, vlanid=, …), so there’s no DHCP wait at all.

First boot: the settings kickstart can’t do

Kickstart sets the disk, password and network. Everything else runs in %firstboot:

  • FQDN and DNS search domain
  • NTP, verified afterwards, with a fallback to /etc/ntp.conf if esxcli didn’t stick during firstboot
  • SSH only if the profile says so (off by default: VCF 9.x doesn’t need it)
  • advanced settings, kernel settings and /etc/vmware/config lines from the profile
  • NVMe memory tiering, if you filled in TierDisk
  • a new self-signed certificate with CN = FQDN (/sbin/generate-certificates), because VCF validates that
  • /sbin/auto-backup.sh and a reboot when a setting needs one

The output goes to /var/log/esx-firstboot.log and to syslog. The file doesn’t always survive the final reboot, syslog does:

grep esx-firstboot /var/log/syslog.log | tail -50

One big catch: ESX does not run %firstboot on UEFI Secure Boot hosts. You’ll find this line in /var/log/kickstart.log:

SecureBoot is enabled, skipping execution of scripts in /var/lib/vmware/firstboot

So on Secure Boot hosts you get the install and the network, but no NTPnd no profile settings. Set use_firstboot: false in the profile for those hosts and apply the settings afterwards. That’s why the builder has an Ansible inventory export: per host it lists the IP, FQDN, BMC address, ISO URL and SHA-256, and also every post-install setting (NTP, DNS search, advanced and kernel settings, /etc/vmware/config lines, tiering) so your own automation can pick them up.

A quick check to see whether firstboot ran: esxcli system settings advanced list -o /UserVars/SuppressShellWarning shows 1 when it did.

NVMe memory tiering, without guessing

If you put the serial of the NVMe tier device in the TierDisk column, firstboot sets up memory tiering. On ESX 9.1 and later that’s esxcli memtier enable (in maintenance mode, no reboot). On ESXi 8.0 U3 and ESX 9.0 it uses the older tierdevice method, active after a reboot.

The script only uses a disk when exactly one local disk matches and that disk has no partitions. The boot disk always has partitions, so it can never be picked by accident. Zero or several matches, and it logs that and does nothing. A wrong tier device is not something you want a script to guess.

Profiles: Dell R640 and Minisforum MS-A2

The repo comes with two example profiles, for the hardware I use.

Dell PowerEdge R640: boot from the BOSS-S1 (DELLBOSS VD), management on vmnic1, iDRAC9 for virtual media. Short and boring, which is what a server profile should be.

Minisforum MS-A2 (Ryzen 9 9955HX, Zen 5) is my homelab. It collects every tweak that box needs:

SettingWhy
kernel entropySources=2RDRAND instead of the slow Zen 4/5 RDSEED (high CPU, Out of entropy in vmkernel.log)
cpuid.7.ebx = "-------------0------------------"Masks RDSEED from the VMs too
monitor_control.disable_apichv = "TRUE"Needed with NVMe memory tiering on Ryzen
cpuid.brandstring = "AMD EPYC Ryzen 9 9955HX"Passes the NSX Edge CPU check on consumer Ryzen
i40en LLDP=0,…X710 firmware LLDP agent off, one value per port, counted on the host
/Net/TcpipDefLROEnabled 0, /Net/UseHwTSO 0X710 hardware LRO/TSO off for vSAN ESA

I wrote about the i40en LLDP line before, in my post on the X710 and LLDP in vCenter. The value needs one entry per i40en port, and a wrong count can stop the driver from loading. So the profile counts the ports on the host with awk instead of hard-coding 0,0. The entropy and LRO/TSO settings come from William Lam’s posts, linked below. None of the MS-A2 tweaks are supported by Broadcom. They’re for a homelab.

Add your own hardware by copying a profile and changing it in the Profiles tab. Changes are picked up on the next preview or build, no restart needed.

Getting the ISO to the host

Every built ISO gets a URL under /media/, which you can download or hand to the BMC as virtual media. In my setup that’s two different things:

  • Dell R640: the iDRAC9, which mounts the ISO straight from the URL.
  • Minisforum MS-A2: a mini PC has no BMC of its own, so each node has a GL.iNet Comet KVM on it. The Comet gives you the remote console and virtual media, so you can mount the same per-host ISO there and boot from it, just like on the iDRAC. I wrote about that setup in Making the Minisforum MS-A2 datacenter-ready: out-of-band management without iDRAC. That’s why the MS-A2 profile has bmc_type: comet and the CSV has the Comet’s FQDN in BmcAddress.

The iDRAC9 gave me two quirks:

  • iDRAC9 reads the ISO slowly over HTTPS: lots of small range requests, with TLS on the iDRAC’s own CPU. Over plain HTTP it’s much faster.
  • iDRAC9 does not answer a Basic auth challenge on plain HTTP. You see one HEAD … 401 in the builder log and an InsertMedia error “Unable to locate the ISO or IMG image file” in the iDRAC.

The fix for both is an optional second listener: media-only, plain HTTP, which serves nothing but /media/*.iso and /healthz. With MEDIA_HTTP_ALLOW you allow your BMC subnet without a login. Everything else still needs the UI or the media account. Restrict that port to the BMC subnet in your firewall as well.

If the iDRAC gives a Redfish 400 QueryNotSupported when you use the builder by FQDN but it works by IP, that’s the iDRAC Host Header Check. Set the DNS iDRAC name and a static DNS domain under iDRAC Settings → Network → Common.

Setting up ESX ISO Builder

You need a Docker host on the management network. Run it outside the clusters you’re rebuilding, so you don’t saw off the branch you’re sitting on.

git clone https://github.com/gertvangorp/ESX-ISO-Builder-CE.git && cd ESX-ISO-Builder-CE
cp .env.example .env && chmod 600 .env && vi .env
mkdir -p data/iso certs && sudo chown -R 10001:10001 data
docker compose up -d --build

In .env you set the ESX root password (or a ready-made hash from openssl passwd -6), the UI login, a separate read-only media login and PUBLIC_URL. Nothing is hard-coded in the repo, and .env belongs in your password manager, not in a Git repo.

Then open https://<host>:8443/. It serves plain HTTP until you put a certificate in certs/server.crt and certs/server.key. The container runs read-only, as a non-root user, with all capabilities dropped.

On the first start you get two demo inventories (an R640 and an MS-A2 cluster, on example.com) and the example profiles.yaml. Replace them with your own hosts.

  1. ISO library: upload the ESX installer ISO, or copy it to data/iso/. The file name must contain the version you use in the CSV, for example ESX-9.1.1.0.25714478-custom.iso.
  2. Hosts: import your CSV or add hosts one by one. The host editor validates while you type: gateway in the subnet, no duplicate IPs or names, and a live DNS check for the A and PTR record. VCF needs both, and it’s nicer to see a red line here than an error in the VCF Installer an hour later.
The ESX ISO Builder CE host editor with live validation and DNS check
The host editor with live validation. The demo FQDN doesn’t resolve, so the DNS check shows it right away.
  1. KS: preview the kickstart for a host.
  2. Build one host or Build all enabled. With Build with you can build the whole inventory against another ESX version for one run, without touching the CSV.
  3. Mount the ISO as virtual media on the iDRAC or the Comet, boot from it once, and wait.

To find the boot disk model or a tier disk serial, run this on a host or in the installer console (Alt+F1, root, empty password):

esxcli storage core device list | grep -E '^(t10|naa|eui|mpx)|Model:'

Backup and the API

The Backup tab saves profiles.yaml, every inventory and the build manifests. Before every change the tool takes a restore point by itself, and a restore runs as a dry run first. The ISOs and .env are not in the backup.

Everything in the UI is also in the REST API (OpenAPI at /api/docs), with the same login. Calls that change something need the header X-Builder: 1. To pull a backup off the box every night:

curl -u admin -H 'X-Builder: 1' https://esx-builder.example.com:8443/api/backup -o esx-builder-backup.zip

Wrap-up

  • One CSV row and one profile per hardware type give you one unattended installer ISO per host, with static IP, VLAN, FQDN, DNS, NTP and a certificate that matches the name.
  • xorriso replays the original BIOS and UEFI boot records, so there’s no extract and rebuild that breaks when the ISO layout changes.
  • The installer gets its static network as boot options: no DHCP needed on the management VLAN.
  • %firstboot doesn’t run on Secure Boot hosts. Use use_firstboot: false there and take the settings from the Ansible inventory export.
  • The kickstart wipes every local disk. Check the inventory before you boot an ISO.

Try it, break it, and open an issue on GitHub if something doesn’t work on your hardware: gertvangorp/ESX-ISO-Builder-CE.

References

2 Replies to “ESX ISO Builder CE: one unattended installer ISO per host, from a CSV”

  1. Testing this out- Trying to figure out how to pass the idrac user information over to the idrac system.
    It did a great job of pulling the ip address from dns based on the computer name.
    This is very well thought out.

    1. the intention is to do that in an ansible kind of automation. Building that in the lab as we speak. Fir the iso builder it is just building the SIO, not connection it to the idrac. the info in the CSV file will be used in the automation part coming in the near future.
      Gert

Leave a Reply

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