# Modifying vsphere\_guest

**URL:** <https://forum.ansible.com/t/modifying-vsphere-guest/18291>\
**Category:** Ansible Project\
**Tags:** vmware, ubuntu\
**Created:** [May 22, 2015, 9:50pm UTC](https://forum.ansible.com/t/modifying-vsphere-guest/18291 "2015-05-22T21:50:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tarun\_emany](https://avatars.discourse-cdn.com/v4/letter/t/439d5e/32.png) [@tarun\_emany](https://forum.ansible.com/u/tarun_emany)\
**Post date:** [May 22, 2015, 9:50pm UTC](https://forum.ansible.com/t/modifying-vsphere-guest/18291/1 "2015-05-22T21:50:45Z")

</div>

Hi all,

I am trying the reproduce the same as mentioned in

[https://github.com/romeotheriault/ansible-vsphere\_guest](https://github.com/romeotheriault/ansible-vsphere_guest)

Ansible module that allows you to define and create a VMWare vsphere guest OS instance which can then be booted to start an automated install.

I have created playbook file similarly.  
while executing it i am getting the following error.

tarun@ubuntu:~/playbooks$ ansible-playbook install\_VM\_test.yml -vvvv  
[WARNING]: provided hosts list is empty, only localhost is available

PLAY [127.0.0.1] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK: [vsphere\_guest] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<127.0.0.1\> REMOTE\_MODULE vsphere\_guest vcenter\_hostname=10.39.1.59 password=VALUE\_HIDDEN datastore=10\_39\_1\_59\_datastore1 esxi\_hostname=[esx-dev.hw-lab-pxe.inca.infoblox.com](http://esx-dev.hw-lab-pxe.inca.infoblox.com) user=root guestosid=ubuntu64Guest vm\_notes=test guest=newTestVM datacenter=ha-datacenter  
\<127.0.0.1\> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1432331320.78-272982991862969 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1432331320.78-272982991862969 && echo $HOME/.ansible/tmp/ansible-tmp-1432331320.78-272982991862969’]  
\<127.0.0.1\> PUT /tmp/tmp8bwjcs TO /home/tarun/.ansible/tmp/ansible-tmp-1432331320.78-272982991862969/vsphere\_guest  
\<127.0.0.1\> EXEC [‘/bin/sh’, ‘-c’, u’LANG=en\_US.UTF-8 LC\_CTYPE=en\_US.UTF-8 /usr/bin/python /home/tarun/.ansible/tmp/ansible-tmp-1432331320.78-272982991862969/vsphere\_guest; rm -rf /home/tarun/.ansible/tmp/ansible-tmp-1432331320.78-272982991862969/ \>/dev/null 2\>&1’]  
failed: [127.0.0.1] =\> {“failed”: true}  
**msg: unsupported parameter for module: power\_on**

FATAL: all hosts have already failed – aborting

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
to retry, use: --limit @/home/tarun/install\_VM\_test.retry

127.0.0.1 : ok=0 changed=0 unreachable=0 failed=1

I am using the same **vsphere\_guest** provided in above link…  
Should i include vsphere\_guest.py file in ansible module or configure it in plugins?

Please help me. I am new to ansible.

Thanks

---

<div class="post-metadata">

**Author:** ![mhael](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mhael](https://forum.ansible.com/u/mhael)\
**Post date:** [May 22, 2015, 10:15pm UTC](https://forum.ansible.com/t/modifying-vsphere-guest/18291/2 "2015-05-22T22:15:45Z")

</div>

Hi Tarun,

Please check the ‘state’ parameter for the module in your playbook - it should be powered\_on, not power\_on.

---

<div class="post-metadata">

**Author:** ![tarun\_emany](https://avatars.discourse-cdn.com/v4/letter/t/439d5e/32.png) [@tarun\_emany](https://forum.ansible.com/u/tarun_emany)\
**Post date:** [May 22, 2015, 10:24pm UTC](https://forum.ansible.com/t/modifying-vsphere-guest/18291/3 "2015-05-22T22:24:00Z")

</div>

No Mikhail, I am using those parameters in my vsphere\_guest module. I am trying to add new parameters like power\_on, vm\_cdrom etc and have done the changes needed in vsphere\_guest as shown in [https://github.com/romeotheriault/ansible-vsphere\_guest](https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fromeotheriault%2Fansible-vsphere_guest&sa=D&sntz=1&usg=AFQjCNGssPTqRlDoYHpT6c3aq5NqxqtwDg)

But while i am executing this playbook, ansible is not picking from my updated vsphere\_guest. I want to know how to add my new module to ansible( vsphere\_guest) so that i can achieve my goal.?

---

<div class="post-metadata">

**Author:** ![mhael](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mhael](https://forum.ansible.com/u/mhael)\
**Post date:** [May 22, 2015, 11:05pm UTC](https://forum.ansible.com/t/modifying-vsphere-guest/18291/4 "2015-05-22T23:05:38Z")

</div>

I would suggest to rename you custom module to distinguish it from the stock one. Let’s say the module name would be vsphere\_guest\_custom. Create ‘library’ subdir in the same directory where your playbooks reside and put vsphere\_guest\_custom.py there.

Then you can call it from playbook as

`  
vsphere\_guest\_custom:

`  
or

`  
local\_action:  
module\_name: vsphere\_guest\_custom  
:   
…

`

---

<div class="post-metadata">

**Author:** ![tarun\_emany](https://avatars.discourse-cdn.com/v4/letter/t/439d5e/32.png) [@tarun\_emany](https://forum.ansible.com/u/tarun_emany)\
**Post date:** [May 22, 2015, 11:35pm UTC](https://forum.ansible.com/t/modifying-vsphere-guest/18291/5 "2015-05-22T23:35:20Z")

</div>

That works…Thanks a lot. This group is helping me a lot.
