Short recap: We did the initial setup of the staging server and we prepared the cobbler profile and kickstart file for our boot iso.
So, lets take all these little pieces and put them together for creating a complete lab environment.
The use case is that you want to train some people on a clustered grid infrastructure and asm including the software installation and initial setup. For this each participant needs at least two interconnected lab machines, the oracle software, the oracle users etc.
The test VM we created in the last post already has the oracle users and groups in place as well as the required operating system packages. Additionally we prepared downloading source files from the cobbler server. A perfect starting point.
What we need now is a way to create two or more VMs per participant and and easy deployment method. here we go…
First we slightly need to adjust the kickstart file so that the shared storage devices will not automatically get partitioned during the setup (/var/lib/cobbler/kickstarts/oracledatabaseserver.ks):
... #autopart part /boot --fstype ext3 --size=200 --ondisk=sda part pv.01 --grow --size=1 --ondisk=sda volgroup vgroot pv.01 logvol / --vgname=vgroot --size=4096 --name=lvroot --fstype=ext4 --fsoptions="barrier=0" logvol /var --vgname=vgroot --size=8192 --name=lvvar --fstype=ext4 --fsoptions="barrier=0" logvol /var/log/audit --vgname=vgroot --size=2048 --name=lvaudit --fstype=ext4 --fsoptions="barrier=0" logvol /tmp --vgname=vgroot --size=2048 --name=lvtmp --fstype=ext4 --fsoptions="rw,noexec,nosuid,nodev,auto,nouser,async,barrier=0" logvol /home --vgname=vgroot --size=1024 --name=lvhome --fstype=ext4 --fsoptions="rw,noexec,nosuid,nodev,auto,nouser,async,barrier=0" logvol swap --vgname=vgroot --size=2028 --name=lvswap --fstype=swap logvol /opt --vgname=vgroot --size=1 --grow --name=lvopt --fstype=ext4 --fsoptions="barrier=0" ...
On the cobbler server in /var/www/html create this script (create_lab.sh):
Update 2015-JAN-05: Attached the script as pdf as some parts of the script are not correctly displayed:
this is a very basic script, no error handling, no deep checks, no documentation but sufficiant to demonstrate the idea. when you call the script pass at least two parameters:
- the name of the lab you want to create
- the amount of participants you expect for the lab
- optionally: the number of VMs that should be created per participant. the default is 2
./create_lab.sh MY_LAB 2 Creating ISOs and VM Setup Script for Participant 1 creating VM 1, name MY_LAB_P_1_VM_1 creating VM 2, name MY_LAB_P_1_VM_2 Creating ISOs and VM Setup Script for Participant 2 creating VM 1, name MY_LAB_P_2_VM_1 creating VM 2, name MY_LAB_P_2_VM_2 MY_LAB_P_1_VM_1 MY_LAB_P_1_VM_2 MY_LAB_P_2_VM_1 MY_LAB_P_2_VM_2
What has happened? Basically this:
ls -la /var/www/html/MY_LAB/ total 158672 drwxr-xr-x. 2 root root 4096 Dec 16 14:13 . drwxr-xr-x. 7 root root 4096 Dec 16 14:13 .. -rw-r--r--. 1 root root 40613888 Dec 16 14:13 MY_LAB_P_1_VM_1.iso -rw-r--r--. 1 root root 40613888 Dec 16 14:13 MY_LAB_P_1_VM_2.iso -rw-r--r--. 1 root root 40613888 Dec 16 14:13 MY_LAB_P_2_VM_1.iso -rw-r--r--. 1 root root 40613888 Dec 16 14:13 MY_LAB_P_2_VM_2.iso -rw-r--r--. 1 root root 3883 Dec 16 14:13 setup_p_1.sh -rw-r--r--. 1 root root 3883 Dec 16 14:13 setup_p_2.sh
You got two boot isos per participant and one setup script for each participant which will setup the 2 virtualbox vms on a workstation. because everything is placed in a directory which is accessible via http you could just give the link at the beginning of the lab and ask each participant to pickup one of the setup scripts (http://192.168.56.101/MY_LAB in this setup):
Ask them to execute the script on their workstations and the vms will get setup. Once they are started up everything will get installed automatically (choose the VM Name in the initial bootloader and eth0 as the network interface to be configured).
For a short demo I took the 2 VMs generated for participant 1, fired them up and waited for the installation to complete:
Both have the network interfaces configured:
Both have the shared storage devices available (sdb,sdc,sdd):
Both have the oracle users and groups:
And both have opatch available as an example source:
Conclusion: Although you’ll need some time to setup all this stuff once you have it in place you are extremly fexible. If there is a requirement for a different setup just create a new cobbler profile, maybe create a new kickstart file and you’re basically done. The create_lab.sh script needs much more attention, especially if you want to additionally create the vm setup stuff for windows, but this should not be a big deal as the vboxmanage command should work the same way.
Another goody: If some of the participants have plenty of memory and disk on their workstations just generate 3 or more boot isos per participant. Those with lesser resources just can comment or delete the lines for the third and fourth VMs while the others can go with the full set of VMs.