VMware VI3 - Sample ks.cfg for Deployed Installations

# Default Kickstart file for
# VMware ESX Server 3.01
# Jason M. Langone
# Veni, Vidi, Vici

# Hp storage device will be detected

# Installation Method
url --url ftp://anonymous:rdp@172.21.133.152/dslib/osdist/vmesx300/

# root password
# The MD5 encrypted string below is not for "password"
rootpw --iscrypted $1$yIJAh2dl$PcanBdoSOuvNeaBhV33Rt.

# Authconfig
auth --enableshadow --enablemd5

# Bootloader (GRUB or LILO)
bootloader --location=mbr

# Timezone
timezone US/Eastern

# X Windowing System
skipx

# Install or Upgrade
install

# Text mode
text

# Network install type
# Sample network config using a static ip and hostname
# network --bootproto static --ip=192.168.10.10 --netmask=255.255.255.0 --gateway=192.168.10.1 --nameserver=192.168.10.1 --hostname=esx1
# The hostname string below is replaced with the displayed
# computer name in the Altiris DS console during deployment.
network --bootproto dhcp --hostname ChangeMeBlade --addvmportgroup=1 --vlanid=0

# Language
lang en_US

# Language Support
langsupport --default en_US

# Keyboard
keyboard us

# Mouse
mouse none

# Reboot after install
reboot

# Firewall settings
firewall --disabled

# Partitioning
# %hddevice% is replaced with the detected storage device name by the
# vmesx.sh script executed on the target server.
# To specify specific or custom device names simply replace %hddevice%
# with specific device names ( Ex cciss/c0d0 ).

# Clear Partitions
clearpart --all --initlabel --drives=%hddevice%

#part /boot --fstype ext3 --size 100 --ondisk %hddevice%
#part / --fstype ext3 --size 5000 --ondisk %hddevice%
#part swap --size 1024 --ondisk %hddevice%
#part /var/log --fstype ext3 --size 1992 --ondisk %hddevice%
#part None --fstype vmkcore --size 100 --ondisk %hddevice%
# part None --fstype vmfs3 --size 10000 --grow --ondisk %hddevice%
part /boot --fstype ext3 --size 250 --ondisk %hddevice%
part / --fstype ext3 --size 5120 --ondisk %hddevice%
part swap --size 2048 --ondisk %hddevice%
part None --fstype vmfs3 --size 10000 --grow --ondisk %hddevice%
part None --fstype vmkcore --size 100 --ondisk %hddevice%
part /var/log --fstype ext3 --size 4096 --ondisk %hddevice%
part /home --fstype ext3 --size 2048 --ondisk %hddevice%
part /tmp --fstype ext3 --size 10240 --ondisk %hddevice%
vmaccepteula

#VMWare License information
# Host based or license server based
# Sample for server based licensing
# vmlicense --mode=server --server=27000@192.168.1.20 --edition=esxFull --features=vsmp,backup
# Host based licensing
# vmlicense --mode=file
# Add license text to vmlicense_text section at bottom of file.
vmlicense --mode=server --server=27000@canrvc1.americas.cshare.net --edition=esxFull --features=vsmp,backup

%packages
@base

# Post install
%post
# need to be here?
esxcfg-firewall --allowIncoming
esxcfg-firewall --allowOutgoing
mkdir /scripts
# Transfer the Altiris agent along with its config files
mkdir /tmp/altiris
cd /tmp/altiris
ftp -n < open 172.21.133.152
user anonymous rdp
binary
lcd /tmp/altiris
cd /dslib/osoem/altiris
mget altiris*.i386.bin
mget adlagent.conf.custom
mget adlagent.conf.default
lcd /scripts
cd /dslib/scripts
ascii
mget sst-*.sh
#mget sst-vmotion.sh
#mget sst-console.sh
#mget sst-ad.sh
#lcd /tmp/altiris
#cd /dslib/osoem/altiris
#binary
#prompt
#mget altiris*.i386.bin
#mget adlagent.conf.custom
#mget adlagent.conf.default
exit
EOF2
#mv /tmp/altiris/sst* /scripts
AltirisConfDir=/opt/altiris/deployment/adlagent/conf
# create script to configure ESX and install adlagent (called by rc.local)
cat > /tmp/altiris/hpinstall.sh << EOF1
#!/bin/bash
# Script to configure ESX and install adlagent. Called from rc.local.

# Firewall Configuration
# Enable adlagent and file transfer ports
# You need to set a static port ("4300" in this example) for file transfer in
# the deployment console under Tools->Options->Global
#
# Sort this out later
#esxcfg-firewall --openPort 402,tcp,out,adlagent
#esxcfg-firewall --openPort 4300,tcp,out,adlagentFileTransfer
#esxcfg-firewall --allowIncoming
#esxcfg-firewall --allowOutgoing

# Install Altiris Adlagent
cd /tmp/altiris
chmod +x altiris-adlagent*.bin
./altiris-adlagent*.i386.bin 1>>/root/install.rdp.log 2>>/root/install.rdp.log
# Install adlagent custom configuration
if [ -e adlagent.conf.custom ]; then
mv $AltirisConfDir/adlagent.conf $AltirisConfDir/adlagnet.conf.bak
cp -f adlagent.conf.custom $AltirisConfDir/adlagent.conf
elif [ -e adlagent.conf.default ]; then
mv $AltirisConfDir/adlagent.conf $AltirisConfDir/adlagent.conf.bak
sed -e "s/0.0.0.0/172.21.133.152/g" adlagent.conf.default > $AltirisConfDir/adlagent.conf
fi
# Reset adlagent to pick up config if necessary
/etc/init.d/adlagent stop
/etc/init.d/adlagent start

# Reset rc.local to original
mv -f /etc/rc.d/rc.local.sav /etc/rc.d/rc.local
EOF1
# End of script

# make hpinstall.sh executable
chmod +x /tmp/altiris/hpinstall.sh

# save a copy of rc.local
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.sav

# add hpinstall.sh to rc.local
cat >> /etc/rc.d/rc.local << EOF
cd /tmp/altiris
/tmp/altiris/hpinstall.sh
EOF

# Uncomment and paste license text for host based licensing.
#%vmlicense_text

- Jason Langone