Guys, need some help.
I have a scenario where I need to do the following..
a: configure eth1 as the Service Console
b: run IP configuration of the Service Console in %POST% section and copy standard config file
c: during the %POST% section, run a sh configuration file to configure Port Groups, VLANs etc
I've created the config file to cover all these options but I get an error when the host base builds, reboots and attempts to call the test-cluster-a.sh file.
The error I get is.. :bad interpreter: No such file or directory
I've posted my config file below...
Auto-Generated Scripted Install Configuration file.
This file is used for VMware ESX Server Scripted Install Deployment
Installation Method
cdrom
root Password
rootpw --iscrypted
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 --device eth1 --bootproto static --ip x.x.x.x --netmask 255.255.252.0 --gateway x.x.x.x --nameserver x.x.x.x --hostname esx01.mydomain.net --addvmportgroup=0 --vlanid=0
Language
lang en_US
Langauge Support
langsupport --default en_US
Keyboard
keyboard uk
Mouse
mouse none
Reboot after install ?
reboot
Firewall settings
firewall --disabled
Clear Partitions
clearpart --all --initlabel --drives=cciss/c0d0
Partitioning
part /boot --fstype ext3 --size 128 --ondisk cciss/c0d0 --asprimary
part / --fstype ext3 --size 2048 --ondisk cciss/c0d0 --asprimary
part swap --size 1600 --ondisk cciss/c0d0 --asprimary
part /usr --fstype ext3 --size 2048 --ondisk cciss/c0d0
part /tmp --fstype ext3 --size 1024 --ondisk cciss/c0d0
part /opt --fstype ext3 --size 1024 --ondisk cciss/c0d0
part /var --fstype ext3 --size 2048 --ondisk cciss/c0d0
part /home --fstype ext3 --size 2048 --ondisk cciss/c0d0
part None --fstype vmkcore --size 100 --ondisk cciss/c0d0
part /vmimages --fstype ext3 --size 56000 --ondisk cciss/c0d0
VMware Specific Commands
vmaccepteula
vmlicense --mode=server --server=27000@dc01.mydomain.net --edition=esxFull --features=backup
%packages
@base
%post
cat > /tmp/esxcfg.sh <<EOF1
#!/bin/sh
Configure ESX Server
This section creates the PostinInstall Log File
echo "Create PostInstall Log" >> /tmp/PostInstall.log
scriptName="ESX Post Install Script" >> /tmp/PostInstall.log
echo "Create PostInstall Log complete" >> /tmp/PostInstall.log
Transfer Service Console NIC
echo "Setting Service Console NIC" >> /tmp/PostInstall.log
esxcfg-vswif -i x.x.x.x -n 255.255.252.0 vswif0
esxcfg-vswif -E vswif0
sleep 20
Copy Standard Config Files
echo "Copying standard configuration files" >> /tmp/PostInstall.log
esxcfg-firewall --allowOutGoing
sleep 10
cd /root
lwp-download http://x.x.x.x/hpmgmt-7.9.0-vmware3x.tgz
lwp-download http://x.x.x.x/configfiles.tar
tar -xf configfiles.tar
cp --reply=yes /root/ntp.conf /etc/ntp.conf
cp --reply=yes /root/step-tickers /etc/ntp/step-tickers
cp --reply=yes /root/krb5.conf /etc/krb5.conf
cp --reply=yes /root/vmware-authd /etc/pam.d/vmware-authd
cp --reply=yes /root/krb.conf /etc/krb.conf
cp --reply=yes /root/krb.realms /etc/krb.realms
cp --reply=yes /root/banner /etc/ssh/banner
cp --reply=yes /root/sshd_config /etc/ssh/sshd_config
cp --reply=yes /root/test-cluster-a.sh /tmp/test-cluster-a.sh
esxcfg-firewall --blockOutGoing
sleep 10
Make Cluster Config File eXcutable
cd /tmp
chmod +x /tmp/test-cluster-a.sh
./test-cluster-a.sh
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
This sections below is the test-cluster-a.sh file which I need to call from the %POST% section. Is it correct to start the file with #!/bin/sh ??
#!/bin/sh
Configure ESX Server
cd /
This section configures Service Console Memory to 800MB
echo "Setting Service Console Memory to 800MB" >> /tmp/PostInstall.log
mv -f /etc/vmware/esx.conf /tmp/esx.conf.bak
sed -e 's/boot\/memSize = \"272\"/boot\/memSize = \"800\"/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 818176/g' -e 's/mem=272M/mem=800M/g' /tmp/grub.conf.bak >> /boot/grub/grub.conf
echo "Setting Service Console Memory to 800MB now complete" >> /tmp/PostInstall.log
Create a vSwitch3 with a port group of VMotion using vmnic1
echo "Creating vSwitch3 with Supporting Port Groups & VLANs" >> /tmp/PostInstall.log
esxcfg-vswitch -a vSwitch3
esxcfg-vswitch -A VMotion vSwitch3
esxcfg-vswitch -L vmnic1 vSwitch3
esxcfg-vmknic -a VMotion -i x.x.x.x -n 255.255.255.0
service mgmt-vmware restart
sleep 20
vimsh -n -e "/hostsvc/VMotion/vnic_set portgroup2"
echo "Creating vSwitch3 with Supporting Port Groups & VLANs now complete" >> /tmp/PostInstall.log
Create vSwitch1 with supporting Port Groups & VLANs
echo "Creating vSwitch1 with Supporting Port Groups & VLANs" >> /tmp/PostInstall.log
esxcfg-vswitch -a vSwitch1:256
esxcfg-vswitch -L vmnic3 vSwitch1
esxcfg-vswitch -A VLAN100 vSwitch1
esxcfg-vswitch -v 100 -p VLAN100 vSwitch1
echo "Creating vSwitch1 with Supporting Port Groups & VLANs now complete" >> /tmp/PostInstall.log
Create a vSwitch2 with a port group of Legato and supporting VLAN's
echo "Creating vSwitch2 with Supporting Port Groups & VLANs" >> /tmp/PostInstall.log
esxcfg-vswitch -a vSwitch2
esxcfg-vswitch -A Legato vSwitch2
esxcfg-vswitch -L vmnic5 vSwitch2
esxcfg-vswitch -L vmnic2 vSwitch2
echo "Creating vSwitch2 with Supporting Port Groups & VLANs now complete" >> /tmp/PostInstall.log
Add 2nd DNS settings
echo "Adding secondary Name Server" >> /tmp/PostInstall.log
echo nameserver x.x.x.x >> /etc/resolv.conf
echo "Adding secondary Name Server now complete" >> /tmp/PostInstall.log
Make Folders
echo "Creating folders for updates and kerberos" >> /tmp/PostInstall.log
mkdir -p /var/kerberos/krb5kdc
mkdir /var/updates
echo "Creating folders for updates and kerberos complete" >> /tmp/PostInstall.log
NTP Configuration
echo "Configuring NTP Time Service" >> /tmp/PostInstall.log
chkconfig --level 345 ntpd on
service ntpd start
hwclock --systohc
echo "Configuring NTP Time Service now complete" >> /tmp/PostInstall.log
Enable Active Directory Authentification
echo "Active Directory Authentification" >> /tmp/PostInstall.log
esxcfg-auth --enablead --addomain=mydomain.net --addc=dc01.mydomain.net
esxcfg-auth --enablekrb5 --krb5realm=mydomain.net --krb5kdc=dc01.mydomain.net
useradd -m User01
echo "Active Directory Authentification now complete" >> /tmp/PostInstall.log
Install HP Agents
echo "Installing and configuring HP Agents" >> /tmp/PostInstall.log
cd /root
tar -zxvf hpmgmt-7.9.0-vmware3x.tgz
cd hpmgmt/790
./installvm790.sh --silent --inputfile /root/hpmgmt.conf
echo "Installing and configuring HP Agents complete" >> /tmp/PostInstall.log
Enable FireWall & Service Settings
echo "Enabling Services and Firewall Settings" >> /tmp/PostInstall.log
esxcfg-firewall --openPort 231,udp,in,out,ntpd
esxcfg-firewall --openPort 2381,tcp,in,hpim
esxcfg-firewall --openPort 2381,tcp,out,hpim
esxcfg-firewall --openPort 21,tcp,out,ftp
esxcfg-firewall --openPort 88,tcp,out,KerberosClient
esxcfg-firewall --openPort 464,tcp,out,KerberosPasswordChange
esxcfg-firewall --openPort 88,udp,out,
esxcfg-firewall --enableService ntpClient
esxcfg-firewall -e sshClient
esxcfg-firewall --enableService hpim
esxcfg-firewall --enableService snmpd
echo "Enabling Services and Firewall Settings now complete" >> /tmp/PostInstall.log
Enable Maintenance Mode
echo "Enabling Maintenace Mode for updates" >> /tmp/PostInstall.log
#vimsh -n -e /hostsvc/maintenance_mode_enter
echo "Enabling Maintenace Mode for updates now complete" >> /tmp/PostInstall.log
Upgrade ESX host
echo "Enabling Patching Script" >> /tmp/PostInstall.log
#cd /root
#chmod +x esx-autopatch_pl
#perl ./esx-autopatch_pl
#sleep 10
esxupdate -l query >> /tmp/esx301patching.txt
echo "Enabling Patching Script now complete" >> /tmp/PostInstall.log