|
I've not been using the UDA for a long time since I didn't needed it. But I wanted to have my home environment scripted and I noticed a new version was out. So I thought: 'Lets give it a try'. The new features are awesome: check Fokkema's post.
I downloaded beta5 from here: http://www.ultimatedeployment.org/uda20beta.html . First disapointment: it wasn't OVF format. No problemo, I used my 'datastore browser' and uploaded the files to VMFS. Added the .vmx to my inventory and... too bad... the .vmdk is in sparse format which my ESX4i didn't support (must be a VMware Workstation file or something). So I used vCenter Converter to import the VM to my ESX4i server. After quite some time I was ready to go. And today I noticed a funny Twitter post:
"@jpiscaer downloading the newly uploaded UDA OVF"
So I asked him where to find it:
"@jpiscaer @boukeg http://bit.ly/M27lN . Issue with backup up ESXi server solved by moving all VM's to a single LUN"
Well thanks! It's a bit too late for me, but it might help you.
Setup is very easy: it asks: ip address, password, and what services (dchp, tftp, smb, nfs, etc...) to enable. Great! I'm using a Windows 2003 DHCP/DNS server so I was able to disable the DHCP server (which is by default deselected).
Next thing I did was adding some settings in my Windows 2003 DHCP Server. Added:
 So that is scope options: 066 <to the ip address or host name to uda> 067 pxelinux.0
If you want to use the DHCP server in the UDA, fine, just configure it. The webinterface is very intuitive.
Next thing was connecting an ESX 3.5U4 iso which I have on NFS. And mounted it, this was without any problems.
Then I created a template. Works like a charm. You need to customize yourself, but the layout is quite logical. There are some bugs which I'll point out later. First things first: PXE. I have had some BIG issues with PXE. Getting an IP from DHCP took ages!!! After wondering around in Google, I've found that STP Portfast should be enabled on your switch. Now if you have an unmanaged switch, you do not have to worry, it doesn't have STP most of the time, so you can't set STP Portfast. IF... But I have a managed switch ... Which I bought second handed  , and I didn't know the IP address nor Password   .
But what I do have is a shitty little 5 port gigabit switch lying around somewhere, so I put it in between my eth0 card and switch...
That seemed to work. But the first question was: On what interface do you want to do the installation... Not very unattended right. Added --ksdevice=eth0 to the Kernel option command-line in the UDA template. That worked.
Yessss, after 6 hours (trust me, time flies when you are rebuilding your lab, putting other switches in between other switches, try to hack into a switch here you don't have the password, not know the IP Address..., and not to forget: rebooting about 650 times or so) I finally had something.
So, the installation started, and all goes well. It's bloody fast, installing the files in 2 minutes. And waiting for the first reboot... Yesss, that works too, great...
But... Where are the things I put into my %post? Nothing happened. I have a clean installation of my ESX server, which is great, but what about those virtual switches I created, and what about those port groups?
Well... They didn't work. And after taking a look at the script, looking at the ESX server, rebooted 10 times... I was tempted to stop. But I found some strange things... ? (question marks) in filenames, ^M (Control M) in script files I created. Looking into Google, trying to find issues with ^M and ?. Couldn't find anything. So I tried the UDA forum (see link below). And guess what, I wasn't the only one.
Patrick van Rantwijk from CDG had *exactly* the same issue. And he had a fantastic idea, tricking pxe to add | echo "Done" (do not forget the | - pipe sign here). I was finally getting somewhere. Script seem to work, virtual switched are created, settings are applied.
Except for two things. Enable iSCSI, rescan - and enable VMotion. This is tricky. A lot of posts on the community about this one, none resolved (or with workarounds). I have found that S99local is started BEFORE everything is finished. So I renamed S99local to S99zlocal. Now the script starts last. Which is the way it supposed to. But while the script runs, some core services are not running yet, and the script isn't waiting for it. So what I did was creating a second script, start it in the background, added a sleep timer and did some other important stuff: read this article. This seems to work. This is my final script:
# VMware ESX3 template Kickstart file
# Installation Method
url --url=http://[UDA_IPADDR]/[OS]/[FLAVOR]
# root Password
rootpw vmware
# Authconfig
auth --enableshadow --enablemd5
# BootLoader ( The user has to use grub by default )
bootloader --driveorder=[DISKTYPE] --location=mbr
# Timezone
timezone Europe/Amsterdam
# X windowing System
skipx
# Install or Upgrade
install
# Text Mode
text
# Network install type
network --bootproto static --ip [IPADDRESS] --netmask 255.255.255.0 --gateway 192.168.2.1 --nameserver 192.168.2.155 --hostname [SUBTEMPLATE].jume.local --addvmportgroup=1 --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=[DISKTYPE]
# Partitioning
part /boot --fstype ext3 --size 250 --ondisk [DISKTYPE] --asprimary
part swap --size 1600 --ondisk [DISKTYPE] --asprimary
part / --fstype ext3 --size 5120 --ondisk [DISKTYPE] --asprimary
part /var --fstype ext3 --size 2048 --ondisk [DISKTYPE]
part /tmp --fstype ext3 --size 2048 --ondisk [DISKTYPE]
part /opt --fstype ext3 --size 2048 --ondisk [DISKTYPE]
part /home --fstype ext3 --size 2048 --ondisk [DISKTYPE]
# part None --fstype vmkcore --size 100 --ondisk [DISKTYPE]
# part /vmimages --fstype ext3 --size 1 --grow --ondisk [DISKTYPE]
# VMware Specific Commands
vmaccepteula
vmlicense --mode=server --server=27000@vm90000.jume.local --edition=esxFull
%packages
@base
%vmlicense_text
%post
# Backup original rc.local file
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.bak | echo "Done"
cat > /tmp/esxcfg.sh.tmp <<EOF
#!/bin/sh
# Configure ESX Server
# Create vSwitch1 with a port group of Internal
esxcfg-vswitch -L vmnic1 vSwitch0
esxcfg-vswitch -L vmnic3 vSwitch0
esxcfg-vswitch -A vMotion vSwitch0
esxcfg-vmknic -a vMotion -i [VMOTION] -n 255.255.255.0
# Create a vSwitch4 with a port group iSCSI/iSCSI-CIS using vmnic3
esxcfg-vswitch -a vSwitch1
esxcfg-vswitch -A iSCSI vSwitch1
esxcfg-vmknic -a iSCSI -i [ISCSIVMK] -n 255.255.255.0
esxcfg-vswitch -A iSCSI-COS vSwitch1
esxcfg-vswif -a vswif1 -p iSCSI-COS -i [ISCSISC] -n 255.255.255.0
esxcfg-vswitch -L vmnic2 vSwitch1
# Create a local user for SSH Access - Default password is password
# useradd -p '$1$Rg69B9QA$JUtqStBrjNFbyzyP9zTsf0' -c "New Account Created By Kickstart" newaccount
# Allow ROOT access using SSH - Warning this is NOT the must 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
# Enable the SSH client (Out/From an ESX hosts)
esxcfg-firewall -e sshClient
# Setup ntpd parameters
cat > /etc/ntp.conf << NTP
restrict default kod nomodify notap noquery nopeer
restrict 127.0.0.1
server 0.nl.pool.ntp.org
server 1.nl.pool.ntp.org
server 2.nl.pool.ntp.org
server nl.pool.ntp.org
fudge 127.127.1.0 stratum 10
driftfile /etc/ntp/drift
broadcastdelay 0.008
authenticate yes
keys /etc/ntp/keys
NTP
cat > /etc/ntp/step-tickers << STEP
0.nl.pool.ntp.org
1.nl.pool.ntp.org
2.nl.pool.ntp.org
nl.pool.ntp.org
STEP
/sbin/chkconfig –level 3 ntpd on
esxcfg-firewall -e ntpClient
# Update system clock
/sbin/hwclock –systohc –utc
# The –utc setting in the “timezone” command above eliminates the need for updating the clock file
#cat > /etc/sysconfig/clock << CLOCK
#ZONE=”UTC”
#UTC=true
#ARC=false
#CLOCK
EOF
cat > /tmp/esxcfg2.sh.tmp <<EOF
#!/bin/sh
sleep 60
# Enable vMotion
VMK=\$(esxcfg-vmknic -l |grep vMotion |awk '{print \$1}')
vimsh -n -e "/hostsvc/vmotion/vnic_set \$VMK"
# Set-up iSCSI Software Emulator
su - root -c "esxcfg-swiscsi -e"
su - root -c "vmkiscsi-tool -D -a 10.0.0.100 vmhba32"
su - root -c "esxcfg-swiscsi -s"
su - root -c "esxcfg-rescan vmhba32"
/usr/bin/vimsh -n -e "hostsvc/datastore/nas_create software storage /raid0/data/software 1"
EOF
mv /etc/rc3.d/S99local /etc/rc3.d/S99zlocal | echo "Done"
# Make esxcfg.sh run from rc.local and make rc.local reset itself
cat >> /etc/rc.d/rc.local <<EOF
tr -d '\15\32' < /tmp/esxcfg.sh.tmp > /tmp/esxcfg.sh | echo "Done"
chmod +x /tmp/esxcfg.sh | echo "Done"
/tmp/esxcfg.sh 2>&1 /tmp/errout
tr -d '\15\32' < /tmp/esxcfg2.sh.tmp > /tmp/esxcfg2.sh | echo "Done"
chmod +x /tmp/esxcfg2.sh | echo "Done"
/tmp/esxcfg2.sh 2>&1 /tmp/errout
/etc/rc.d/init.d/sshd restart >> /tmp/servicestart
/etc/rc.d/init.d/mgmt-vmware restart >> /tmp/servicestart
/etc/rc.d/init.d/ntpd start >> /tmp/servicestart
mv -f /etc/rc.d/rc.local.bak /etc/rc.d/rc.local | echo "Done"
EOF
So anyway, there are some great resources out there:
VMware Communities
RTFM website
UDA Forum
Update: Gabe contacted me throught Twitter and he had a great tip for the UDA: countdown timer on the PXE Boot menu.
- Edit /var/public/cgi-bin/config.pl
- 2- Search for the subroutine WriteDefaultFile.
- Behind the following part:
local($result)=open(DEFAULT,”>$DEFAULTFILE”);
print DEFAULT “default menu.c32\n”;
print DEFAULT “prompt 0\n”;
print DEFAULT “menu title Ultimate Deployment Appliance\n”;
print DEFAULT “menu INCLUDE pxelinux.cfg/graphics.conf\n”;
Add:
print DEFAULT “label localboot\n”;
print DEFAULT “MENU LABEL Boot from first local harddrive\n”;
print DEFAULT “localboot 0\n”;
print DEFAULT “timeout 120\n”;
Save the file and go to the webinterface of the UDA and re-save any template.
Now when you boot a server over PXE, you will be prompted with a menu which now also includes a countdown timer. After the countdown is finished, normal boot will proceed.
|