Hi to all,
Is possible deply a template via command line and set hostname and network?
Thanks for your help
PS: Remember donate for ghetto script repository
Are you trying to create a template from an existing VM using the CLI or cloning a VM from a template?
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP4-DCA
VMware scripts and resources at:
Getting Started with the vMA (tips/tricks)
Getting Started with the vSphere SDK for Perl
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Are you trying to create a template from an existing VM using the CLI or cloning a VM from a template?
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP4-DCA
VMware scripts and resources at:
Getting Started with the vMA (tips/tricks)
Getting Started with the vSphere SDK for Perl
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Hi,
in particular from a template,
but you may need even starting from an existing VM.
Thanks for your support.
You are my guru.
Well in either case, you'll be using the CloneVM_Task method whether you're deploying from a template or from an existing VM. If you take a look a the vSphere SDK for Perl Utility vmclone.pl, you can see how the cloning process is implemented. This should get you started
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP4-DCA
VMware scripts and resources at:
Getting Started with the vMA (tips/tricks)
Getting Started with the vSphere SDK for Perl
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Thanks,
good for me.
i see the vm_clone.xml file , but there isn't the conf for ip, gateway etc. etc.
This process for me should be run in the night, but after boot via ssh for me is possible change network conf, correct?
Making a clone and customizing the VM
perl vmclone.pl --username myusername --password mypassword --operation clone --vmhost 192.168.111.2 --vmname DVM1 --vmname_destination Clone_VM --url https://192.168.111.52/sdk/vimService --customize_vm yes --filename clone_vm.xml --schema clone_schema.xsd
All the parameters which are to customized are writtend in the xml file in
this format:
<?xml version="1.0"?> <specification> <configspec> <vmname>T0I</vmname> <vmhost>192.168.111.2</vmhost> <datacenter>Dracula</datacenter> <guestid>winXPProGuest</guestid> <datastore>storage1</datastore> <disksize>5096</disksize> <memory>256</memory> <num_cpus>2</num_cpus> <nic_network>VM Network</nic_network> <nic_poweron>1</nic_poweron> </configspec> </specification>
Making a clone and customizing the guestOS::
perl vmclone.pl --username myuser --password mypassword --operation clone --vmhost 192.168.111.2 --vmname DVM1 --vmname_destination DVM99 --url https://192.168.111.52/sdk/vimService --customize_guest yes --filename clone_vm.xml --schema clone_schema.xsd
All the parameters which are to customized are writtend in the xml file in
this format:
<?xml version="1.0"?> <specification> <customizationspec> <autologon>1</autologon> <computername>VM9</computername> <timezone>033</timezone> <domain_user_name>username</domain_user_name> <domain_user_password>password</domain_user_password> <domain>InterraIT.info</domain> <fullname>admin</fullname> <orgname>Interrait</orgname> </customizationspec> </specification>
You may also want to take a look at this customized version of vmclone.pl called vmclone2.pl -
Yes, you can change things like IP Address and Gateway, that is all part of the customization spec and depending if you're customizing a Windows or Linux guest, you may have more or less options. Take a look at the vSphere SDK for Perl Utility documentation for more information and the customization XML files. Remember this is just a canned version of implementing the CloneVM_Task() and CustomizeVM_Task(), for more control, you may want to write your own script utilizing these methods, else you will be limited with the default script which may or may not work for you.
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP4-DCA
VMware scripts and resources at:
Getting Started with the vMA (tips/tricks)
Getting Started with the vSphere SDK for Perl
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Hi William,
thanks for your support.
Now I will try to vmclone2.pl, because now I can not understand
how to call interact with
Do you think that in future there will be a script that will allow this?
Thanks again and congratulations for your work.
Not exactly sure I understand what you're saying.
If you want to clone a VM from either an existing VM image that is either running or off OR from VM template, you will need to utilize the CloneVM_Task(). Both of the canned VMware scripts vmclone.pl utilizes this API method underneath and the script is just an example of a workflow in which you provide some basic information to create a cloned VM. If you need to provide more details or want to further customize it to fit your process, you're better off writing your own script, but you will still be using the same method.
If you're asking if VMware will provide a script in the future to clone from a template, I probably would not hold my breathe.
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3,4
VMware VCAP4-DCA
VMware scripts and resources at:
Getting Started with the vMA (tips/tricks)
Getting Started with the vSphere SDK for Perl
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Hi William,
your info are always very detailed and decisive.
Thanks to my "GURU"
I'm new to the forum, and VMware.
Where are the vmclone*.pl files? I downloaded and installed the vshpere cli tool and I don't see them there.
Hi .
I am looking for a simple script which create a template from a VM on regular basis and The OLD template should be get deleted.
Can some one please help..
Thanks
Rayala
Hey Folks,
I have a template that has a serial interface. Part of the template vmx file looks like below,
serial0.fileType = "network"
serial0.fileName = "telnet://xxx.xxx.xxx.xxx:63001"
serial0.yieldOnMsrRead = "TRUE"
serial0.present = "TRUE"
I would like to clone VMs using this template but every new clone should use a new port in the serial0.filename. I went through most of the documentation, but did not see if this can be done through the customization. Does the perl sdk (vmclone.pl) allows this?
Thanks in advance.