VMware Cloud Community
dobyrne
Contributor
Contributor

esx 3script install- post install script

I am creating a install esx3 script booting from CD. Can install the esx server fine with it though still trying to work out how add the script in the post section. I also want to be able to copy files form the cd on to the esx server after the build. I need some help with copying files and also a post install script afterwards.

in the cfg file I have put this entry in

%pre

./mnt/source/sleeper.sh &

create a sleep.sh and put in the root of the cd. contents are:

cd /mnt/source

while true

do

sleep 120

done

to ensure that the cd stays in after the install. special thanks to dougdavis22.

then copy the files

cp -f -R /mnt/source/files /mnt/sysimage/tmp - how do I specify copying files to their locations after the post? any ideas?

Below is the script that I want to run. I created it, called it esxcfg.sh copy it into /etc/rc.d and run chmod +x /tmp/esxconfig.sh, tried to run it ./esxconfig to test. though got errors. works if I do it line by line manually. any ideas? Do I have to have the script in a specfic format?

  1. Create a vswitch and add vm portgroups, vlans and physical nics

esxcfg-vswitch -a vSwitch1

sleep 30

esxcfg-vswitch -A "70 VM Network BNE" vSwitch1

esxcfg-vswitch -A "74 VM Network BNE" vSwitch1

esxcfg-vswitch -A "76 VM Network BNE" vSwitch1

esxcfg-vswitch --pg="70 VM Network BNE" --vlan=70 vSwitch1

esxcfg-vswitch --pg="74 VM Network BNE" --vlan=74 vSwitch1

esxcfg-vswitch --pg="76 VM Network BNE" --vlan=76 vSwitch1

esxcfg-vswitch -L vmnic2 vSwitch1

esxcfg-vswitch -L vmnic3 vSwitch1

service mgmt-vmware restart

sleep 20

  1. Create a VMkernel setup with ip, vlan settings

esxcfg-vswitch -A VMkernel vSwitch0

esxcfg-vswitch -L vmnic1 vSwitch0

esxcfg-vmknic -a VMkernel -i 10.4.76.173 -n 255.255.255.0

esxcfg-route 10.4.76.1

esxcfg-vswitch --pg=VMkernel --vlan=76 vSwitch0

sleep 30

service mgmt-vmware restart

sleep 30

  1. Setup active and standby settings for SC and vmkernel

vimsh -n -e "hostsvc/net/portgroup_set --nicorderpolicy-active vmnic1 vSwitch0 VMkernel"

vimsh -n -e "hostsvc/net/portgroup_set --nicorderpolicy-standby vmnic0 vSwitch0 VMkernel"

vimsh -n -e "hostsvc/net/portgroup_set --nicorderpolicy-active vmnic0 vSwitch0 'Service Console'"

vimsh -n -e "hostsvc/net/portgroup_set --nicorderpolicy-standby vmnic1 vSwitch0 'Service Console'"

Reply
0 Kudos
2 Replies
dwight
Enthusiast
Enthusiast

Are you running the script after the system has been rebooted from kickstarting??






RHCE, VCP

Blog: http://computing.dwighthubbard.info

RHCE, VCP Blog: http://computing.dwighthubbard.info
Reply
0 Kudos
dobyrne
Contributor
Contributor

I got some of the script working by running by cat ing the contents to test, wouldnt work with the file that I had.

cat > /tmp/esxconfig.sh <<\EOF5

details....

EOF5

chmod +x /tmp/esxconfig.sh

then run it and worked.

now I need to work out how to copy some files from the cd to a install directory on the newly built esx server? any ideas?

Reply
0 Kudos