nileshjais
Enthusiast
Enthusiast

Deploy a VM from template on linux and windows

Dear All,

I need to deploy VM from template, but i could not find any tool provided with vSphere SDK in Perl. If you have a script which does this task please share with me, any pointer will also help ...

Thanks,

Nilesh

0 Kudos
8 Replies
nielse
Expert
Expert

Do you want a Perl based script or PowerCLI? Or just anything that works?

@nielsengelen - http://foonet.be - VCP4/5
0 Kudos
nileshjais
Enthusiast
Enthusiast

Thank you for the response.

I would prefer Perl based. Also i am bit familiar with Perl ...

Message was edited by: nileshjais

0 Kudos
nileshjais
Enthusiast
Enthusiast

I tried to browse the discussion on this but i couldn't found any useful, please help me in this regards.

0 Kudos
nielse
Expert
Expert

I have some older code which should do the trick, it's available at https://github.com/nielsengelen/vmware-perl/blob/master/deploy-template.pl

@nielsengelen - http://foonet.be - VCP4/5
0 Kudos
nileshjais
Enthusiast
Enthusiast

Thanks Nielse,

You are life saver !! let me try this script and will update you accordingly. One more question, Will it configure ip address, subnet mask and network related configuration?

Thanks again.

Nilesh

0 Kudos
nielse
Expert
Expert

This script is a basic deploy, nothing more. If you want to do configure the IP and stuff you'll have to use a customization template or a bash script which does it for you after boot. You can then call this bash script using "startprograminguest".

@nielsengelen - http://foonet.be - VCP4/5
0 Kudos
nileshjais
Enthusiast
Enthusiast

Wow !! I feel confident to proceed now, Will startprograminguest is an api of vSphere SDK, do we have any sample usage of this of reference script.

0 Kudos
nileshjais
Enthusiast
Enthusiast

This script works fine thank you again, But due to some restricted access to one of datacenter for my user, on which i am trying to deploy VM, i could not proceed and i am getting error message. just to let you know if we use this script with administrator user it works smoothly.

Fault string: Permission to perform this operation was denied.

Fault detail: NoPermissionFault


What if i need to added identification of specific datacenter using --datacenter argument in this script will i need to perform some extra step before i proceed with $_->CloneVM, could you please tell me what changes is needed. That would really help me.


0 Kudos