Hello
I have to do a large deployment of VMWare Server 2 infrastructure in our cluster at school to run about 1000 vm’s for a project. With out current infrastructure we are able to run only about 700 vm’s but it’s enought.
The instalation of the VMWare Server 2 service was easy, i just had to configure the cfagent to do it for me. The instalation was done on Scientific Linux 5.5, so the modules were allready compiled. The ugly part was running vmware-config.pl all nodes.
So I started to search the web to find an elegant solution to my problem. The were sugestions on running vmware-config.pl with a response file as input but it didn’t work (vmware-config.pl < responses). A friend sugested me to try using expect scripts to automate the task. I googled a little and found some good examples on how to use expect. Expect is a tcl toolkit designed to automate wizards witch usualy requires human interaction.
After some try-catch demos I made this tcl script that reads a response file and with the help of expect the vmware configure wizard is run without human interaction. So I configured cfagent to run this script for me all nodes. You may need to adapt the response file to your needs. I had to tweek the vmware-config.pl script not to display the licence, just the yes/no question.
Info:
Script:
#!/usr/bin/expect --
set response_file "/root/bin/responses.txt"
set match [list]
set responses [list]
set program "/root/bin/vmware-config.pl"
#exp_internal 1
set infile [open $response_file r]
while { [gets $infile line] >= 0 } {
set tmp [split $line "|"]
lappend match [lindex $tmp 0]
lappend responses [lindex $tmp 1]
}
close $infile
set n [llength $match]
#exec yum -y erase VMware-server.x86_64
#exec rm -rf /etc/vmware
#exec yum -y install VMware-server.x86_64
set timeout 60
spawn $program
for {set i 0} {$i < $n} {incr i} {
set item [lindex $match $i]
set resp [lindex $responses $i]
puts "$item -> $resp"
expect -regex ".*$item.*"
send "$resp\n"
sleep 1
}
expect eof
Reponse file:
Press enter to display it|
Do you accept|yes
Do you want networking for your virtual machines|yes
Configuring a bridged network for vmnet0|br0
Which one do you want to bridge to vmnet0|eth0
Do you wish to configure another bridged network|yes
Configuring a bridged network for vmnet2|br1
Which one do you want to bridge to vmnet2|eth1
Do you wish to configure another bridged network|no
Do you want to be able to use NAT networking in your virtual machines|no
Do you want to be able to use host-only networking in your virtual machines|no
Please specify a port for remote connections to use|
Please specify a port for standard http connections to use|
Please specify a port for secure http \(https\) connections to use|
specify a different administrator|yes
Please specify the user whom you wish to be the VMware Server administrator|vmadmin
In which directory do you want to keep your virtual machine files|
what you want|yes
XXXXX-XXXXX-XXXXX-XXXXX|SERIAL
In which directory do you want to install the VMware VIX API binary files|
In which directory do you want to install the VMware VIX API library files|
Is this what you want|
In which directory do you want to install the VMware VIX API document pages|
Is this what you want|