VMware {code} Community
pat_casey
Contributor
Contributor

Deploying and customizing template from the CLI

Apologies if this is obvious to folks who are more familiar with this API, but I've been beating my head against the wall for two days here trying to make this work, without success. So I suspect I'm missing something basic.

I have a template VM (redhat 5), all set up to go on ESX 3.5.

From virtual center, I can deploy from this template and get the opportunity to customize the vm as part of the deployment process. Specifically, I can set network and hostname settings. This works fine.

I need to be able to do the same thing from the CLI within my ESX server.

My naive approach was something along the lines of:

Step 1) Write out a correctly configured .vmx file

Step 2) Clone my template disk vmkfstools -i /vmfs/volumes/storage2/templates/small.vmdk ./a.vmdk

Step 3) Bring up the new vm.

VM comes up fine, only problem is it's still the original VM and hence its network collides with the rest of my network (since IP in use) and that's all she wrote.

Seems like I'm missing a step between 2 and 3 where I should be able to configure the VM and set its network settings, but I am utterly lost on how to do this.

Is there a way to do this from the CLI using bash script and some combination of vmware-cmd and vmkfstools commands?

Or, alternately, if perl is the only option, does anybody have any sample code they could share?

I'm a fairly good shell scripter, but I have a mental block when it

comes to perl, so if there's a way to do it w/o perls I'd definately

prefer to go that route.

Totally stumped ... but I know this is doable!

0 Kudos
0 Replies