More ESXi kickstarting – firstboot scripts

An example kickstart file could like look this, including a first boot script

vmaccepteula
rootpw letmein
autopart --firstdisk --overwritevmfs
install cdrom
network --bootproto=dhcp --device=vmnic0

%firstboot --unsupported --interpreter=busybox --level=900

vim-cmd hostsvc/enable_local_tsm
vim-cmd hostsvc/start_local_tsm

vim-cmd hostsvc/enable_remote_tsm
vim-cmd hostsvc/start_remote_tsm

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

And during the kickstart process, it will create the /vmfs/volumes/Hypervisor1/onetime.tgz file

You can look inside the ontime.tgz file, and you can see that it will include the firstboot scripts, which then get later cleaned up, including the /etc/vmware/init/init.d/900.firstboot_001 script which was contained within the kickstart :

# tar tzvf /vmfs/volumes/Hypervisor1/onetime.tgz
drwxr-xr-x 0/0         0 2010-10-04 10:26:56 etc/
drwxr-xr-x 0/0         0 2010-10-04 10:26:56 etc/vmware/
drwxr-xr-x 0/0         0 2010-10-04 10:26:56 etc/vmware/init/
drwxr-xr-x 0/0         0 2010-10-04 10:26:56 etc/vmware/init/init.d/
-r----x--t 0/0       135 2010-10-04 10:26:56 etc/vmware/init/init.d/900.firstboot_001
-r----x--t 0/0        61 2010-10-04 10:26:56 etc/vmware/init/init.d/999.firstboot_remove
-r----x--t 0/0        63 2010-10-04 10:26:56 etc/vmware/init/init.d/999.firstboot_password
-rw-r--r-T 0/0     27052 2010-10-04 10:26:56 etc/vmware/esx.conf
-rw-r--r-T 0/0         0 2010-10-04 10:26:56 etc/resolv.conf
-rw-r--r-T 0/0       183 2010-10-04 10:26:56 etc/hosts
drwxr-xr-x 0/0         0 2010-10-04 10:26:56 var/
drwxr-xr-x 0/0         0 2010-10-04 10:26:56 var/lib/
drwxr-xr-x 0/0         0 2010-10-04 10:26:56 var/lib/firstboot/
-r----x--t 0/0       596 2010-10-04 10:26:56 var/lib/firstboot/999.firstboot_remove.py
-r----x--t 0/0       316 2010-10-04 10:26:56 var/lib/firstboot/999.firstboot_password.py
drwxr-xr-x 0/0         0 2010-10-04 10:26:56 var/log/
-rw-r--r-- 0/0     16164 2010-10-04 10:26:56 var/log/esxi_install.log
Advertisements

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

%d bloggers like this: