Skip to content

Instantly share code, notes, and snippets.

@pcn
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save pcn/9702299 to your computer and use it in GitHub Desktop.

Select an option

Save pcn/9702299 to your computer and use it in GitHub Desktop.
Installing vmware's viper (vmware api bindings for perl)
Installing vmware's viper api for perl on ubuntu 12.04
tar -xzf VMware-VIPerl-1.6.0-104313.x86_64.tar.gz
cd vmware-viperl-distrib/
sudo apt-get install libclass-methodmaker-perl
sudo apt-get install libcrypt-ssleay-perl
sudo apt-get install libsoap-lite-perl
sudo apt-get install libdata-uuid-libuuid-perl
sudo apt-get install zlib1g-dev
sudo apt-get install libxml2
sudo apt-get install libxml2-dev
sudo apt-get install libxml-libxml-perl
perl Makefile.PL
make
PERL5LIB=./lib apps/vm/vmtemplate.pl
This results in a complaint along these lines when running
"perl Makefile.PL":
Warning: prerequisite UUID 0.03 not found. We have 0.02.
But that hasn't bit me yet ?
Making an OVF into a template with OVFtool
(a.b == a vmware tools host)
(x.y == a vsphere server fronting the console)
(d.e == a vmware esx server that will host the template/image)
```
ovftool --name='PN-test-snd-template' \
--net:'Network 1'=LV-7150s-cl \
--datastore='data (6)' \
http://192.168.a.b/build/production-67-v1.0.0-pre-70f93cf-03-20-2014/exports/ova/SND-VM_OVF10.ova \
'vi://192.168.x.y/?ip=192.168.d.e'
env PERL_LWP_SSL_VERIFY_HOSTNAME=0 \
PERL5LIB=./lib \
apps/vm/vmtemplate.pl \
--server 192.168.x.y \
--operation T \
--vmname PN-test-snd-template
```
Now that it's built:
(m.n == the address for the new VM OS. Note the "/24" suffix seems wrong, since we're creating a /32, but it's correct)
```
knife vsphere vm clone pn-snd-test \
--chostname pn-snd-test \
--cdomain statelessnetworks.com \
--cips 192.168.m.n/24 --cgw 192.168.m.1/0 --cdnsips 192.168.m.1 \
--cram 2 --ccpu 2 \
--template PN-test-snd-template \
--ssh-user root --distro chef-full
```
Making a vm into a template with apps/vm/vmtemplate.pl:
jenkins@jenkins-foo:~/vmware-viperl-distrib$ env PERL_LWP_SSL_VERIFY_HOSTNAME=0 PERL5LIB=./lib apps/vm/vmtemplate.pl --server 192.168.x.y --operation T --vmname pn-veos
Enter username: root
Enter password:
The Virtual Machine 'pn-veos' under host 192.168.x.y is successfully marked as a template.
jenkins@jenkins-stateless:~/vmware-viperl-distrib$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment