I have created a KS file for a scripted install, but my post script does not work. Is there any one out there that can take a look at my ks script and tell me what i'm doing wrong. I have changed the ip addresses to show x.x for security reasons upon this post.
\# Auto-Generated Scripted Install Configuration file.
\# This file is used for VMware ESX Server Scripted Install Deployment
\# Installation Method
cdrom
\# Network install type
network --bootproto dhcp --addvmportgroup=1 --vlanid=0
\# root Password
rootpw --iscrypted $1$9ZUszcYV$LV8bV21u6/9kLMqtch5vN0
\# Authconfig
auth --enableshadow --enablemd5
\# BootLoader ( The user has to use grub by default )
bootloader --location=mbr
\# Timezone
timezone America/New_York
\# X windowing System
skipx
\# Install or Upgrade
install
\# Text Mode
text
\# Language
lang en_US
\# Langauge Support
langsupport --default en_US
\# Keyboard
keyboard us
\# Mouse
mouse none
\# Reboot after install ?
reboot
\# Firewall settings
firewall --disabled
\# Clear Partitions
clearpart --all --initlabel --drives=cciss/c0d0
#clearpart --all --initlabel --drives=sda
\# Partitioning
#IBM
#part /boot --fstype ext3 --size 512 --ondisk sda
#part / --fstype ext3 --size 8192 --ondisk sda
#part swap --size 2048 --ondisk sda
#part None --fstype vmfs3 --size 1 --grow --ondisk sda
#part None --fstype vmkcore --size 110 --ondisk sda
#part /var/log --fstype ext3 --size 2048 --ondisk sda
#part /var --fstype ext3 --size 2048 --ondisk sda
#part /tmp --fstype ext3 --size 2048 --ondisk sda
#part /vmimages --fstype ext3 --size 8192 --ondisk sda
#HP
part /boot --fstype ext3 --size 512 --ondisk cciss/c0d0
part / --fstype ext3 --size 8192 --ondisk cciss/c0d0
part swap --size 2048 --ondisk cciss/c0d0
part None --fstype vmfs3 --size 1 --grow --ondisk cciss/c0d0
part None --fstype vmkcore --size 110 --ondisk cciss/c0d0
part /var/log --fstype ext3 --size 2048 --ondisk cciss/c0d0
part /var --fstype ext3 --size 2048 --ondisk cciss/c0d0
part /tmp --fstype ext3 --size 2048 --ondisk cciss/c0d0
part /vmimages --fstype ext3 --size 8192 --ondisk cciss/c0d0
\# VMware Specific Commands
vmaccepteula
vmlicense --mode=server --server=27000@x.x.0.13 --edition=esxFull
%packages
@base
%vmlicense_text
%post
echo "Running Post Installation Configuration"
cp /etc/rc.d/rc.local /etc/rc.d/ORIG.rc.local
cat > /etc/rc.d/rc.local <<EOF1
cd /tmp
/tmp/VMCfg.sh
EOF1
touch /tmp/VMCfg.sh
chmod +x /tmp/VMCfg.sh
cat > /tmp/VMCfg.sh <<EOF
#!/bin/sh
touch /root/PostInstall.log
echo "VMWare ESX Post Install Script" > /root/PostInstall.log
echo "Setting Variables" >> /root/PostInstall.log
#Server Variables
SRVNAME=vm-x365-4
SCIP=x.x.0.159
DGIP=x.x.10.1
MASK1=255.255.0.0
VMOT=x.x.0.160
echo "Deleting current network configuration" >> /root/PostInstall.log
/usr/sbin/esxcfg-vswtich vSwitch0 -D "VM Network"
/usr/sbin/esxcfg-vswitch -U vmnic0 vSwitch0
/usr/sbin/esxcfg-vswitch -U vmnic1 vSwitch0
/usr/sbin/esxcfg-vswif -d vswif0
/usr/sbin/esxcfg-vswitch -d vSwitch0
echo "Setting Service Console and VMotion network" >>/root/PostInstall.log
#Service Console Setup
#Create a VSwitch0 and Port Groups
/usr/sbin/esxcfg-vswitch -a vSwitch0:32
/usr/sbin/esxcfg-vswitch -A "Service Console" vSwitch0
/usr/sbin/esxcfg-vswitch -A "Service Console" vSwitch0 -v 1720
/usr/sbin/esxcfg-vswitch -A "VMotion" vSwitch0
/usr/sbin/esxcfg-vswitch -A "VMotion" vSwitch0 -v 1720
#Link an ethernet port to the Vswitch
/usr/sbin/esxcfg-vswitch -L vmnic0 vSwitch0
/usr/sbin/esxcfg-vswitch -L vmnic1 vSwitch0
#Create vSwif0
/usr/sbin/esxcfg-vswif -a vswif0 -i $SCIP -n $MASK1 -p "Service Console"
#Create VMotion VMKernel Port
/usr/sbin/esxcfg-vmknic -a -i $VMOT -n $MASK1 "VMotion"
/usr/sbin/esxcfg-route x.x.10.1
echo "Service Console and VMotion has been created" >>/root/PostInstall.log
echo "Creating vSwitch and Port Groups" >> /root/PostInstall.log
#Create vSwitch1 and Port Groups
/usr/sbin/esxcfg-vswitch -a vSwitch1:64
/usr/sbin/esxcfg-vswitch -A "x.x Network" vSwitch1
/usr/sbin/esxcfg-vswitch -A "x.x Network" vSwitch1 -v 1720
/usr/sbin/esxcfg-vswitch -A "DMZ" vSwitch1
/usr/sbin/esxcfg-vswitch -A "DMZ" vSwitch1 -v 1000
/usr/sbin/esxcfg-vswitch -A "Backup Network" vSwitch1
/usr/sbin/esxcfg-vswitch -A "Backup Network" vSwitch1 -v 50
/usr/sbin/esxcfg-vswitch -A "172.22 Network" vSwitch1
/usr/sbin/esxcfg-vswitch -A "172.22 Network" vSwitch1 -v 1722
#Link Ethernet Ports to VSwitch1
/usr/sbin/esxcfg-vswitch -L vmnic2 vSwitch1
/usr/sbin/esxcfg-vswitch -L vmnic3 vSwitch1
/usr/sbin/esxcfg-vswitch -L vmnic6 vSwitch1
/usr/sbin/esxcfg-vswitch -L vmnic7 vSwitch1
echo "vSwitch1 and Port groups have been created" >>/root/PostInstall.log
echo "Creating Security User ID" >> /root/PostInstall.log
#Create user ID
useradd someuser -p password -G wheel,root
echo "User ID Created" >>/root/PostInstall.log
echo "Adding DNS Entries" >>/root/PostInstall.log
echo "search domain.com" >>/etc/resolv.conf
echo "nameserver x.x.0.89" >>/etc/resolv.conf
echo "nameserver x.x.0.87" >>/etc/resolv.conf
echo "DNS has been configured" >>/root/PostInstall.log
echo "Setting Up NTP" >>/root/PostInstall.log
echo "x.x.0.149 vm-x365-1.domain.com" >>/etc/hosts
echo "x.x.0.150 vm-x365-2.domain.com" >>/etc/hosts
echo "x.x.0.151 vm-x365-3.domain.com" >>/etc/hosts
echo "0.us.pool.ntp.org" >> /etc/hosts
echo "1.us.pool.ntp.org" >> /etc/hosts
echo "2.us.pool.ntp.org" >> /etc/hosts
echo "3.us.pool.ntp.org" >> /etc/hosts
mv /etc/ntp.conf /etc/ORIG.ntp.conf
echo "restrict 127.0.0.1" >/etc/ntp.conf
echo "restrict default kod nomodify notrap" >>/etc/ntp.conf
echo "server 0.us.pool.ntp.org" >>/etc/ntp.conf
echo "server 1.us.pool.ntp.org" >>/etc/ntp.conf
echo "server 2.us.pool.ntp.org" >>/etc/ntp.conf
echo "server 3.us.pool.ntp.org" >>/etc/ntp.conf
echo "driftfile /var/lib/ntp/drift" >>/etc/ntp.conf
echo "noquery" >>/etc/ntp.conf
echo "nopeer" >>/etc/ntp.conf
mv /etc/ntp/step-tickers /etc/ntp/ORIG.step-tickers
echo "0.us.pool.ntp.org" >>/etc/ntp/step-tickers
echo "1.us.pool.ntp.org" >>/etc/ntp/step-tickers
echo "2.us.pool.ntp.org" >>/etc/ntp/step-tickers
echo "3.us.pool.ntp.org" >>/etc/ntp/step-tickers
/usr/sbin/esxcfg-firewall -e ntpClient
service mgmt-vmware restart
service ntpd start
chkconfig --level 3 ntpd on
hwclock --systohc --utc
echo "NTP configured" >>/root/PostInstall.log
#esxcfg-firewall -e sshServer
echo "Post Install Script Completed" >>/root/PostInstall.log
mv /etc/rc.d/ORIG.rc.local /etc/rc.d/rc.local
/sbin/reboot
#Completed
EOF