# vApp role/module

**URL:** <https://forum.ansible.com/t/vapp-role-module/17521>\
**Category:** Ansible Project\
**Created:** [February 16, 2015, 7:51am UTC](https://forum.ansible.com/t/vapp-role-module/17521 "2015-02-16T07:51:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vaclav\_Adamec](https://avatars.discourse-cdn.com/v4/letter/v/a6a055/32.png) [@Vaclav\_Adamec](https://forum.ansible.com/u/Vaclav_Adamec)\
**Post date:** [February 16, 2015, 7:51am UTC](https://forum.ansible.com/t/vapp-role-module/17521/1 "2015-02-16T07:51:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Vaclav\_Adamec](https://avatars.discourse-cdn.com/v4/letter/v/a6a055/32.png) [@Vaclav\_Adamec](https://forum.ansible.com/u/Vaclav_Adamec)\
**Post date:** [February 16, 2015, 8:01am UTC](https://forum.ansible.com/t/vapp-role-module/17521/2 "2015-02-16T08:01:06Z")

</div>

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):

---

<div class="post-metadata">

**Author:** ![Vaclav\_Adamec](https://avatars.discourse-cdn.com/v4/letter/v/a6a055/32.png) [@Vaclav\_Adamec](https://forum.ansible.com/u/Vaclav_Adamec)\
**Post date:** [February 21, 2015, 5:01am UTC](https://forum.ansible.com/t/vapp-role-module/17521/3 "2015-02-21T05:01:22Z")

</div>

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](https://gist.github.com/VAdamec/95bb855330a00dff325a)

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 21, 2015, 2:49pm UTC](https://forum.ansible.com/t/vapp-role-module/17521/4 "2015-02-21T14:49:18Z")

</div>

Can you open an issue on github as a feature request?

---

<div class="post-metadata">

**Author:** ![Vaclav\_Adamec](https://avatars.discourse-cdn.com/v4/letter/v/a6a055/32.png) [@Vaclav\_Adamec](https://forum.ansible.com/u/Vaclav_Adamec)\
**Post date:** [February 22, 2015, 12:59pm UTC](https://forum.ansible.com/t/vapp-role-module/17521/5 "2015-02-22T12:59:03Z")

</div>

Hi,  
already done, but I was not sure if it’s not my problem with playbook setup

Vasek
