Hello all,
This is my first attempt at getting an automated build created for VMware ESX 3.5 Update 3, the configuration script i'm using is below. It goes through the install okay and creates the file /etc/rc.d/rc.local but the script doesn't seem to run when the server boots up. I've read a few articles on this and have tried several different files and locations /etc/rc.d/S99postconfig, /etc/rc.d/rc3.d/S99postconfig, /etc/rc.d/S11servercfg, /etc/rc.d/rc3.d/S11servercfg and none of them seem to run. Can anybody tell me what i'm doing wrong.
Many thanks in advance.
Kickstart script
*
Auto-Generated Scripted Install Configuration file.*
This file is used for VMware ESX Server Scripted Install Deployment
*
Installation Method*
*cdrom
root Password*
*rootpw --iscrypted $zsbrvjhagwovuigakvgluizg/
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
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 102 --ondisk sda
part / --fstype ext3 --size 4997 --ondisk sda
part swap --size 1600 --ondisk sda
part None --fstype vmfs3 --size 10000 --grow --ondisk sda
part None --fstype vmkcore --size 110 --ondisk sda
*part /var/log --fstype ext3 --size 1992 --ondisk sda
*
%packages
*@base
%vmlicense_text
%post*
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.bk
cat > /etc/rc.d/rc.local << EOC
*#!/bin/bash
Put host into maintenance mode*
*vmware-vim-cmd /hostsvc/maintenance_mode_enter
Update DNS resolution*
*vmware-vim-cmd /hostsvc/net/dns_set --dns-searchdomain=\`dnsdomainname\`,net.\`dnsdomainname\`
Configure NTP*
esxcfg-firewall -e ntpClient
cat > /etc/ntp.conf << EOF
restrict kod nomodify notrap noquery nopeer
restrict 127.0.0.1
server 192.168.2.1
server 192.168.2.2
server 192.168.2.3
server 192.168.2.4
driftfile /var/lib/ntp/drift
EOF
cat > /etc/ntp/step-tickers << EOF
server 192.168.2.1
server 192.168.2.2
server 192.168.2.3
server 192.168.2.4
EOF
chkconfig ntpd on
service ntpd restart
*hwclock --systohc
Modify service console memory*
*vmware-vim-cmd /hostsvc/memoryinfo 838860800
Rename local storage*
*vmware-vim-cmd /hostsvc/datastore/rename \`hostname -s\`:storage1 "\`hostname -s\` local"
Network config*
/usr/sbin/esxcfg-vswitch vSwitch0 -L vmnic1
vmware-vim-cmd /hostsvc/net/vswitch_setpolicy --nicorderpolicy-standby=vmnic1 vSwitch0
/usr/sbin/esxcfg-vswitch -a vSwitch1
/usr/sbin/esxcfg-vswitch -A "VMotion" vSwitch1
/usr/sbin/esxcfg-vswitch -M vmnic2 vSwitch1 -p "VMotion"
/usr/sbin/esxcfg-vswitch -L vmnic2 vSwitch1
/usr/sbin/esxcfg-vswitch -L vmnic4 vSwitch1
vmware-vim-cmd /hostsvc/net/vswitch_setpolicy --nicorderpolicy-active=vmnic2 vSwitch1
vmware-vim-cmd /hostsvc/net/vswitch_setpolicy --nicorderpolicy-standby=vmnic4 vSwitch1
/usr/sbin/esxcfg-vswitch -a vSwitch2
/usr/sbin/esxcfg-vswitch -L vmnic3 vSwitch2
/usr/sbin/esxcfg-vswitch -L vmnic6 vSwitch2
vmware-vim-cmd /hostsvc/net/vswitch_setpolicy --nicorderpolicy-active=vmnic3 vSwitch2
vmware-vim-cmd /hostsvc/net/vswitch_setpolicy --nicorderpolicy-standby=vmnic6 vSwitch2
vmware-vim-cmd /hostsvc/net/vswitch_setpolicy --securepolicy-promisc=false vSwitch2
vmware-vim-cmd /hostsvc/net/vswitch_setpolicy --securepolicy-macchange=false vSwitch2
*vmware-vim-cmd /hostsvc/net/vswitch_setpolicy --securepolicy-forgedxmit=false vSwitch2
Allow DR LUN Availability*
*vmware-vim-cmd /hostsvc/advopt/update LVM.DisallowSnapshotLun int 0
Reset system to boot normally*
mv /etc/rc.d/rc.local /tmp/rc.local
*cp /etc/rc.d/rc.local.bk /etc/rc.d/rc.local
EOC
Make script executable*
*chmod +x /etc/rc.d/rc.local
*
Hello,
Within your script use 'full path names' to all commands. Or add a PATH setting as when /etc/rc.d/rc.local runs there is no PATH set.
Best regards,
Edward L. Haletky
VMware Communities User Moderator
====
Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education.
Blue Gears and SearchVMware Pro Blogs: http://www.astroarch.com/wiki/index.php/Blog_Roll
Top Virtualization Security Links: http://www.astroarch.com/wiki/index.php/Top_Virtualization_Security_Links
I've still not been ablt to this to work and have given up, i'm just going to run the script manually and wait for VI4.0 to be released.