Michelle_Laveri
Virtuoso
Virtuoso

Scripted Installations Thread

It's occoured to me that currently peoples "kickstart" questions & answers are dotted all over the place on various other threads/blogs. Beyond that there seems to be innumberable resources online especially on redhat.com.

Most of my work with kickstart has been with the UDA, although I have done some work building custom ESX CDs, and at some stage I must return to the topic of putting ESX on a memory stick - which has worked for others, but I've never made work personally.

I wondered if it would be useful to have like a "master" kickstart thread were people post their findings or questions in one place. Perhaps like a sticky FAQ?

Regards

Mike

Regards
Michelle Laverick
@m_laverick
http://www.michellelaverick.com
0 Kudos
206 Replies
brugh
Enthusiast
Enthusiast

i built an appliance dedicated to ESX installations. it has a script-builder that makes setting up a ks.cfg very easy. most useful functions are built-in.

have a look: http://www.vmware.com/vmtn/appliances/directory/1216

0 Kudos
mikef123
Contributor
Contributor

for some reason i don't have the ablility to upload files. it says that i'm not authorized. Is there somewhere I have to ask to have that feature allowed?

thanks

mike

0 Kudos
Chiel
Enthusiast
Enthusiast

I have 2 challenges i would like to get scripted for my auto built;

1) Automaticlly add Host to Virtual Center

2) Create an Alligned local VMFS3 volume with the remaing disk space.

Anyone have any ideas?

0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso

See inline...

I have 2 challenges i would like to get scripted for my auto built;

1) Automaticlly add Host to Virtual Center

No way of doing this from the COS/Kickstart script as far as I know. The only way would be through a schedule task in VC or using the VC SDK....

2) Create an Alligned local VMFS3 volume with the remaing disk space.

You would have to create just ext3/vmkcore partitions in kickstart - and then automate fdisk using redirection to answer the questions that fdisk asks like this

fdisk /dev/sda < answer.txt

To get alignment you would include in the answer.txt - the use of "expert mode" to set 128k offset/starting block...

Once the partition was created (using fb as the type, as opposed to 83 which represents EXT3 partitions)

You would have then have to format the partition with vmkfstools -C -t vmfs3 -S and so...

You would also have to be VERY, VERY careful you didn't accidentally partition a LUN on your SAN by mistake - proceed with caution...

Regards

Mike

Anyone have any ideas?

>

Regards
Michelle Laverick
@m_laverick
http://www.michellelaverick.com
0 Kudos
Chiel
Enthusiast
Enthusiast

Hi Mike,

Thanks for the answers.

I'll have a look at the VC SDK...haven't played with it that much, but if im not mistaken its just a perl file you execute against the VC server right?

So it should be possible to copy that 1 perl script to your esx host during the Post and execute it from there.

Ok so the alligning for a local VMFS3 volume might be best to keep doing manually. We only use HP hardware tho which always use cciss. Wouldn't that make it less risky?

Else i'll just keep doing it manually.

0 Kudos
brugh
Enthusiast
Enthusiast

i thought that creating a partition under esx 3.5 will automatically align it correctly for optimum performance. i read that somewhere but forgot where.. but there's a good document from vmware that lets you know how to do it manually: http://www.vmware.com/pdf/esx3_partition_align.pdf

ailgning and cciss don't have anything to do with eachother. using cciss is less risky when you automatically format your root devices. if you use cciss these will be named /dev/cciss/c0d0 and if you format that, you know for sure it's local storage and not the first lun on you san. if you want to be sure you're on local storage when automatically installing esx servers, you'll have to remove the storage drivers from the initial pxe ramdisk image. i built a script into the EDA that does that automatically for all servers that are not HP :).

and you can't run sdk perl scripts on the esx host. the perl scripts use the VC api to connect to the VC. or perhaps running it on the esx server would do that too but then, what's the point.

0 Kudos
Chiel
Enthusiast
Enthusiast

Thanks for the link, i'll have a look at it.

About automatically alligning, it does this when you create a local VMFS3 volume through the VI client. I rather want to script this.

I mentioned the cciss because maybe you could use it to create that extra partition. and you will know for sure that cciss is your local disk and not your SAN disk.

I already created an ISO without HBA drivers. They are loaded once your in your Post section tho.

Btw EDA is a great appliance.

The point about being able to run it on the esx server is that you could automaticlly add your esx Host to VC after the install. Without extra manual actions.

0 Kudos
analyst7
Contributor
Contributor

I do not want my scripted installation to install on a VMFS3 partition in case the SAN cables are not disconnected by accident thus messing up a LUN.

Can someone tell me what command I would enter in my KS script and before what section? Ex. before the partitioning portion?

0 Kudos
brugh
Enthusiast
Enthusiast

i updated eda () to version 0.71. the bug where it was still trying to index SAN storage (but not installing on it) is fixed so there's no need to disconnect or mask the storage when installing anymore. also it's completely scsi based so all you'd have to do to get it to work on ESX is to copy it to the server, import the disk with 'vmkfstools -i dest.vmdk source.vmdk', create a new vm with 160mb ram and add the existing disk.

if i get unlimited storage on the internet somewhere i'd like to create a pre-configured ESX version and a vmware server 1.x version but until then i'll just post this one generic one that people can import easily ;). i run it on esx servers all the time when i do deployments at my customers. just the first one and the testruns run from my laptop's vmware workstation. totally cool Smiley Happy

0 Kudos
dinny
Expert
Expert

Hiya,

If you don't want to use eda or similar, the safest way is to just strip out the SAN drivers from the ESX ISO before using it,

Fairly time consuming if you do it manually:

http://xtravirt.com/index.php?option=com_remository&Itemid=75&func=fileinfo&id=13

But using Boeke's script, it only takes a few minutes...:

http://www.jume.nl/index.php?option=com_content&task=view&id=34&Itemid

Dinny

0 Kudos
brugh
Enthusiast
Enthusiast

yeah, i used the xtravirt docs to create the script in eda (/usr/bin/scr). it does almost the same thing as bauke's, except it's less picky on esx versions (bauke's script doesn't do esx 3.5). eda's script just changes the network install part though, not the cdrom installer. hm.. perhaps i'll fix that and put the script up somewhere.

0 Kudos
dinny
Expert
Expert

Haven't tried it yet - but there was a note on Bouke's site that the current script now supported esx 3.5 too...

Dinny

0 Kudos
moberle
Contributor
Contributor

I adapted bauke's script to handle ESX3.5 it takes about a minute to create a no-san installation.

0 Kudos
mikef123
Contributor
Contributor

I ran into this problem also. I took a little different tack. I download the net::telnet::bcd module. (there is one for cisco also) and i wrote a perl script to disable the switch and then enable it after load. It works fine. It is also very quick.

0 Kudos
mikef123
Contributor
Contributor

You can also subsititute portdisable and portenable if you don't want to disable the whole switch. You can just disable the ports the esx server is attached to.

0 Kudos
brugh
Enthusiast
Enthusiast

cool, i'll go check it out. last time i've seen it, only 3.02 was supported.

0 Kudos
SFMarkham
Contributor
Contributor

But using Boeke's script, it only takes a few minutes...:

FYI, Code to add to script for ESX 3.5 Update 2 Build 103908 on or about line 68

e4d19c127f01699c6927f45a6bb96504) # MD5SUUUM for the ESX 3.5 build 103908 released 07/25/08

VERSION=2.4.21-57.ELBOOT;

echo "MESSAGE: This is a valid ESX 3.5 Update 2 ISO, continuing...";;

0 Kudos
waghekk
Contributor
Contributor

Hi Guys

Hope someone can put me out of my misery i been having for few days.

I was struggling sorting the active and standby NIC issue which i have now with: (Thanks to Davey)

mv /etc/vmware/esx.conf /tmp/esx.conf.bak

sed -e 's/net\/vswitch\/child[0000]\/teamPolicy\/maxActive = \".\"/net\/vswitch\/child[0001]\/teamPolicy\/maxActive = \"2\"/g' /tmp/esx.conf.bak &gt;&gt; /etc/vmware/esx.conf

Well now i have 2 NICs on active what i now need to do is, i got two port groups "VMotion" and "service Console" I need one nic to be active and one standby for each portgroup i.e. nic 0 active for Service Console nic 1 standby and vice versa for VMotion. I was asked to try this:

/usr/bin/vimsh -n -e "hostsvc/net/portgroup_set --nicorderpolicy-active=vmnic2 --nicorderpolicy-standby=vmnic0 vSwitch0 'VMotion'"

/usr/bin/vimsh -n -e "hostsvc/net/portgroup_set --nicorderpolicy-active=vmnic0 --nicorderpolicy-standby=vmnic2 vSwitch0 'Service Console'"

But this gives me erros such as "file not found" current directory vmware/hostd, (Vmoid) Parameter was not correct and etc etc

I have tried without the /usr/bin/ and just have vimsh at the front also had restart mgmt.vmware with sleep 20,40, 120 etc still no joy

Had same issue when i was trying this on active/standby on switch but the sed command solved it.

Does anyone know how i can do this prefably with the sed command as vimsh is misery to me Smiley Sad

Thanks all.

0 Kudos
dinny
Expert
Expert

Hiya,

I did exactly the same thing last week.

I did have a few issues with vimsh failing intermittently - but a sleep and/or a couple of service restarts seemed to sort it.

The following works fine for me....

start of script example

mv /etc/vmware/esx.conf /tmp/esx.conf.bak

sed -e 's?net\/vswitch\/child\[0000\]\/teamPolicy\/maxActive = \".\"?net\/vswitch\/child\[0000\]\/teamPolicy\/maxActive = \"2\"?g' /tmp/esx.conf.bak &gt;&gt; /tmp/esx.conf.bak2

sed -e 's?net\/vswitch\/child\[0001\]\/teamPolicy\/maxActive = \".\"?net\/vswitch\/child\[0001\]\/teamPolicy\/maxActive = \"4\"?g' /tmp/esx.conf.bak2 &gt;&gt; /etc/vmware/esx.conf

service mgmt-vmware restart

sleep 50

service vmware-vmkauthd restart

sleep 5

vmware-vim-cmd internalsvc/refresh_network

vmware-vim-cmd hostsvc/net/portgroup_set --nicorderpolicy-active vmnic5 vSwitch0 vmotion

vmware-vim-cmd hostsvc/net/portgroup_set --nicorderpolicy-active vmnic0 vSwitch0 'Service Console'

vmware-vim-cmd hostsvc/net/portgroup_set --nicorderpolicy-standby vmnic0 vSwitch0 vmotion

vmware-vim-cmd hostsvc/net/portgroup_set --nicorderpolicy-standby vmnic5 vSwitch0 'Service Console'

End of script example.

I really do suggest sticking with vimsh.vmware-vim-cmd - the functionality does make it well worthwhile...

Dinny

0 Kudos
waghekk
Contributor
Contributor

Hi Dinny,

Thanks for that. That did the trick however i got another issue after that. For some reason when it is enabling the active/standby on a per port basis i get all the options in the portgroup properties ticked which i dont want. i.e

VMotion &gt; edit and tabs on top in properties (security, traffic shapping, nic teaming) all the options in there are ticked.

I want it to be the default i.e no options ticked but just under nic teaming - fail over detection by link status only.

Not sure why its doing this all of a sudden.

Any ideas? Or is there a scrip for that too now

0 Kudos