vApp role/module

102 views
Skip to first unread message

Vaclav Adamec

unread,
Feb 16, 2015, 2:51:22 AM2/16/15
to ansible...@googlegroups.com
Hi,
 did anybody try vsphere vApp setup? (there is a support for it in pysphere) It will be quite nice to have possibility to deploy from cloning/creating to setup IP and start up fully functional VM (some internal init script which will grab set vApp and change networking)

Vasek

Vaclav Adamec

unread,
Feb 16, 2015, 3:01:06 AM2/16/15
to ansible...@googlegroups.com
Just for example:

Setup script (from params/cmdb/...):
    # Replace vApp properties
    vapp = set_vapp_property(vapp, 'hostname', data[item]['hostname'])
    vapp = set_vapp_property(vapp, 'eth0_IP', data[item]['ipv4'])
    vapp = set_vapp_property(vapp, 'eth0_mask', data[item]['ipv4_netmask'])
    vapp = set_vapp_property(vapp, 'eth0_gw', data[item]['ipv4_gateway'])

Server init script (run once at start, after boot ansible/puppet/... can take control):

        GET_VAPP=`vmtoolsd --cmd "info-get guestinfo.ovfEnv"`

        VAPP_HOSTNAME=`echo "$GET_VAPP" | grep '<Property oe:key="hostname"' | cut -d '"' -f 4`
        VAPP_DOMAIN=`echo "$GET_VAPP" | grep '<Property oe:key="domain"' | cut -d '"' -f 4`
        VAPP_ETH0_IP=`echo "$GET_VAPP" | grep '<Property oe:key="eth0_IP"' | cut -d '"' -f 4`
        VAPP_ETH0_MASK=`echo "$GET_VAPP" | grep '<Property oe:key="eth0_mask"' | cut -d '"' -f 4`
        VAPP_ETH0_GW=`echo "$GET_VAPP" | grep '<Property oe:key="eth0_gw"' | cut -d '"' -f 4`


Dne pondělí 16. února 2015 8:51:22 UTC+1 Vaclav Adamec napsal(a):

Vaclav Adamec

unread,
Feb 21, 2015, 12:01:22 AM2/21/15
to ansible...@googlegroups.com
So far whats working for me:
1. Clone VM
2. Set vAPP parameters
3. Boot machine with connection to network

and now issues:
1. Clone automatically start up VM (clone and power state are mutually exclusive)
2. How to use reconfigure state ?
2a. VLAN change (reconfigure state) it's not working
2b. Adding notes to VM not working (jenkins build number, date, ...)
2c. All parameters need to be set, even If you need to change one

https://gist.github.com/VAdamec/95bb855330a00dff325a

Brian Coca

unread,
Feb 21, 2015, 9:49:18 AM2/21/15
to ansible...@googlegroups.com
Can you open an issue on github as a feature request?

Vaclav Adamec

unread,
Feb 22, 2015, 7:59:03 AM2/22/15
to ansible...@googlegroups.com
Hi,
 already done, but I was not sure if it's not my problem with playbook setup

Vasek

Reply all
Reply to author
Forward
0 new messages