BootstrapVM für ESXi-Installation

Eine einfache BootstrapVM zur Masseninstallation.

Um mehrere Server auf einmal zu installieren, hat mir das Ding schon ein paar mal das Leben einfacher gemacht. Die Version hier ist auf einem CentOS installiert, funktioniert aber genau so gut auf einem Debian, ausser das die Firewallrules anders definiert werden müssen.

DHCP Server

yum update dhcp
sudo firewall-cmd --add-service=dhcp --permanent
vi /etc/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;

option domain-name-servers 172.16.0.130;
option domain-name "lab.infra";

# 172.16.0.129 - 172.16.0.158
subnet 172.16.0.128 netmask 255.255.255.224 {
  range 172.16.0.136 172.16.0.158;
  option routers 172.16.0.129;
  next-server 172.16.0.130;
  option bootfile-name "/image/esxi.70u3d/mboot.efi";
}

host esxi01 {
  hardware ethernet 00:50:56:9f:57:36;
  fixed-address 172.16.0.141;
  option host-name esxi01;
}

host esxi02 {
  hardware ethernet 00:50:56:9f:62:64;
  fixed-address 172.16.0.142;
  option host-name esxi02;
}

host esxi03 {
  hardware ethernet 00:50:56:9f:10:cd;
  fixed-address 172.16.0.143;
  option host-name esxi03;
}

host esxi04 {
  hardware ethernet 00:50:56:9f:e9:4f;
  fixed-address 172.16.0.144;
  option host-name esxi04;
}

Tipp: Du kannst auch “filename” nutzen, um das efi-Image mitzugeben, damit verändert sich aber das Verhalten vom EFI darin, dass er nicht mehr nach der boot.cfg im root-Verzeichnis vom TFTP sucht, sondern im root-Verzeichnis vom Image.

TFTP Server

sudo yum install tftp-server
sudo firewall-cmd --add-service=tftp --permanent

Prepare Image

cd /var/lib/tftpboot
mkdir image
mkdir image/iso
  • Upload image in folder image (WinSCP or scp)
cd image
mount VMware-VMvisor-Installer-7.0.0.update03-19482537.x86_64-DellEMC_Customized-A04.iso iso
cp -R iso esxi.70u3d
umount iso

Copy EFI Image

# EFI Boot unsigned
cp esxi.70u3d/efi/boot/bootx64.efi esxi.70u3d/mboot.efi

Prepare boot.cfg

cd /var/lib/tftpboot
cp image/esxi.70u3d/boot.cfg boot.cfg
vi boot.cfg
  • Remove cdrom from kernelopt
  • Remove / from each module
  • Modify prefix
  • Modify kernel
  • Add kernelopt=ks=http://172.16.0.130/staging/default.cfg
bootstate=0
title=Loading ESXi installer
timeout=5
prefix=/image/esxi.70u3d
kernel=/image/esxi.70u3d/b.b00
kernelopt=runweasel
modules=jumpstrt.gz --- useropts.gz --- features.gz --- k.b00 --- uc_intel.b00 --- uc_amd.b00 --- uc_hygon.b00 --- procfs.b00 --- vmx.v00 --- vim.v00 --- tpm.v00 --- sb.v00 --- s.v00 --- bnxtnet.v00 --- bnxtroce.v00 --- dellshar.v00 --- lsimr3.v00 --- lsimsgpt.v00 --- dell_dcu.v00 --- dell_osn.v00 --- i40en.v00 --- icen.v00 --- igbn.v00 --- irdman.v00 --- ixgbenen.v00 --- ixgben.v00 --- nmlx5cor.v00 --- nmlx5rdm.v00 --- qlnative.v00 --- qcnic.v00 --- qedentv.v00 --- qedf.v00 --- qedi.v00 --- qedrntv.v00 --- qfle3.v00 --- qfle3f.v00 --- qfle3i.v00 --- atlantic.v00 --- brcmfcoe.v00 --- elxiscsi.v00 --- elxnet.v00 --- iavmd.v00 --- ionic_en.v00 --- iser.v00 --- lpfc.v00 --- lpnic.v00 --- lsi_msgp.v00 --- lsi_msgp.v01 --- mtip32xx.v00 --- ne1000.v00 --- nenic.v00 --- nfnic.v00 --- nhpsa.v00 --- nmlx4_co.v00 --- nmlx4_en.v00 --- nmlx4_rd.v00 --- ntg3.v00 --- nvme_pci.v00 --- nvmerdma.v00 --- nvmetcp.v00 --- nvmxnet3.v00 --- nvmxnet3.v01 --- pvscsi.v00 --- qflge.v00 --- rste.v00 --- sfvmk.v00 --- smartpqi.v00 --- vmkata.v00 --- vmkfcoe.v00 --- vmkusb.v00 --- vmw_ahci.v00 --- bmcal.v00 --- crx.v00 --- elx_esx_.v00 --- btldr.v00 --- esx_dvfi.v00 --- esx_ui.v00 --- esxupdt.v00 --- tpmesxup.v00 --- weaselin.v00 --- esxio_co.v00 --- loadesx.v00 --- lsuv2_hp.v00 --- lsuv2_in.v00 --- lsuv2_ls.v00 --- lsuv2_nv.v00 --- lsuv2_oe.v00 --- lsuv2_oe.v01 --- lsuv2_oe.v02 --- lsuv2_sm.v00 --- native_m.v00 --- trx.v00 --- vdfs.v00 --- vmware_e.v00 --- vsan.v00 --- vsanheal.v00 --- vsanmgmt.v00 --- tools.t00 --- dell_con.v00 --- xorg.v00 --- gc.v00 --- imgdb.tgz --- basemisc.tgz --- resvibs.tgz --- imgpayld.tgz
build=7.0.3-0.35.19482537
updated=0
kernelopt=ks=http://172.16.0.130/staging/default.cfg

Create Host with central boof.cfg

mkdir 01-00-50-56-9f-57-36
ln -L boot.cfg 01-00-50-56-9f-57-36/boot.cfg

Create Host with own boof.cfg to own StagingScript

mkdir 01-00-50-56-9f-57-36
cp boot.cfg 01-00-50-56-9f-57-36/boot.cfg

Modify boot.cfg to specific kickstart

vi 01-00-50-56-9f-57-36/boot.cfg
kernelopt=ks=http://172.16.0.130/staging/esxi01.lab.infra.cfg

HTTP Server

sudo yum install httpd
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-service=https --permanent

Create default kickstartfile

mkdir /var/www/html/staging
cd /var/www/html/staging
vi default.cfg
# Accept the VMware End User License Agreement
vmaccepteula

# Set the root password for the DCUI and Tech Support Mode
rootpw --iscrypted $1$gsRCjXNy$imNuMmqVv11carrUbWgaY0

# 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

# Sets the keyboard type for the system
keyboard "Swiss German"

# Reboots the machine after the scripted installation is complete
reboot

# Works only with disabled secure boot
%firstboot --interpreter=busybox
esxcli system maintenanceMode set -e true
esxcli network ip set --ipv6-enabled=false
esxcli system shutdown reboot -d 15 -r "apply firstboot settings"

How-to crpyted root password

openssl passwd -1 PASSWORD

Create a host specific kickstart with including default

vi esxi01.lab.infra.cfg
%include http://172.16.0.130/staging/default.cfg

Leave a Reply

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