Virtualization Technology News and Information
Article
RSS
Vmware Provisioning Script Take 1

Here is a VMware provisioning script shared by Charles Wyble:

createVmFuncs.sh



#!/bin/bash

#A script to automatically create and boot a vmware image. Supporting functions.
#Copyright Charles Wyble / Open Source Delivery Systems 2007 and later
#Licensed under GPLv2 only.


createVmDir()
{

echo "Creating new virtual machine directory..."
mkdir -p $IMAGE_PATH
}


createVmDisk()
{
echo "Creating disk for vm image..."
qemu-img create -f vmdk $VMDK_IMAGE ${DISK_SIZE} M
}


createVmxFile()
{
echo "Creating configuration file..."
}


createVm.sh


#!/bin/bash

#A script to automatically create and boot a vmware image
#Copyright Charles Wyble / Open Source Delivery Systems 2007 and later
#Licensed under GPLv2 only.

#User editable variables
BASE_PATH="/home/charles/vmtest" #Where your virtual machines live.
IMAGE_NAME="vmwareTest1" #What do you want your machine to be called.
IMAGE_PATH="$BASE_PATH/$IMAGE_NAME" #Used several places below for readability sake
DISK_SIZE="5000" #In kilobytes
PATH_TO_ISO="" #What iso will you be booting from. Leave blank for PXE boot.
VMDK_IMAGE="$IMAGE_PATH/$IMAGE_NAME.vmdk" #Your disk will live in this file.
#VMX_FILE=$IMAGE_PATH.vmx



#********************Don't modify anything below here unless you know what you are doing*************************#


source createVmFuncs.sh

#Start execution

#Do some error handling/checking
if [ ! -d $IMAGE_PATH ] ; then
createVmDir #Create the vm container
fi


if [ -f $IMAGE_PATH ] ; then
echo "Image already exists. Skipping creation."
else
createVmDisk #Create the disk image.
fi


#Creates the vmware configuration file.
createVmxFile


#Starts the virtual machine.
bootVm

bootVm()
{
echo "Booting vmware image...."
#vmware-cmd $VMX_FILE start
}

You can read his blog site or comment on his original post, here.

Published Monday, May 07, 2007 6:16 AM by David Marshall
Filed under:
Comments
There are no comments for this post.
To post a comment, you must be a registered user. Registration is free and easy! Sign up now!
Calendar
<May 2007>
SuMoTuWeThFrSa
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789