All,
I have almost managed to create an iso image with my custom ks.cfg file injected into it. However i am now falling over at what i think is the last hurdle so was wondering if somebody could assist. The problem i am having is that my build completes fully but unfortuently the networking commands (e.g creating a vSwitch or adding a port group etc) arn't being applied. Other settings such as hostname, ip addres of service console which i have setup my ks.cfg to prompt for and configure dynamically seem to work.
One interest thing i noticed is that if i open up the /etc/ntp.conf on the esx server all the commands and comments under the "server ntp.domain.com" line in my ks.cfg file seem to be entered into this file - AS A RESULT im not sure if ive got a syntax problem in my kickstart file.
My ks.cfg file contains the following (i have taken out gateway, nameserver, ntp server name etc)
accepteula
keyboard uk
firewall --allowOutgoing
firewall --allowIncoming
Read network information from a file we are going to populate in the %pre section
of this kixstart script.
%include /tmp/networkconfig
auth --enablemd5 --enableshadow
install cdrom
rootpw --iscrypted $1$bayw34kz$cwHzrtubh9N.NZjf
timezone --utc 'Europe/London'
Read partition information from a file we are going to populate in the %pre section
This allows me to create local vmfs with "hostname:storage1" and I've adjusted the sizes
on my service console partitions.
%include /tmp/partconfig
%pre --interpreter=bash
#################################
Get network information ###
#################################
Clear screen prior to prompting for input and change to virtual terminal 1
vSphere will only work on tty1 to read input
exec </dev/tty1 >/dev/tty1
chvt 1
header ()
{
clear
echo
echo "################################################################"
echo "### VMWare ESX 4.0 Scripted Install ###"
echo "################################################################"
echo
}
Get user input
while ;do
header
echo -n "Please Enter FQDN for ESX Host: "
read fqdn
done
while ;do
header
echo -n "Please Enter Service Console IP Address: "
read ipnew
done
Change back to tty 6 to watch progress on packages
chvt 6
Let's cut the fqdn suffix off the hostname so we can name the vmfs partition
named something like this: "hostname:storage1"
temp_host=`echo $fqdn | cut -f1 -d"."`
Now we are going to save of partition information using the new vmfs volume name
so that it can be used by Weasel install
cat <<EOF> /tmp/partconfig
Use first detected disk:
clearpart --firstdisk --overwritevmfs
part '/boot' --fstype=ext3 --size=1100 --onfirstdisk
Uncomment to use first detected disk:
#part '/boot' --fstype=ext3 --size=1100 --onfirstdisk
part 'none' --fstype=vmkcore --size=110 --onfirstdisk
Uncomment to use first detected disk:
#part 'none' --fstype=vmkcore --size=110 --onfirstdisk
part 'Storage1' --fstype=vmfs3 --size=9208 --grow --onfirstdisk
Uncomment to use first detected disk:
#part 'Storage1' --fstype=vmfs3 --size=9208 --grow --onfirstdisk
virtualdisk 'esxconsole' --size=8208 --onvmfs='Storage1'
part 'swap' --fstype=swap --size=1204 --onvirtualdisk='esxconsole'
part '/var/log' --fstype=ext3 --size=2000 --onvirtualdisk='esxconsole'
part '/' --fstype=ext3 --size=5000 --grow --onvirtualdisk='esxconsole'
EOF
Write the networkconfig file to be used by the Weasel install
Using the "--addvmportgroup=0" option because another script will define my specific port groups
cat <<EOF> /tmp/networkconfig
network --device=vmnic2 --bootproto=static --ip=$ipnew --netmask=255.255.255.0 --gateway=XXX.XX.XX.XXX --nameserver=XXX.XX.XX.XXX --hostname=$fqdn --addvmportgroup=true
EOF
Need an extra post section that is not chrooted to save my variables from PRE
%post --nochroot
%post --interpreter=bash
##########################################################
Allow hostd etc. some time to load
/usr/bin/sleep 90
ntp settings
esxcfg-firewall --enableService ntpClient
chkconfig ntpd on
cat > /etc/ntp.conf <<EOF
---- ntp.conf ----
Created by Weasel (ESX Installer)
Permit time synchronization with our time source, but do not
permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
server ntp.domain.com
ADD a nic to vSwitch0 (second one for service console)
/usr/sbin/esxcfg-vswitch -L vmnic3 vSwitch0
Create a new vSwitch called vSwitch_VLAN2
/usr/sbin/esxcfg-vswitch -a vSwitch_VLAN2
ADD a portgroup called CustomVLAN to the vSwitch called vSwitch_VLAN2
/usr/sbin/esxcfg-vswitch -A CustomVLAN vSwitch_VLAN2
/usr/sbin/esxcfg-vswitch -L vmnic1 vSwitch_VLAN2
Delete the port group called VM Network from vSwitch0
/usr/sbin/esxcfg-vswitch -D "VM Network" vSwitch0
Hi,
You could try adding the below commands in the ks and try,
For SC
/usr/sbin/esxcfg-vswif --ip Award Points if helpful!!