After creating the ks.cfg and saving it to a floppy I attempt to build the ESX 3.0.1 host by typing
esx ks=floppy method=cdrom
The installer starts and I can see the floppy externa lUSB drive being read but the install stops and starts asking install questions....I have also tried via DRAC card after creating a .flp file and it still does not work.
Any ideas?
I have copy of my ks.cfg file (from when I was using FTP, which is the same process as NFS).
I also have a copy of my post install script file (that replaces rc.local).
Here they are:
ks.cfg
\# Installation Method
url --url ftp://10.10.10.30/
\# Install or Upgrade
install
\# Language
lang en_US
\# Langauge Support
langsupport --default en_US
\# Keyboard
keyboard us
\# Mouse
mouse none
\# X windowing System
skipx
\# Network install type
network --device eth0 --bootproto static --ip 10.10.10.50 --netmask 255.255.255.0 --gateway 10.10.10.1 --nameserver 10.10.10.25 --hostname esxserver.domain --addvmportgroup=1 --vlanid=0
\# root Password
rootpw --iscrypted $34hjuk5m.,54n34>sd45OPId123*^f
\# Firewall settings
firewall --disabled
\# Authconfig
auth --enableshadow --enablemd5
\# Timezone
timezone Australia/Canberra
\# BootLoader ( The user has to use grub by default )
\# bootloader --location=mbr
bootloader --location=mbr
\# VMware Specific Commands
vmaccepteula
vmlicense --mode=server --server=27000@10.10.10.28 --edition=esxFull
\# Clear Partitions
clearpart --all --initlabel --drives=cciss/c0d0
\# Partitioning
part /boot --fstype ext3 --size 102 --ondisk cciss/c0d0 --asprimary
part / --fstype ext3 --size 10000 --ondisk cciss/c0d0 --asprimary
part swap --size 2000 --ondisk cciss/c0d0 --asprimary
part None --fstype vmfs3 --size 10000 --grow --ondisk cciss/c0d0
part /var/log --fstype ext3 --size 1992 --ondisk cciss/c0d0
part None --fstype vmkcore --size 94 --ondisk cciss/c0d0
\# Reboot after install ?
reboot
%packages
%post
\#
\# - - - - - - - Open all ports - - - - - - -
#
#
esxcfg-firewall --allowIncoming
esxcfg-firewall --allowOutgoing
\#
\# - - - - - - - Setting up FTP session and downloads - - - - - - -
#
cd /var/
mkdir /var/updates
cd /var/updates/
echo "ignore" >> /var/updates/upload.txt
echo "user anonymous password" >> /var/updates/upload.txt
echo "cd patches" >> /var/updates/upload.txt
echo "lcd /var/updates/" >> /var/updates/upload.txt
echo "binary" >> /var/updates/upload.txt
echo "mget *.tgz" >> /var/updates/upload.txt
echo "mget *.tar.gz" >> /var/updates/upload.txt
echo "get LiebertM" >> /var/updates/upload.txt
echo "cd .." >> /var/updates/upload.txt
echo "mget *.conf" >> /var/updates/upload.txt
echo "get step-tickers" >> /var/updates/upload.txt
echo "lcd /tmp/" >> /var/updates/upload.txt
echo "get default.nvram" >> /var/updates/upload.txt
echo "mget *.sh" >> /var/updates/upload.txt
echo "bye" >> /var/updates/upload.txt
cd /var/updates/
ftp -v -i -n 175.65.104.71 < upload.txt
\#
\# - - - - - - - setup rc.local - - - - - - - -
\#
\# mv /etc/rc.d/rc.local /etc/rc.d/rc.local.sav
\# cp -P /tmp/rc.local /etc/rc.d/rc.local
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.sav
chmod 777 /tmp/runonce.sh
echo "/tmp/runonce.sh" >> /etc/rc.d/rc.local
@base
runonce.sh
\# !/bin/sh
###################################################################
echo "VMware ESX 3.x Post Install Script" > /tmp/PostInstall.log
###################################################################
\# Name: David Hill and Anthony Smith
\# Location: DFAT
\# Date: 14 March 2003
###################################################################
\# Setup Variables
###############################################################################
SCRIPTNAME="ESX Post Install Script"
DATETIME=`date '+%c'`
SCIP=10.10.10.10
DGW=10.10.10.1
VMIP=0.0.0.0
VMKGW=0.0.0.0
VMFSPARTLABEL=servername-data
DNS1=10.10.10.25
DNS2=10.10.10.26
HDC=adserver.domain
BANNERTXT1="SECURITY WARNING AND OFFICIAL UNDERTAKING"
BANNERTXT2="Information on the system is, and remains the property of, the Commonwealth of Australia through the Department of Foreign Affairs and Trade."
BANNERTXT3="Unauthorised access to, or use of the system may constitute offences against various sections of the Crimes Act 1914, including Sections 70, 76B and 79."
BANNERTXT4="Unauthorised access to, or use of this system may also contravene Administrative Circulars, Departmental Security Instructions and the Protective Security Manual."
BANNERTXT5="Unauthorised access to, or use of the system, or the disclosure or misuse of data contained within the system may result in disciplinary and/or legal action by the department."
BANNERTXT6="Your access to and use of the system is monitored."
VMNAME="vmguest1"
VMNAME1="vmguest1_1"
VMNAME2="vmguest1_2"
VMOS="winnetstandard"
VMDSIZE_C="20g"
VMDSIZE_D="160g"
VMDSIZE_E="80g"
VMMEMSIZE="1024"
VCPUS="2"
VMNETWORK1="VLAN1"
VMNETWORK2="VLAN2"
VMNETWORK3="VLANXXX"
VLANID1=1
VLANID2=2
VLANID3=0
VMMAC="00:50:56:8F:FF:EB" #Address must start with 00:50:56
VMNAMEA="vmguest2"
VMNAMEA1="vmguest2_1"
VMNAMEA2="vmguest2_2"
VMMACA="00:50:56:8F:FF:EC" #Address must start with 00:50:56
###############################################################################
setPath()
{
echo "Setting PATH" >> /tmp/PostInstall.log
sleep 5
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
echo "PATH has been set" >> /tmp/PostInstall.log
}
openFirewall()
{
echo "Open Firewall" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-firewall --allowIncoming
/usr/sbin/esxcfg-firewall --allowOutgoing
echo "Firewall has been Opened" >> /tmp/PostInstall.log
}
setHPInsight()
{
echo "First step is to unpack and install the HP Agents" >> /tmp/PostInstall.log
cd /var/updates
tar -xvzf hpmgmt-7.7.0-vmware3x.tgz
cd /var/updates/hpmgmt/770
./installvm770.sh --silent --inputfile /var/updates/hpmgmt.conf
echo "HP Insight Agents installed" >> /tmp/PostInstall.log
}
addPatches()
{
echo "Apply ESX 3.01 Patches" >> /tmp/PostInstall.log
\# \+----
+
\# | |
\# | Current ESX Server 3.0.1 Patches |
\# | |
\# | ESX-1541239 Patch | 03/29/07 | Critical Patch |
\# | ESX-2257739 Patch | 03/29/07 | Critical Patch |
\# | ESX-2559638 Patch | 03/29/07 | Security Patch |
\# | ESX-6431040 Patch | 03/29/07 | Security Patch <--- The following patches |
\# | ESX-9916286 Patch | 03/29/07 | Security Patch are contained within |
\# | ESX-3199476 Patch | 03/05/07 | Critical Patch this bundle: |
\# | ESX-5031800 Patch | 03/05/07 | Security Patch ESX-1161870 |
\# | ESX-5885387 Patch | 03/05/07 | Security Patch ESX-3416571 |
\# | ESX-6050503 Patch | 03/05/07 | General Patch ESX-5011126 |
\# | ESX-6856573 Patch | 03/05/07 | Security Patch ESX-7737432 |
\# | ESX-9865995 Patch | 03/05/07 | General Patch ESX-7780490 |
\# | ESX-1271657 Patch | 01/31/07 | General Patch ESX-8174018 |
\# | ESX-1917602 Patch | 01/31/07 | General Patch ESX-8852210 |
\# | ESX-2031037 Patch | 01/31/07 | General Patch ESX-9617902 |
\# | ESX-2092658 Patch | 01/31/07 | General Patch |
\# | ESX-3996003 Patch | 01/31/07 | General Patch |
\# | ESX-5497987 Patch | 01/31/07 | General Patch |
\# | ESX-6075798 Patch | 01/31/07 | General Patch |
\# | ESX-2066306 Patch | 12/28/06 | Critical Patch |
\# | ESX-6921838 Patch | 12/28/06 | General Patch |
\# | ESX-8173580 Patch | 12/28/06 | General Patch |
\# | ESX-9986131 Patch | 12/28/06 | Security Patch |
\# | ESX-1006511 Patch | 11/30/06 | Critical Patch |
\# | ESX-1410076 Patch | 11/30/06 | Critical Patch |
\# | ESX-2158032 Patch | 11/30/06 | Critical Patch |
\# | |
\# \+----
+
#
\# Unpack November Patches
#
cd /var/updates/
tar -zxvf /var/updates/ESX-1006511.tgz
tar -zxvf /var/updates/ESX-1410076.tgz
tar -zxvf /var/updates/ESX-2158032.tgz
#
\# Unpack December Patches
#
tar -zxvf /var/updates/ESX-2066306.tgz
tar -zxvf /var/updates/ESX-6921838.tgz
tar -zxvf /var/updates/ESX-8173580.tgz
tar -zxvf /var/updates/ESX-9986131.tgz
#
\# Unpack January Patches
#
tar -zxvf /var/updates/ESX-1271657.tgz
tar -zxvf /var/updates/ESX-1917602.tgz
tar -zxvf /var/updates/ESX-2031037.tgz
tar -zxvf /var/updates/ESX-2092658.tgz
tar -zxvf /var/updates/ESX-3996003.tgz
tar -zxvf /var/updates/ESX-5497987.tgz
tar -zxvf /var/updates/ESX-6075798.tgz
#
\# Unpack February Patches
#
tar -zxvf /var/updates/ESX-3199476.tgz
tar -zxvf /var/updates/ESX-5031800.tgz
tar -zxvf /var/updates/ESX-5885387.tgz
tar -zxvf /var/updates/ESX-6050503.tgz
tar -zxvf /var/updates/ESX-6856573.tgz
tar -zxvf /var/updates/ESX-9865995.tgz
#
\# Unpack March Patches
#
tar -zxvf /var/updates/ESX-1541239.tgz
tar -zxvf /var/updates/ESX-2257739.tgz
tar -zxvf /var/updates/ESX-2559638.tgz
tar -zxvf /var/updates/ESX-6431040.tgz
tar -zxvf /var/updates/ESX-9916286.tgz
#
\# =============================================================
#
\# Install November Patches
#
echo "Installing November 2006 ESX 3.01 Patches" >> /tmp/PostInstall.log
esxupdate --noreboot -r file:/var/updates/ESX-1006511 update
esxupdate --noreboot -r file:/var/updates/ESX-1410076 update
esxupdate --noreboot -r file:/var/updates/ESX-2158032 update
echo "November 2006 ESX 3.01 Patches Installed" >> /tmp/PostInstall.log
#
\# Install December Patches
#
echo "Installing December 2006 ESX 3.01 Patches" >> /tmp/PostInstall.log
esxupdate --noreboot -r file:/var/updates/ESX-2066306 update
esxupdate --noreboot -r file:/var/updates/ESX-6921838 update
esxupdate --noreboot -r file:/var/updates/ESX-8173580 update
esxupdate --noreboot -r file:/var/updates/ESX-9986131 update
echo "December 2006 ESX 3.01 Patches Installed" >> /tmp/PostInstall.log
#
\# Install January Patches
#
echo "Installing January 2007 ESX 3.01 Patches" >> /tmp/PostInstall.log
esxupdate --noreboot -r file:/var/updates/ESX-1271657 update
esxupdate --noreboot -r file:/var/updates/ESX-1917602 update
esxupdate --noreboot -r file:/var/updates/ESX-2031037 update
esxupdate --noreboot -r file:/var/updates/ESX-2092658 update
esxupdate --noreboot -r file:/var/updates/ESX-3996003 update
esxupdate --noreboot -r file:/var/updates/ESX-5497987 update
esxupdate --noreboot -r file:/var/updates/ESX-6075798 update
echo "January 2007 ESX 3.01 Patches Installed" >> /tmp/PostInstall.log
\#
\# Install February Patches
\#
echo "Installing February 2007 ESX 3.01 Patches" >> /tmp/PostInstall.log
esxupdate --noreboot -r file:/var/updates/ESX-3199476 update
esxupdate --noreboot -r file:/var/updates/ESX-5031800 update
esxupdate --noreboot -r file:/var/updates/ESX-5885387 update
esxupdate --noreboot -r file:/var/updates/ESX-6050503 update
esxupdate --noreboot -r file:/var/updates/ESX-6856573 update
esxupdate --noreboot -r file:/var/updates/ESX-9865995 update
echo "February 2007 ESX 3.01 Patches Installed" >> /tmp/PostInstall.log
#
\# Install March Patches
#
echo "Installing March 2007 ESX 3.01 Patches" >> /tmp/PostInstall.log
esxupdate --noreboot -r file:/var/updates/ESX-1541239 update
esxupdate --noreboot -r file:/var/updates/ESX-2257739 update
esxupdate --noreboot -r file:/var/updates/ESX-2559638 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-1161870 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-3416571 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-5011126 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-7737432 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-7780490 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-8174018 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-8852210 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-9617902 update
esxupdate --noreboot -r file:/var/updates/ESX-9916286 update
echo "March 2007 ESX 3.01 Patches Installed" >> /tmp/PostInstall.log
\#
echo "ESX 3.01 Patches Applied" >> /tmp/PostInstall.log
}
addCopyFiles()
{
echo "Copy over specific configuration files" >> /tmp/PostInstall.log
mv /etc/ntp.conf /tmp/ntp.conf
mv /etc/ntp/step-tickers /tmp/step-tickers
cp -f /var/updates/ntp.conf /etc/ntp.conf
cp -f /var/updates/step-tickers /etc/ntp/step-tickers
cp -f /var/updates/snmpd.conf /etc/snmp/snmpd.conf
echo "Configuration files have been copied" >> /tmp/PostInstall.log
}
setSSHRoot()
{
echo "Allowing root to login via SSH" >> /tmp/PostInstall.log
mv /etc/ssh/sshd_config /etc/ssh/sshd_config.old
sed -e "s/PermitRootLogin no/PermitRootLogin yes/g" /etc/ssh/sshd_config.old > /etc/ssh/sshd_config
rm -f /etc/ssh/sshd_config.old
/etc/init.d/sshd restart
echo "Set root to login via SSH" >> /tmp/PostInstall.log
}
setSNMP()
{
echo "Restart the SNMPD service" >> /tmp/PostInstall.log
service snmpd restart
service sshd restart
echo "SNMPD has been restarted" >> /tmp/PostInstall.log
}
setUsers()
{
echo "Adding default users" >> /tmp/PostInstall.log
/usr/sbin/useradd adavidhi
/usr/sbin/useradd aanthonysm
\# /usr/sbin/useradd aanthonysm -g users -p $1$Il9DnmU5$jkqOkNTJ156.j3AL1PuVp0
echo "Default users have been created" >> /tmp/PostInstall.log
}
setConsoleSwitch()
{
echo "Removing current network configuration" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-vswitch 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
service mgmt-vmware restart
echo "Reconfiguring Service Console NIC" >> /tmp/PostInstall.log
cp /etc/vmware/esx.conf /tmp/esx.conf.bak
/usr/sbin/esxcfg-vswitch -a vSwitch0
/usr/sbin/esxcfg-vswitch vSwitch0 -L vmnic0
/usr/sbin/esxcfg-vswitch vSwitch0 -L vmnic1
/usr/sbin/esxcfg-vswitch vSwitch0 -A "Service Console"
/usr/sbin/esxcfg-vswitch vSwitch0 -p "Service Console" -v 0
/usr/sbin/esxcfg-vswif -a vswif0 -p "Service Console" -i $SCIP -n 255.255.255.0
route add default gw $DGW
echo "GATEWAY=$DGW" >> /etc/sysconfig/network
echo "Service Console configured" >> /tmp/PostInstall.log
}
setProdNet()
{
echo "Configuring VLAN515 Network" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-vswitch vSwitch0 -A $VMNETWORK1
/usr/sbin/esxcfg-vswitch vSwitch0 -p $VMNETWORK1 -v $VLANID1
echo "VLAN515 network configured" >> /tmp/PostInstall.log
}
setVLAN104()
{
echo "Configuring VLAN522 Network" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-vswitch vSwitch0 -A $VMNETWORK2
/usr/sbin/esxcfg-vswitch vSwitch0 -p $VMNETWORK2 -v $VLANID2
echo "VLAN522 network configured" >> /tmp/PostInstall.log
}
setVLANXXX()
{
echo "Configuring VLAN526 Network" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-vswitch vSwitch0 -A $VMNETWORK3
/usr/sbin/esxcfg-vswitch vSwitch0 -p $VMNETWORK3 -v $VLANID3
echo "VLAN526 network configured" >> /tmp/PostInstall.log
}
setVMotion()
{
echo "Setting up VMotion" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-vswitch vSwitch0 -A VMotion
/usr/sbin/esxcfg-vswitch vSwitch0 -p VMotion
/usr/sbin/esxcfg-vmknic -a VMotion -i $VMIP -n 255.255.255.0
/usr/sbin/esxcfg-route $VMKGW
echo "VMotion configured" >> /tmp/PostInstall.log
}
setLocalNet()
{
echo "Configuring Private Network" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-vswitch --add --pg=Local vSwitch1
/usr/sbin/esxcfg-vswitch vSwitch1 -A Local
/usr/sbin/esxcfg-vswitch vSwitch1 -p Local
echo "Private network configured" >> /tmp/PostInstall.log
}
setSCMem()
{
echo "Setting Service Console Memory to 512MB" >> /tmp/PostInstall.log
mv -f /etc/vmware/esx.conf /tmp/esx.conf.bak
sed -e 's/boot\/memSize = \"272\"/boot\/memSize = \"512\"/g' /tmp/esx.conf.bak >> /etc/vmware/esx.conf
mv -f /boot/grub/grub.conf /tmp/grub.conf.bak
sed -e 's/uppermem 277504/uppermem 523264/g' -e 's/mem=272M/mem=512M/g' /tmp/grub.conf.bak >> /boot/grub/grub.conf
echo "Service Console Memory has been set to 512MB" >> /tmp/PostInstall.log
}
setVMFS()
{
echo "Creating VMFS partition name" >> /tmp/PostInstall.log
export VMFS_PARTITION=`fdisk -l /dev/cciss/c0d0 | grep fb | sed -e "s/\/dev\/cciss\/c0d0p\(.\).*/\1/"`
vmkfstools -C vmfs3 -S $VMFSPARTLABEL vmhba0:0:0:$VMFS_PARTITION
echo "VMFS partition name created" >> /tmp/PostInstall.log
}
setNameResolution()
{
echo "Adding DNS entries for Name Resolution" >> /tmp/PostInstall.log
echo "# Built by Automated Post Install Script" > /etc/resolv.conf
echo "search titan.satin.lo" >> /etc/resolv.conf
echo "search satin.lo" >> /etc/resolv.conf
echo "nameserver $DNS1" >> /etc/resolv.conf
echo "nameserver $DNS2" >> /etc/resolv.conf
echo "DNS setup for Name Resolution has been configured" >> /tmp/PostInstall.log
}
setESXcfg()
{
echo "Configure ESX Authentication" >> /tmp/PostInstall.log
esxcfg-auth --enablead --addomain titan.satin.lo --addc $HDC --krb5realm titan.satin.lo --krb5kdc $HDC --krb5adminserver $HDC
esxcfg-auth --passmaxdays=0
echo "ESX Authentication completed" >> /tmp/PostInstall.log
}
setAuthd()
{
echo "Updating vmware-authd to allow AD logons" >> /tmp/PostInstall.log
echo "#%PAM-1.0" > /etc/pam.d/vmware-authd
echo "# Built by automated post install script" >> /etc/pam.d/vmware-authd
echo "auth sufficient /lib/security/pam_unix_auth.so shadow nullok" >> /etc/pam.d/vmware-authd
echo "auth required /lib/security/pam_krb5.so use_first_pass" >> /etc/pam.d/vmware-authd
echo "auth sufficient /lib/security/pam_ldap.so" >> /etc/pam.d/vmware-authd
echo "account required /lib/security/pam_unix_acct.so" >> /etc/pam.d/vmware-authd
echo "account sufficient /lib/security/pam_ldap.so" >> /etc/pam.d/vmware-authd
echo "vmware-authd has been updated" >> /tmp/PostInstall.log
}
setFirewall()
{
echo "Configuring Firewall Ports" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-firewall --openport 88,tcp,out,KerberosClient
/usr/sbin/esxcfg-firewall --openport 88,udp,out,KerberosClient
/usr/sbin/esxcfg-firewall --openport 464,tcp,out,KerberosPasswordChange
/usr/sbin/esxcfg-firewall --openport 749,tcp,out,KerberosAdm
/usr/sbin/esxcfg-firewall --openport 389,tcp,out,in,LDAP
/usr/sbin/esxcfg-firewall --openport 636,tcp,out,in,OpenSSL
/usr/sbin/esxcfg-firewall --openport 2381,tcp,in,hpim
/usr/sbin/esxcfg-firewall --openport 2381,tcp,out,hpim
/usr/sbin/esxcfg-firewall --openport 231,udp,in,out,ntpd
/usr/sbin/esxcfg-firewall --openport 123,udp,in,out,ntpd
/usr/sbin/esxcfg-firewall --openport 280,tcp,out,sim-cert
/usr/sbin/esxcfg-firewall --openPort 161,tcp,out,in,SNMP
/usr/sbin/esxcfg-firewall --openPort 161,udp,in,SNMP
/usr/sbin/esxcfg-firewall --openPort 162,tcp,in,SNMP
/usr/sbin/esxcfg-firewall --openPort 162,udp,in,SNMP
/usr/sbin/esxcfg-firewall --enableService snmpd
/usr/sbin/esxcfg-firewall --enableService ntpClient
/usr/sbin/esxcfg-firewall --enableService CIMHttpsServer
/usr/sbin/esxcfg-firewall --enableService CIMHttpServer
/usr/sbin/esxcfg-firewall --enableService CIMSLP
/usr/sbin/esxcfg-firewall --enableService hpim
echo "Firewall has been configured" >> /tmp/PostInstall.log
}
setNTP()
{
echo "Turn of ntpd on start server" >> /tmp/PostInstall.log
chkconfig --level 345 ntpd on
service ntpd restart
hwclock --systohc
echo "NTP has been configured and started" >> /tmp/PostInstall.log
}
setSSHBanner()
{
echo "Setting up SSH Security Logon Banner Text" >> /tmp/PostInstall.log
echo $BANNERTXT1 > /etc/ssh/banner
echo " " >> /etc/ssh/banner
echo $BANNERTXT2 > /etc/ssh/banner
echo " " >> /etc/ssh/banner
echo $BANNERTXT3 > /etc/ssh/banner
echo " " >> /etc/ssh/banner
echo $BANNERTXT4 > /etc/ssh/banner
echo " " >> /etc/ssh/banner
echo $BANNERTXT5 > /etc/ssh/banner
echo " " >> /etc/ssh/banner
echo $BANNERTXT6 > /etc/ssh/banner
echo "banner /etc/ssh/banner" >> /etc/ssh/sshd_config
echo "SSH Banner Text has been Configured" >> /tmp/PostInstall.log
}
addGuestVM()
{
echo "Creating Guest VM" >> /tmp/PostInstall.log
mkdir /vmfs/volumes/$VMFSPARTLABEL/$VMNAME
exec 6>&1
exec 1>/vmfs/volumes/$VMFSPARTLABEL/$VMNAME/$VMNAME.vmx
echo #!/usr/bin/vmware
echo config.version = '"'8'"'
echo virtualHW.version = '"'4'"'
echo floppy0.present = '"'true'"'
echo nvram = '"'default.nvram'"'
echo powerType.powerOff = '"'default'"'
echo powerType.powerOn = '"'default'"'
echo powerType.suspend = '"'default'"'
echo powerType.reset = '"'default'"'
echo displayName = '"'$VMNAME'"'
echo extendedConfigFile = '"'$VMNAME.vmxf'"'
echo numvcpus = '"'$VCPUS'"'
echo scsi0.present = '"'true'"'
echo scsi0.sharedBus = '"'none'"'
echo scsi0.virtualDev = '"'lsilogic'"'
echo memsize = '"'$VMMEMSIZE'"'
echo scsi0:0.present = '"'true'"'
echo scsi0:0.fileName = '"'$VMNAME.vmdk'"'
echo scsi0:0.deviceType = '"'scsi-hardDisk'"'
echo ide0:0.present = '"'true'"'
echo ide0:0.clientDevice = '"'true'"'
echo ide0:0.deviceType = '"'cdrom-raw'"'
echo ide0:0.startConnected = '"'false'"'
echo floppy0.startConnected = '"'false'"'
echo floppy0.clientDevice = '"'true'"'
echo ethernet0.present = '"'true'"'
echo ethernet0.allowGuestConnectionControl = '"'false'"'
echo ethernet0.networkName = '"'$VMNETWORK'"'
echo ethernet0.addressType = '"'vpx'"'
echo ethernet0.generatedAddress = '"'$VMMAC'"'
echo guestOS = '"'$VMOS'"'
echo toolScripts.afterPowerOn = '"'true'"'
echo toolScripts.afterResume = '"'true'"'
echo toolScripts.beforeSuspend = '"'true'"'
echo toolScripts.beforePowerOff = '"'true'"'
echo scsi0:1.present = '"'true'"'
echo scsi0:1.fileName = '"'$VMNAME1.vmdk'"'
echo scsi0:1.deviceType = '"'scsi-hardDisk'"'
echo scsi0:1.mode = '"'independent-persistent'"'
echo sched.scsi0:1.shares = '"'normal'"'
echo floppy0.fileName = '"'/dev/fd0'"'
echo scsi0:0.redo = '"''"'
echo scsi0:1.redo = '"''"'
echo tools.syncTime = '"'FALSE'"'
exec 1>&-
exec 1>&6
exec 6>&-
cp -f /tmp/default.nvram /vmfs/volumes/$VMFSPARTLABEL/$VMNAME/default.nvram
chmod 755 /vmfs/volumes/$VMFSPARTLABEL/$VMNAME/$VMNAME.vmx
cd /vmfs/volumes/$VMFSPARTLABEL/$VMNAME
vmkfstools -c $VMDSIZE_C $VMNAME.vmdk -a lsilogic
vmkfstools -c $VMDSIZE_D $VMNAME1.vmdk -a lsilogic
vmware-cmd -s register /vmfs/volumes/$VMFSPARTLABEL/$VMNAME/$VMNAME.vmx
###############################################################################
mkdir /vmfs/volumes/$VMFSPARTLABEL/$VMNAMEA
exec 6>&1
exec 1>/vmfs/volumes/$VMFSPARTLABEL/$VMNAMEA/$VMNAMEA.vmx
echo #!/usr/bin/vmware
echo config.version = '"'8'"'
echo virtualHW.version = '"'4'"'
echo floppy0.present = '"'true'"'
echo nvram = '"'default.nvram'"'
echo powerType.powerOff = '"'default'"'
echo powerType.powerOn = '"'default'"'
echo powerType.suspend = '"'default'"'
echo powerType.reset = '"'default'"'
echo displayName = '"'$VMNAMEA'"'
echo extendedConfigFile = '"'$VMNAMEA.vmxf'"'
echo numvcpus = '"'$VCPUS'"'
echo scsi0.present = '"'true'"'
echo scsi0.sharedBus = '"'none'"'
echo scsi0.virtualDev = '"'lsilogic'"'
echo memsize = '"'$VMMEMSIZE'"'
echo scsi0:0.present = '"'true'"'
echo scsi0:0.fileName = '"'$VMNAMEA.vmdk'"'
echo scsi0:0.deviceType = '"'scsi-hardDisk'"'
echo ide0:0.present = '"'true'"'
echo ide0:0.clientDevice = '"'true'"'
echo ide0:0.deviceType = '"'cdrom-raw'"'
echo ide0:0.startConnected = '"'false'"'
echo floppy0.startConnected = '"'false'"'
echo floppy0.clientDevice = '"'true'"'
echo ethernet0.present = '"'true'"'
echo ethernet0.allowGuestConnectionControl = '"'false'"'
echo ethernet0.networkName = '"'$VMNETWORK'"'
echo ethernet0.addressType = '"'vpx'"'
echo ethernet0.generatedAddress = '"'$VMMACA'"'
echo guestOS = '"'$VMOS'"'
echo toolScripts.afterPowerOn = '"'true'"'
echo toolScripts.afterResume = '"'true'"'
echo toolScripts.beforeSuspend = '"'true'"'
echo toolScripts.beforePowerOff = '"'true'"'
echo scsi0:1.present = '"'true'"'
echo scsi0:1.fileName = '"'$VMNAMEA1.vmdk'"'
echo scsi0:1.deviceType = '"'scsi-hardDisk'"'
echo scsi0:1.mode = '"'independent-persistent'"'
echo sched.scsi0:1.shares = '"'normal'"'
echo floppy0.fileName = '"'/dev/fd0'"'
echo scsi0:0.redo = '"''"'
echo scsi0:1.redo = '"''"'
echo tools.syncTime = '"'FALSE'"'
exec 1>&-
exec 1>&6
exec 6>&-
cp -f /tmp/default.nvram /vmfs/volumes/$VMFSPARTLABEL/$VMNAMEA/default.nvram
chmod 755 /vmfs/volumes/$VMFSPARTLABEL/$VMNAMEA/$VMNAMEA.vmx
cd /vmfs/volumes/$VMFSPARTLABEL/$VMNAMEA
vmkfstools -c $VMDSIZE_C $VMNAMEA.vmdk -a lsilogic
vmkfstools -c $VMDSIZE_D $VMNAMEA1.vmdk -a lsilogic
vmware-cmd -s register /vmfs/volumes/$VMFSPARTLABEL/$VMNAMEA/$VMNAMEA.vmx
}
enableFirewall()
{
echo "Enabling the Firewall" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-firewall --blockIncoming
/usr/sbin/esxcfg-firewall --blockOutgoing
echo "Firewall has been enabled" >> /tmp/PostInstall.log
echo "Post Installation has been Completed" >> /tmp/PostInstall.log
}
setUPS ()
{
echo "Liebert UPS client installation" >> /tmp/PostInstall.log
cd /
tar -zxvf /var/updates/ups.tar.gz
cp /var/updates/LiebertM /etc/init.d/LiebertM
chmod 755 /etc/init.d/LiebertM
cp /var/updates/LiebertM /etc/rc.d/init.d/LiebertM
chmod 755 /etc/rc.d/init.d/LiebertM
ln -s /etc/rc.d/init.d/LiebertM /etc/rc.d/rc0.d/S90LiebertM
ln -s /etc/rc.d/init.d/LiebertM /etc/rc.d/rc1.d/S90LiebertM
ln -s /etc/rc.d/init.d/LiebertM /etc/rc.d/rc2.d/S90LiebertM
ln -s /etc/rc.d/init.d/LiebertM /etc/rc.d/rc3.d/S90LiebertM
ln -s /etc/rc.d/init.d/LiebertM /etc/rc.d/rc4.d/S90LiebertM
ln -s /etc/rc.d/init.d/LiebertM /etc/rc.d/rc5.d/S90LiebertM
echo "Liebert UPS client installed" >> /tmp/PostInstall.log
}
setCleanUp()
{
echo "Removing Post Installation files and directory" >> /tmp/PostInstall.log
rm -f -r /var/updates
cp -f /etc/rc.d/rc.local.sav /etc/rc.d/rc.local
echo "Post Installation files and directory have been removed" >> /tmp/PostInstall.log
}
###############################################################################
\# MAIN PROGRAM
###############################################################################
echo "$SCRIPTNAME - Started" >> /tmp/PostInstall.log
echo "$DATETIME" >> /tmp/PostInstall.log
###############################################################################
\# Call Functions
###############################################################################
setPATH
openFirewall
setHPInsight
addPatches
addCopyFiles
setSSHRoot
setSNMP
setUsers
setConsoleSwitch
setProdNet
setVLAN104
setVLANXXX
setVMotion
setLocalNet
setSCMem
setVMFS
setNameResolution
setESXcfg
setAuthd
setFirewall
setNTP
setSSHBanner
addGuestVM
enableFirewall
setUPS
setCleanUp
###############################################################################
\# Script End
###############################################################################
echo "$SCRIPTNAME - Ended" >> /tmp/PostInstall.log
reboot
I hope this helps.
Remeber to save the files in linux format not DOS.
Ant
Anyone using Dell?
I'm using a 2950, but with manually installation process ...
Sorry
I'm not using Dell, but I have been doing scripted installs.
What does your ks.cfg file look like? Can you post it?
Ant
OK the ks.cfg now works but not the #post bit, do you have this issue DFATAnt
I've added mine to initrd.img
Installation Method
cdrom
\# root password
\# either Encrypted (use "mkpasswd -H md5 " on a Linux system,
\# or pull from an existing ESX server's /etc/shadow file between colons) -
\# The MD5-encrypted string below is for "password":
\# or Plaintext:
#rootpw password
rootpw --iscrypted $1$MRMN1nFH$PAHncVeTgCrI0GXVUdBiJ0
\# Authconfig
authconfig --enableshadow --enablemd5
\# BootLoader ( The user has to use grub by default )
bootloader --location=mbr
\# Timezone
\# See /usr/share/zoneinfo for complete list
timezone --utc Europe/Stockholm
\# X windowing System
skipx
\# Install or Upgrade
install
\# Text Mode
text
\# Network install type
#network --bootproto static --ip 192.168.0.11 --netmask 255.255.255.0 --gateway 192.168.0.1 --nameserver 192.168.0.5 --hostname esx01.yourdomain.com --addvmportgroup=0
network --device eth0 --addvmportgroup=0
\# Language
lang en_US
\# Language Support
langsupport --default en_US
\# Keyboard
keyboard sv-latin1
\# Mouse
mouse generic3ps/2 --device psaux
\# Reboot after install ?
reboot
\# Firewall settings
firewall --disabled
\# Clear Partitions
clearpart --all --initlabel --drives=sda
\# Partitioning
part /boot --fstype ext3 --size 256 --asprimary --ondisk sda
part / --fstype ext3 --size 2048 --asprimary --ondisk sda
part swap --size 1600 --asprimary --ondisk sda
part /usr --fstype ext3 --size 4096 --ondisk sda
part /opt --fstype ext3 --size 2048 --ondisk sda
part /var --fstype ext3 --size 4096 --ondisk sda
part /home --fstype ext3 --size 1024 --ondisk sda
part /tmp --fstype ext3 --size 1024 --ondisk sda
part None --fstype vmkcore --size 94 --ondisk sda
#part /vmimages --size 10240 --grow --ondisk=sda
\# Local VMFS partition (not used much in shared SAN environments)
\# First argument must be "None" or install will halt
\# Minimum size for a VMFS3 volume is 1200MiB
\# This only creates the partition, you must create the filesystem later
#part None --fstype vmfs3 --size 10240 --grow --ondisk=sda
#VMware Specific Commands
vmaccepteula
%packages
@base
@everything
%post
\# Configure NTP, and also add our timeserver to the step-tickers
########################################
\# where to get time when starting
/bin/echo "1.pool.se.ntp.org" >> /etc/ntp/step-tickers
\# /etc/ntp.conf
/bin/cp /etc/ntp.conf /etc/ntp.conf.orig
/bin/cat <<EOF >>/etc/ntp.conf
\# Prohibit general access to this service.
restrict default ignore
\# Permit all access over the loopback interface. This could
\# be tightened as well, but to do so would effect some of
\# the administrative functions.
restrict 127.0.0.1
\# - OUR TIMESERVERS \---
\# or remove the default restrict line
\# Permit time synchronization with our time source, but do not
\# permit the source to query or modify the service on this system.
restrict 1.se.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
server 1.se.pool.ntp.org
\# --- GENERAL CONFIGURATION ---
\# Undisciplined Local Clock. This is a fake driver intended for backup
\# and when no outside source of synchronized time is available. The
\# default stratum is usually 3, but in this case we elect to use stratum
\# 0. Since the server line does not have the prefer keyword, this driver
\# is never used for synchronization, unless no other other
\# synchronization source is available. In case the local host is
\# controlled by some external source, such as an external oscillator or
\# another protocol, the prefer keyword would cause the local host to
\# disregard all other synchronization sources, unless the kernel
\# modifications are in use and declare an unsynchronized condition.
#
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
\# Drift file. Put this in a directory which the daemon can write to.
\# No symbolic links allowed, either, since the daemon updates the file
\# by creating a temporary in the same directory and then rename()'ing
\# it to the file.
#
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
\# Authentication delay. If you use, or plan to use someday, the
\# authentication facility you should make the programs in the auth_stuff
\# directory and figure out what this number should be on your machine.
#
authenticate yes
\# Keys file. If you want to diddle your server at run time, make a
\# keys file (mode 600 for sure) and define the key number to be
\# used for making requests.
#
\# PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote
\# systems might be able to reset your clock at will. Note also that
\# ntpd is started with a -A flag, disabling authentication, that
\# will have to be removed as well.
#
keys /etc/ntp/keys
EOF
#####################################################
\### Create script to configure ESX at first boot ###
#####################################################
cat > /tmp/esxcfg.sh <<\EOF3
#!/bin/sh
\# Configure ESX Server
\### Firewall configuration
\# We need to enable ntpClient, sshClient, snmpd, Dell OpenManage, EMC NaviSphere
esxcfg-firewall -e ntpClient
esxcfg-firewall -e sshClient
esxcfg-firewall -e snmpd
esxcfg-firewall -o 1311,tcp,in,OpenManageRequest
esxcfg-firewall -o 6389,tcp,in,naviagent
esxcfg-firewall -o 6389,tcp,out,naviagent
\### Config/Start services
/sbin/chkconfig --level 345 ntpd on
/etc/init.d/ntpd start
/sbin/hwclock --systohc
\# SSH Access:
\# EXAMPLE: Create additional user account for SSH access
\# The encrypted password is 'password'
#useradd -p '$1$MLsmTO/Q$A8QI139I.QqRVVjXPYfDU1' -c "Service Account" admin
\# EXAMPLE: Enable root login via SSH
\# WARNING: This is not the most secure course of action!
#sed -e 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config > /etc/ssh/sshd_config.new
#mv -f /etc/ssh/sshd_config.new /etc/ssh/sshd_config
#/etc/init.d/ sshd restart
EOF3
\# make configuration script executable
chmod +x /tmp/esxcfg.sh
#####################################################
\# save a copy of rc.local
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.sav
\# add esxcfg.sh to rc.local
cat >> /etc/rc.d/rc.local <<EOF
cd /tmp
/tmp/esxcfg.sh
EOF
ok here is mine, the post bit dont work!
no changes have been made to the esx iso though.
\# Auto-Generated Scripted Install Configuration file.
\# This file is used for VMware ESX Server Scripted Install Deployment
\# Installation Method
cdrom
\# root Password
rootpw --iscrypted $1$zeOmfYnJ$7FiS8eF428GNE0UcwEI2j0
\# Authconfig
auth --enableshadow --enablemd5
\# BootLoader ( The user has to use grub by default )
bootloader --location=mbr
\# Timezone
timezone Europe/London
\# X windowing System
skipx
\# Install or Upgrade
install
\# Text Mode
text
\# Network install type
network --bootproto static --ip 10.1.1.20 --netmask 255.255.255.0 --gateway 10.1.1.10 --nameserver 10.1.1.10 --hostname esx01.test.com --addvmportgroup=0 --vlanid=0
\# 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=sda
\# Partitioning
part /boot --fstype ext3 --size 200 --ondisk sda
part / --fstype ext3 --size 4096 --ondisk sda
part swap --size 1600 --ondisk sda
part /tmp --fstype ext3 --size 2048 --ondisk sda
part /var --fstype ext3 --size 2048 --ondisk sda
part None --fstype vmkcore --size 110 --ondisk sda
part /opt --fstype ext3 --size 2048 --ondisk sda
part /vmimages --fstype ext3 --size 10240 --ondisk sda
part None --fstype vmfs3 --size 10000 --grow --ondisk sda
\# VMware Specific Commands
vmaccepteula
vmlicense --mode=server --server=27000@10.1.1.10 --edition=esxFull
%packages
@base
%vmlicense_text
%post
cat > /tmp/esxcfg.sh <<EOF1
#!/bin/sh
\# Configure ESX Server
\# Creating Virtual Switch
esxcfg-vswitch -a vSwitch1
esxcfg-vswitch -A 10.1.1.x vSwitch1
esxcfg-vswitch vSwitch1 -L vmnic1
esxcfg-vswitch vSwitch1 -L vmnic2
\# Allow ROOT access using SSH - Warning this is NOT the most secure configuration!!!
sed -e 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config > /etc/ssh/sshd_config.new
mv -f /etc/ssh/sshd_config.new /etc/ssh/sshd_config
service sshd restart
\# Setting secondary DNS Resolution
echo "nameserver 10.1.1.10" >> /etc/resolv.conf
\# Renaming Local VMFS Volume
ln -sf /vmfs/volumes/storage1 /vmfs/volumes/INT_VMFS_$HOSTNAME
\# Enable the SSH client (Out/From an ESX hosts)
esxcfg-firewall -e sshClient
EOF1
\# Make esxcfg.sh eXcutable
chmod +x /tmp/esxcfg.sh
\# Backup original rc.local file
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.bak
\# Make esxcfg.sh run from rc.local and make rc.local reset itself
cat >> /etc/rc.d/rc.local <<EOF
cd /tmp
/tmp/esxcfg.sh
mv -f /etc/rc.d/rc.local.bak /etc/rc.d/rc.local
EOF
No, my post works fine.
I have read on the forums that the post section can fail if the ks.cfg file is in DOS format. I don't know if this is the issue, but make sure that ks.cfg file has been created with a linux editor, not a Windows/DOS editor.
Ant
I have copy of my ks.cfg file (from when I was using FTP, which is the same process as NFS).
I also have a copy of my post install script file (that replaces rc.local).
Here they are:
ks.cfg
\# Installation Method
url --url ftp://10.10.10.30/
\# Install or Upgrade
install
\# Language
lang en_US
\# Langauge Support
langsupport --default en_US
\# Keyboard
keyboard us
\# Mouse
mouse none
\# X windowing System
skipx
\# Network install type
network --device eth0 --bootproto static --ip 10.10.10.50 --netmask 255.255.255.0 --gateway 10.10.10.1 --nameserver 10.10.10.25 --hostname esxserver.domain --addvmportgroup=1 --vlanid=0
\# root Password
rootpw --iscrypted $34hjuk5m.,54n34>sd45OPId123*^f
\# Firewall settings
firewall --disabled
\# Authconfig
auth --enableshadow --enablemd5
\# Timezone
timezone Australia/Canberra
\# BootLoader ( The user has to use grub by default )
\# bootloader --location=mbr
bootloader --location=mbr
\# VMware Specific Commands
vmaccepteula
vmlicense --mode=server --server=27000@10.10.10.28 --edition=esxFull
\# Clear Partitions
clearpart --all --initlabel --drives=cciss/c0d0
\# Partitioning
part /boot --fstype ext3 --size 102 --ondisk cciss/c0d0 --asprimary
part / --fstype ext3 --size 10000 --ondisk cciss/c0d0 --asprimary
part swap --size 2000 --ondisk cciss/c0d0 --asprimary
part None --fstype vmfs3 --size 10000 --grow --ondisk cciss/c0d0
part /var/log --fstype ext3 --size 1992 --ondisk cciss/c0d0
part None --fstype vmkcore --size 94 --ondisk cciss/c0d0
\# Reboot after install ?
reboot
%packages
%post
\#
\# - - - - - - - Open all ports - - - - - - -
#
#
esxcfg-firewall --allowIncoming
esxcfg-firewall --allowOutgoing
\#
\# - - - - - - - Setting up FTP session and downloads - - - - - - -
#
cd /var/
mkdir /var/updates
cd /var/updates/
echo "ignore" >> /var/updates/upload.txt
echo "user anonymous password" >> /var/updates/upload.txt
echo "cd patches" >> /var/updates/upload.txt
echo "lcd /var/updates/" >> /var/updates/upload.txt
echo "binary" >> /var/updates/upload.txt
echo "mget *.tgz" >> /var/updates/upload.txt
echo "mget *.tar.gz" >> /var/updates/upload.txt
echo "get LiebertM" >> /var/updates/upload.txt
echo "cd .." >> /var/updates/upload.txt
echo "mget *.conf" >> /var/updates/upload.txt
echo "get step-tickers" >> /var/updates/upload.txt
echo "lcd /tmp/" >> /var/updates/upload.txt
echo "get default.nvram" >> /var/updates/upload.txt
echo "mget *.sh" >> /var/updates/upload.txt
echo "bye" >> /var/updates/upload.txt
cd /var/updates/
ftp -v -i -n 175.65.104.71 < upload.txt
\#
\# - - - - - - - setup rc.local - - - - - - - -
\#
\# mv /etc/rc.d/rc.local /etc/rc.d/rc.local.sav
\# cp -P /tmp/rc.local /etc/rc.d/rc.local
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.sav
chmod 777 /tmp/runonce.sh
echo "/tmp/runonce.sh" >> /etc/rc.d/rc.local
@base
runonce.sh
\# !/bin/sh
###################################################################
echo "VMware ESX 3.x Post Install Script" > /tmp/PostInstall.log
###################################################################
\# Name: David Hill and Anthony Smith
\# Location: DFAT
\# Date: 14 March 2003
###################################################################
\# Setup Variables
###############################################################################
SCRIPTNAME="ESX Post Install Script"
DATETIME=`date '+%c'`
SCIP=10.10.10.10
DGW=10.10.10.1
VMIP=0.0.0.0
VMKGW=0.0.0.0
VMFSPARTLABEL=servername-data
DNS1=10.10.10.25
DNS2=10.10.10.26
HDC=adserver.domain
BANNERTXT1="SECURITY WARNING AND OFFICIAL UNDERTAKING"
BANNERTXT2="Information on the system is, and remains the property of, the Commonwealth of Australia through the Department of Foreign Affairs and Trade."
BANNERTXT3="Unauthorised access to, or use of the system may constitute offences against various sections of the Crimes Act 1914, including Sections 70, 76B and 79."
BANNERTXT4="Unauthorised access to, or use of this system may also contravene Administrative Circulars, Departmental Security Instructions and the Protective Security Manual."
BANNERTXT5="Unauthorised access to, or use of the system, or the disclosure or misuse of data contained within the system may result in disciplinary and/or legal action by the department."
BANNERTXT6="Your access to and use of the system is monitored."
VMNAME="vmguest1"
VMNAME1="vmguest1_1"
VMNAME2="vmguest1_2"
VMOS="winnetstandard"
VMDSIZE_C="20g"
VMDSIZE_D="160g"
VMDSIZE_E="80g"
VMMEMSIZE="1024"
VCPUS="2"
VMNETWORK1="VLAN1"
VMNETWORK2="VLAN2"
VMNETWORK3="VLANXXX"
VLANID1=1
VLANID2=2
VLANID3=0
VMMAC="00:50:56:8F:FF:EB" #Address must start with 00:50:56
VMNAMEA="vmguest2"
VMNAMEA1="vmguest2_1"
VMNAMEA2="vmguest2_2"
VMMACA="00:50:56:8F:FF:EC" #Address must start with 00:50:56
###############################################################################
setPath()
{
echo "Setting PATH" >> /tmp/PostInstall.log
sleep 5
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
echo "PATH has been set" >> /tmp/PostInstall.log
}
openFirewall()
{
echo "Open Firewall" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-firewall --allowIncoming
/usr/sbin/esxcfg-firewall --allowOutgoing
echo "Firewall has been Opened" >> /tmp/PostInstall.log
}
setHPInsight()
{
echo "First step is to unpack and install the HP Agents" >> /tmp/PostInstall.log
cd /var/updates
tar -xvzf hpmgmt-7.7.0-vmware3x.tgz
cd /var/updates/hpmgmt/770
./installvm770.sh --silent --inputfile /var/updates/hpmgmt.conf
echo "HP Insight Agents installed" >> /tmp/PostInstall.log
}
addPatches()
{
echo "Apply ESX 3.01 Patches" >> /tmp/PostInstall.log
\# \+----
+
\# | |
\# | Current ESX Server 3.0.1 Patches |
\# | |
\# | ESX-1541239 Patch | 03/29/07 | Critical Patch |
\# | ESX-2257739 Patch | 03/29/07 | Critical Patch |
\# | ESX-2559638 Patch | 03/29/07 | Security Patch |
\# | ESX-6431040 Patch | 03/29/07 | Security Patch <--- The following patches |
\# | ESX-9916286 Patch | 03/29/07 | Security Patch are contained within |
\# | ESX-3199476 Patch | 03/05/07 | Critical Patch this bundle: |
\# | ESX-5031800 Patch | 03/05/07 | Security Patch ESX-1161870 |
\# | ESX-5885387 Patch | 03/05/07 | Security Patch ESX-3416571 |
\# | ESX-6050503 Patch | 03/05/07 | General Patch ESX-5011126 |
\# | ESX-6856573 Patch | 03/05/07 | Security Patch ESX-7737432 |
\# | ESX-9865995 Patch | 03/05/07 | General Patch ESX-7780490 |
\# | ESX-1271657 Patch | 01/31/07 | General Patch ESX-8174018 |
\# | ESX-1917602 Patch | 01/31/07 | General Patch ESX-8852210 |
\# | ESX-2031037 Patch | 01/31/07 | General Patch ESX-9617902 |
\# | ESX-2092658 Patch | 01/31/07 | General Patch |
\# | ESX-3996003 Patch | 01/31/07 | General Patch |
\# | ESX-5497987 Patch | 01/31/07 | General Patch |
\# | ESX-6075798 Patch | 01/31/07 | General Patch |
\# | ESX-2066306 Patch | 12/28/06 | Critical Patch |
\# | ESX-6921838 Patch | 12/28/06 | General Patch |
\# | ESX-8173580 Patch | 12/28/06 | General Patch |
\# | ESX-9986131 Patch | 12/28/06 | Security Patch |
\# | ESX-1006511 Patch | 11/30/06 | Critical Patch |
\# | ESX-1410076 Patch | 11/30/06 | Critical Patch |
\# | ESX-2158032 Patch | 11/30/06 | Critical Patch |
\# | |
\# \+----
+
#
\# Unpack November Patches
#
cd /var/updates/
tar -zxvf /var/updates/ESX-1006511.tgz
tar -zxvf /var/updates/ESX-1410076.tgz
tar -zxvf /var/updates/ESX-2158032.tgz
#
\# Unpack December Patches
#
tar -zxvf /var/updates/ESX-2066306.tgz
tar -zxvf /var/updates/ESX-6921838.tgz
tar -zxvf /var/updates/ESX-8173580.tgz
tar -zxvf /var/updates/ESX-9986131.tgz
#
\# Unpack January Patches
#
tar -zxvf /var/updates/ESX-1271657.tgz
tar -zxvf /var/updates/ESX-1917602.tgz
tar -zxvf /var/updates/ESX-2031037.tgz
tar -zxvf /var/updates/ESX-2092658.tgz
tar -zxvf /var/updates/ESX-3996003.tgz
tar -zxvf /var/updates/ESX-5497987.tgz
tar -zxvf /var/updates/ESX-6075798.tgz
#
\# Unpack February Patches
#
tar -zxvf /var/updates/ESX-3199476.tgz
tar -zxvf /var/updates/ESX-5031800.tgz
tar -zxvf /var/updates/ESX-5885387.tgz
tar -zxvf /var/updates/ESX-6050503.tgz
tar -zxvf /var/updates/ESX-6856573.tgz
tar -zxvf /var/updates/ESX-9865995.tgz
#
\# Unpack March Patches
#
tar -zxvf /var/updates/ESX-1541239.tgz
tar -zxvf /var/updates/ESX-2257739.tgz
tar -zxvf /var/updates/ESX-2559638.tgz
tar -zxvf /var/updates/ESX-6431040.tgz
tar -zxvf /var/updates/ESX-9916286.tgz
#
\# =============================================================
#
\# Install November Patches
#
echo "Installing November 2006 ESX 3.01 Patches" >> /tmp/PostInstall.log
esxupdate --noreboot -r file:/var/updates/ESX-1006511 update
esxupdate --noreboot -r file:/var/updates/ESX-1410076 update
esxupdate --noreboot -r file:/var/updates/ESX-2158032 update
echo "November 2006 ESX 3.01 Patches Installed" >> /tmp/PostInstall.log
#
\# Install December Patches
#
echo "Installing December 2006 ESX 3.01 Patches" >> /tmp/PostInstall.log
esxupdate --noreboot -r file:/var/updates/ESX-2066306 update
esxupdate --noreboot -r file:/var/updates/ESX-6921838 update
esxupdate --noreboot -r file:/var/updates/ESX-8173580 update
esxupdate --noreboot -r file:/var/updates/ESX-9986131 update
echo "December 2006 ESX 3.01 Patches Installed" >> /tmp/PostInstall.log
#
\# Install January Patches
#
echo "Installing January 2007 ESX 3.01 Patches" >> /tmp/PostInstall.log
esxupdate --noreboot -r file:/var/updates/ESX-1271657 update
esxupdate --noreboot -r file:/var/updates/ESX-1917602 update
esxupdate --noreboot -r file:/var/updates/ESX-2031037 update
esxupdate --noreboot -r file:/var/updates/ESX-2092658 update
esxupdate --noreboot -r file:/var/updates/ESX-3996003 update
esxupdate --noreboot -r file:/var/updates/ESX-5497987 update
esxupdate --noreboot -r file:/var/updates/ESX-6075798 update
echo "January 2007 ESX 3.01 Patches Installed" >> /tmp/PostInstall.log
\#
\# Install February Patches
\#
echo "Installing February 2007 ESX 3.01 Patches" >> /tmp/PostInstall.log
esxupdate --noreboot -r file:/var/updates/ESX-3199476 update
esxupdate --noreboot -r file:/var/updates/ESX-5031800 update
esxupdate --noreboot -r file:/var/updates/ESX-5885387 update
esxupdate --noreboot -r file:/var/updates/ESX-6050503 update
esxupdate --noreboot -r file:/var/updates/ESX-6856573 update
esxupdate --noreboot -r file:/var/updates/ESX-9865995 update
echo "February 2007 ESX 3.01 Patches Installed" >> /tmp/PostInstall.log
#
\# Install March Patches
#
echo "Installing March 2007 ESX 3.01 Patches" >> /tmp/PostInstall.log
esxupdate --noreboot -r file:/var/updates/ESX-1541239 update
esxupdate --noreboot -r file:/var/updates/ESX-2257739 update
esxupdate --noreboot -r file:/var/updates/ESX-2559638 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-1161870 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-3416571 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-5011126 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-7737432 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-7780490 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-8174018 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-8852210 update
esxupdate --noreboot -r file:/var/updates/ESX-6431040/ESX-9617902 update
esxupdate --noreboot -r file:/var/updates/ESX-9916286 update
echo "March 2007 ESX 3.01 Patches Installed" >> /tmp/PostInstall.log
\#
echo "ESX 3.01 Patches Applied" >> /tmp/PostInstall.log
}
addCopyFiles()
{
echo "Copy over specific configuration files" >> /tmp/PostInstall.log
mv /etc/ntp.conf /tmp/ntp.conf
mv /etc/ntp/step-tickers /tmp/step-tickers
cp -f /var/updates/ntp.conf /etc/ntp.conf
cp -f /var/updates/step-tickers /etc/ntp/step-tickers
cp -f /var/updates/snmpd.conf /etc/snmp/snmpd.conf
echo "Configuration files have been copied" >> /tmp/PostInstall.log
}
setSSHRoot()
{
echo "Allowing root to login via SSH" >> /tmp/PostInstall.log
mv /etc/ssh/sshd_config /etc/ssh/sshd_config.old
sed -e "s/PermitRootLogin no/PermitRootLogin yes/g" /etc/ssh/sshd_config.old > /etc/ssh/sshd_config
rm -f /etc/ssh/sshd_config.old
/etc/init.d/sshd restart
echo "Set root to login via SSH" >> /tmp/PostInstall.log
}
setSNMP()
{
echo "Restart the SNMPD service" >> /tmp/PostInstall.log
service snmpd restart
service sshd restart
echo "SNMPD has been restarted" >> /tmp/PostInstall.log
}
setUsers()
{
echo "Adding default users" >> /tmp/PostInstall.log
/usr/sbin/useradd adavidhi
/usr/sbin/useradd aanthonysm
\# /usr/sbin/useradd aanthonysm -g users -p $1$Il9DnmU5$jkqOkNTJ156.j3AL1PuVp0
echo "Default users have been created" >> /tmp/PostInstall.log
}
setConsoleSwitch()
{
echo "Removing current network configuration" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-vswitch 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
service mgmt-vmware restart
echo "Reconfiguring Service Console NIC" >> /tmp/PostInstall.log
cp /etc/vmware/esx.conf /tmp/esx.conf.bak
/usr/sbin/esxcfg-vswitch -a vSwitch0
/usr/sbin/esxcfg-vswitch vSwitch0 -L vmnic0
/usr/sbin/esxcfg-vswitch vSwitch0 -L vmnic1
/usr/sbin/esxcfg-vswitch vSwitch0 -A "Service Console"
/usr/sbin/esxcfg-vswitch vSwitch0 -p "Service Console" -v 0
/usr/sbin/esxcfg-vswif -a vswif0 -p "Service Console" -i $SCIP -n 255.255.255.0
route add default gw $DGW
echo "GATEWAY=$DGW" >> /etc/sysconfig/network
echo "Service Console configured" >> /tmp/PostInstall.log
}
setProdNet()
{
echo "Configuring VLAN515 Network" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-vswitch vSwitch0 -A $VMNETWORK1
/usr/sbin/esxcfg-vswitch vSwitch0 -p $VMNETWORK1 -v $VLANID1
echo "VLAN515 network configured" >> /tmp/PostInstall.log
}
setVLAN104()
{
echo "Configuring VLAN522 Network" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-vswitch vSwitch0 -A $VMNETWORK2
/usr/sbin/esxcfg-vswitch vSwitch0 -p $VMNETWORK2 -v $VLANID2
echo "VLAN522 network configured" >> /tmp/PostInstall.log
}
setVLANXXX()
{
echo "Configuring VLAN526 Network" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-vswitch vSwitch0 -A $VMNETWORK3
/usr/sbin/esxcfg-vswitch vSwitch0 -p $VMNETWORK3 -v $VLANID3
echo "VLAN526 network configured" >> /tmp/PostInstall.log
}
setVMotion()
{
echo "Setting up VMotion" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-vswitch vSwitch0 -A VMotion
/usr/sbin/esxcfg-vswitch vSwitch0 -p VMotion
/usr/sbin/esxcfg-vmknic -a VMotion -i $VMIP -n 255.255.255.0
/usr/sbin/esxcfg-route $VMKGW
echo "VMotion configured" >> /tmp/PostInstall.log
}
setLocalNet()
{
echo "Configuring Private Network" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-vswitch --add --pg=Local vSwitch1
/usr/sbin/esxcfg-vswitch vSwitch1 -A Local
/usr/sbin/esxcfg-vswitch vSwitch1 -p Local
echo "Private network configured" >> /tmp/PostInstall.log
}
setSCMem()
{
echo "Setting Service Console Memory to 512MB" >> /tmp/PostInstall.log
mv -f /etc/vmware/esx.conf /tmp/esx.conf.bak
sed -e 's/boot\/memSize = \"272\"/boot\/memSize = \"512\"/g' /tmp/esx.conf.bak >> /etc/vmware/esx.conf
mv -f /boot/grub/grub.conf /tmp/grub.conf.bak
sed -e 's/uppermem 277504/uppermem 523264/g' -e 's/mem=272M/mem=512M/g' /tmp/grub.conf.bak >> /boot/grub/grub.conf
echo "Service Console Memory has been set to 512MB" >> /tmp/PostInstall.log
}
setVMFS()
{
echo "Creating VMFS partition name" >> /tmp/PostInstall.log
export VMFS_PARTITION=`fdisk -l /dev/cciss/c0d0 | grep fb | sed -e "s/\/dev\/cciss\/c0d0p\(.\).*/\1/"`
vmkfstools -C vmfs3 -S $VMFSPARTLABEL vmhba0:0:0:$VMFS_PARTITION
echo "VMFS partition name created" >> /tmp/PostInstall.log
}
setNameResolution()
{
echo "Adding DNS entries for Name Resolution" >> /tmp/PostInstall.log
echo "# Built by Automated Post Install Script" > /etc/resolv.conf
echo "search titan.satin.lo" >> /etc/resolv.conf
echo "search satin.lo" >> /etc/resolv.conf
echo "nameserver $DNS1" >> /etc/resolv.conf
echo "nameserver $DNS2" >> /etc/resolv.conf
echo "DNS setup for Name Resolution has been configured" >> /tmp/PostInstall.log
}
setESXcfg()
{
echo "Configure ESX Authentication" >> /tmp/PostInstall.log
esxcfg-auth --enablead --addomain titan.satin.lo --addc $HDC --krb5realm titan.satin.lo --krb5kdc $HDC --krb5adminserver $HDC
esxcfg-auth --passmaxdays=0
echo "ESX Authentication completed" >> /tmp/PostInstall.log
}
setAuthd()
{
echo "Updating vmware-authd to allow AD logons" >> /tmp/PostInstall.log
echo "#%PAM-1.0" > /etc/pam.d/vmware-authd
echo "# Built by automated post install script" >> /etc/pam.d/vmware-authd
echo "auth sufficient /lib/security/pam_unix_auth.so shadow nullok" >> /etc/pam.d/vmware-authd
echo "auth required /lib/security/pam_krb5.so use_first_pass" >> /etc/pam.d/vmware-authd
echo "auth sufficient /lib/security/pam_ldap.so" >> /etc/pam.d/vmware-authd
echo "account required /lib/security/pam_unix_acct.so" >> /etc/pam.d/vmware-authd
echo "account sufficient /lib/security/pam_ldap.so" >> /etc/pam.d/vmware-authd
echo "vmware-authd has been updated" >> /tmp/PostInstall.log
}
setFirewall()
{
echo "Configuring Firewall Ports" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-firewall --openport 88,tcp,out,KerberosClient
/usr/sbin/esxcfg-firewall --openport 88,udp,out,KerberosClient
/usr/sbin/esxcfg-firewall --openport 464,tcp,out,KerberosPasswordChange
/usr/sbin/esxcfg-firewall --openport 749,tcp,out,KerberosAdm
/usr/sbin/esxcfg-firewall --openport 389,tcp,out,in,LDAP
/usr/sbin/esxcfg-firewall --openport 636,tcp,out,in,OpenSSL
/usr/sbin/esxcfg-firewall --openport 2381,tcp,in,hpim
/usr/sbin/esxcfg-firewall --openport 2381,tcp,out,hpim
/usr/sbin/esxcfg-firewall --openport 231,udp,in,out,ntpd
/usr/sbin/esxcfg-firewall --openport 123,udp,in,out,ntpd
/usr/sbin/esxcfg-firewall --openport 280,tcp,out,sim-cert
/usr/sbin/esxcfg-firewall --openPort 161,tcp,out,in,SNMP
/usr/sbin/esxcfg-firewall --openPort 161,udp,in,SNMP
/usr/sbin/esxcfg-firewall --openPort 162,tcp,in,SNMP
/usr/sbin/esxcfg-firewall --openPort 162,udp,in,SNMP
/usr/sbin/esxcfg-firewall --enableService snmpd
/usr/sbin/esxcfg-firewall --enableService ntpClient
/usr/sbin/esxcfg-firewall --enableService CIMHttpsServer
/usr/sbin/esxcfg-firewall --enableService CIMHttpServer
/usr/sbin/esxcfg-firewall --enableService CIMSLP
/usr/sbin/esxcfg-firewall --enableService hpim
echo "Firewall has been configured" >> /tmp/PostInstall.log
}
setNTP()
{
echo "Turn of ntpd on start server" >> /tmp/PostInstall.log
chkconfig --level 345 ntpd on
service ntpd restart
hwclock --systohc
echo "NTP has been configured and started" >> /tmp/PostInstall.log
}
setSSHBanner()
{
echo "Setting up SSH Security Logon Banner Text" >> /tmp/PostInstall.log
echo $BANNERTXT1 > /etc/ssh/banner
echo " " >> /etc/ssh/banner
echo $BANNERTXT2 > /etc/ssh/banner
echo " " >> /etc/ssh/banner
echo $BANNERTXT3 > /etc/ssh/banner
echo " " >> /etc/ssh/banner
echo $BANNERTXT4 > /etc/ssh/banner
echo " " >> /etc/ssh/banner
echo $BANNERTXT5 > /etc/ssh/banner
echo " " >> /etc/ssh/banner
echo $BANNERTXT6 > /etc/ssh/banner
echo "banner /etc/ssh/banner" >> /etc/ssh/sshd_config
echo "SSH Banner Text has been Configured" >> /tmp/PostInstall.log
}
addGuestVM()
{
echo "Creating Guest VM" >> /tmp/PostInstall.log
mkdir /vmfs/volumes/$VMFSPARTLABEL/$VMNAME
exec 6>&1
exec 1>/vmfs/volumes/$VMFSPARTLABEL/$VMNAME/$VMNAME.vmx
echo #!/usr/bin/vmware
echo config.version = '"'8'"'
echo virtualHW.version = '"'4'"'
echo floppy0.present = '"'true'"'
echo nvram = '"'default.nvram'"'
echo powerType.powerOff = '"'default'"'
echo powerType.powerOn = '"'default'"'
echo powerType.suspend = '"'default'"'
echo powerType.reset = '"'default'"'
echo displayName = '"'$VMNAME'"'
echo extendedConfigFile = '"'$VMNAME.vmxf'"'
echo numvcpus = '"'$VCPUS'"'
echo scsi0.present = '"'true'"'
echo scsi0.sharedBus = '"'none'"'
echo scsi0.virtualDev = '"'lsilogic'"'
echo memsize = '"'$VMMEMSIZE'"'
echo scsi0:0.present = '"'true'"'
echo scsi0:0.fileName = '"'$VMNAME.vmdk'"'
echo scsi0:0.deviceType = '"'scsi-hardDisk'"'
echo ide0:0.present = '"'true'"'
echo ide0:0.clientDevice = '"'true'"'
echo ide0:0.deviceType = '"'cdrom-raw'"'
echo ide0:0.startConnected = '"'false'"'
echo floppy0.startConnected = '"'false'"'
echo floppy0.clientDevice = '"'true'"'
echo ethernet0.present = '"'true'"'
echo ethernet0.allowGuestConnectionControl = '"'false'"'
echo ethernet0.networkName = '"'$VMNETWORK'"'
echo ethernet0.addressType = '"'vpx'"'
echo ethernet0.generatedAddress = '"'$VMMAC'"'
echo guestOS = '"'$VMOS'"'
echo toolScripts.afterPowerOn = '"'true'"'
echo toolScripts.afterResume = '"'true'"'
echo toolScripts.beforeSuspend = '"'true'"'
echo toolScripts.beforePowerOff = '"'true'"'
echo scsi0:1.present = '"'true'"'
echo scsi0:1.fileName = '"'$VMNAME1.vmdk'"'
echo scsi0:1.deviceType = '"'scsi-hardDisk'"'
echo scsi0:1.mode = '"'independent-persistent'"'
echo sched.scsi0:1.shares = '"'normal'"'
echo floppy0.fileName = '"'/dev/fd0'"'
echo scsi0:0.redo = '"''"'
echo scsi0:1.redo = '"''"'
echo tools.syncTime = '"'FALSE'"'
exec 1>&-
exec 1>&6
exec 6>&-
cp -f /tmp/default.nvram /vmfs/volumes/$VMFSPARTLABEL/$VMNAME/default.nvram
chmod 755 /vmfs/volumes/$VMFSPARTLABEL/$VMNAME/$VMNAME.vmx
cd /vmfs/volumes/$VMFSPARTLABEL/$VMNAME
vmkfstools -c $VMDSIZE_C $VMNAME.vmdk -a lsilogic
vmkfstools -c $VMDSIZE_D $VMNAME1.vmdk -a lsilogic
vmware-cmd -s register /vmfs/volumes/$VMFSPARTLABEL/$VMNAME/$VMNAME.vmx
###############################################################################
mkdir /vmfs/volumes/$VMFSPARTLABEL/$VMNAMEA
exec 6>&1
exec 1>/vmfs/volumes/$VMFSPARTLABEL/$VMNAMEA/$VMNAMEA.vmx
echo #!/usr/bin/vmware
echo config.version = '"'8'"'
echo virtualHW.version = '"'4'"'
echo floppy0.present = '"'true'"'
echo nvram = '"'default.nvram'"'
echo powerType.powerOff = '"'default'"'
echo powerType.powerOn = '"'default'"'
echo powerType.suspend = '"'default'"'
echo powerType.reset = '"'default'"'
echo displayName = '"'$VMNAMEA'"'
echo extendedConfigFile = '"'$VMNAMEA.vmxf'"'
echo numvcpus = '"'$VCPUS'"'
echo scsi0.present = '"'true'"'
echo scsi0.sharedBus = '"'none'"'
echo scsi0.virtualDev = '"'lsilogic'"'
echo memsize = '"'$VMMEMSIZE'"'
echo scsi0:0.present = '"'true'"'
echo scsi0:0.fileName = '"'$VMNAMEA.vmdk'"'
echo scsi0:0.deviceType = '"'scsi-hardDisk'"'
echo ide0:0.present = '"'true'"'
echo ide0:0.clientDevice = '"'true'"'
echo ide0:0.deviceType = '"'cdrom-raw'"'
echo ide0:0.startConnected = '"'false'"'
echo floppy0.startConnected = '"'false'"'
echo floppy0.clientDevice = '"'true'"'
echo ethernet0.present = '"'true'"'
echo ethernet0.allowGuestConnectionControl = '"'false'"'
echo ethernet0.networkName = '"'$VMNETWORK'"'
echo ethernet0.addressType = '"'vpx'"'
echo ethernet0.generatedAddress = '"'$VMMACA'"'
echo guestOS = '"'$VMOS'"'
echo toolScripts.afterPowerOn = '"'true'"'
echo toolScripts.afterResume = '"'true'"'
echo toolScripts.beforeSuspend = '"'true'"'
echo toolScripts.beforePowerOff = '"'true'"'
echo scsi0:1.present = '"'true'"'
echo scsi0:1.fileName = '"'$VMNAMEA1.vmdk'"'
echo scsi0:1.deviceType = '"'scsi-hardDisk'"'
echo scsi0:1.mode = '"'independent-persistent'"'
echo sched.scsi0:1.shares = '"'normal'"'
echo floppy0.fileName = '"'/dev/fd0'"'
echo scsi0:0.redo = '"''"'
echo scsi0:1.redo = '"''"'
echo tools.syncTime = '"'FALSE'"'
exec 1>&-
exec 1>&6
exec 6>&-
cp -f /tmp/default.nvram /vmfs/volumes/$VMFSPARTLABEL/$VMNAMEA/default.nvram
chmod 755 /vmfs/volumes/$VMFSPARTLABEL/$VMNAMEA/$VMNAMEA.vmx
cd /vmfs/volumes/$VMFSPARTLABEL/$VMNAMEA
vmkfstools -c $VMDSIZE_C $VMNAMEA.vmdk -a lsilogic
vmkfstools -c $VMDSIZE_D $VMNAMEA1.vmdk -a lsilogic
vmware-cmd -s register /vmfs/volumes/$VMFSPARTLABEL/$VMNAMEA/$VMNAMEA.vmx
}
enableFirewall()
{
echo "Enabling the Firewall" >> /tmp/PostInstall.log
/usr/sbin/esxcfg-firewall --blockIncoming
/usr/sbin/esxcfg-firewall --blockOutgoing
echo "Firewall has been enabled" >> /tmp/PostInstall.log
echo "Post Installation has been Completed" >> /tmp/PostInstall.log
}
setUPS ()
{
echo "Liebert UPS client installation" >> /tmp/PostInstall.log
cd /
tar -zxvf /var/updates/ups.tar.gz
cp /var/updates/LiebertM /etc/init.d/LiebertM
chmod 755 /etc/init.d/LiebertM
cp /var/updates/LiebertM /etc/rc.d/init.d/LiebertM
chmod 755 /etc/rc.d/init.d/LiebertM
ln -s /etc/rc.d/init.d/LiebertM /etc/rc.d/rc0.d/S90LiebertM
ln -s /etc/rc.d/init.d/LiebertM /etc/rc.d/rc1.d/S90LiebertM
ln -s /etc/rc.d/init.d/LiebertM /etc/rc.d/rc2.d/S90LiebertM
ln -s /etc/rc.d/init.d/LiebertM /etc/rc.d/rc3.d/S90LiebertM
ln -s /etc/rc.d/init.d/LiebertM /etc/rc.d/rc4.d/S90LiebertM
ln -s /etc/rc.d/init.d/LiebertM /etc/rc.d/rc5.d/S90LiebertM
echo "Liebert UPS client installed" >> /tmp/PostInstall.log
}
setCleanUp()
{
echo "Removing Post Installation files and directory" >> /tmp/PostInstall.log
rm -f -r /var/updates
cp -f /etc/rc.d/rc.local.sav /etc/rc.d/rc.local
echo "Post Installation files and directory have been removed" >> /tmp/PostInstall.log
}
###############################################################################
\# MAIN PROGRAM
###############################################################################
echo "$SCRIPTNAME - Started" >> /tmp/PostInstall.log
echo "$DATETIME" >> /tmp/PostInstall.log
###############################################################################
\# Call Functions
###############################################################################
setPATH
openFirewall
setHPInsight
addPatches
addCopyFiles
setSSHRoot
setSNMP
setUsers
setConsoleSwitch
setProdNet
setVLAN104
setVLANXXX
setVMotion
setLocalNet
setSCMem
setVMFS
setNameResolution
setESXcfg
setAuthd
setFirewall
setNTP
setSSHBanner
addGuestVM
enableFirewall
setUPS
setCleanUp
###############################################################################
\# Script End
###############################################################################
echo "$SCRIPTNAME - Ended" >> /tmp/PostInstall.log
reboot
I hope this helps.
Remeber to save the files in linux format not DOS.
Ant
dude I have been editing the ks.cfg via winscp right click edit....can you suggest a better program?
yeah same here, having a script kinda takes the fun out of installing VI3..no?
I use a program called Ultraedit. You can download a trial version from http://www.ultraedit.com/
When you open you linux file, ultraedit will ask you if you want to convert the file to MSDOS format. Just say say no and it the file will stay in linux format.
You can always create and edit the file from the ESX command prompt you VI or other linux editors.
Ant
ok will try monday, dude I owe you a few beers next time im in oz
Think nothing of it. If it wasn't for the forums and all the helpful people using it, I would be struggling myself.
Ant
Free editor notepad plus.
Although mentioned in vmware classes.
Download link:
mmm the #post is still not executing?
I have checked and there are no extra characters
The only real differences I can see between your ks.cfg file and mine are:
1. the @base is before the post in your ks.cfg and after the post in mine.
2. you have %vmlicense_text in your ks.cfg and I don't (not that this should be causing any problems).
Other than that, everything else looks very similar to my ks.cfg file.
I guess if all else fails, you could try using my ks.cfg file and changing the IP address, domain names etc... to match your settings.
Ant
Its so weird after the first part executes and builds the host it then says its doing post configuration, then reboots but none of the configurations have taken place so the file must be good!
Mike Laverick - You are a GOD DOS2UNIX was the key!!! I will defo get you a beer.
I'm guessing from your last comment that you got it working. Good to hear.
Ant