# cannot run an ansible playbook with vsphere\_guest support

**URL:** <https://forum.ansible.com/t/cannot-run-an-ansible-playbook-with-vsphere-guest-support/15133>\
**Category:** Ansible Project\
**Created:** [May 1, 2014, 5:06pm UTC](https://forum.ansible.com/t/cannot-run-an-ansible-playbook-with-vsphere-guest-support/15133 "2014-05-01T17:06:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Shen](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@John\_Shen](https://forum.ansible.com/u/John_Shen)\
**Post date:** [May 1, 2014, 5:06pm UTC](https://forum.ansible.com/t/cannot-run-an-ansible-playbook-with-vsphere-guest-support/15133/1 "2014-05-01T17:06:10Z")

</div>

$ ansible-playbook vmtest.yml  
ERROR: vsphere\_guest is not a legal parameter in an Ansible Playbook  
$ ansible --version  
ansible 1.6 (devel c0f92317ef) last updated 2014/05/01 10:56:27 (GMT -600)

i used the first example here with only auth and vcenter info changed. thanks for any help!

[http://docs.ansible.com/vsphere\_guest\_module.html](http://docs.ansible.com/vsphere_guest_module.html)

$ cat vmtest.yml

```auto
# Create a new VM on an ESX server
# Returns changed = False when the VM already exists
# Returns changed = True and a adds ansible_facts from the new VM
# State will set the power status of a guest upon creation. Use powered_on to create and boot.
# Options ['state', 'vm_extra_config', 'vm_disk', 'vm_nic', 'vm_hardware', 'esxi'] are required together

- vsphere_guest:
    vcenter_hostname: myvcenter

```

```auto
.

```

```auto
.

```

```auto
.

```

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [May 1, 2014, 5:14pm UTC](https://forum.ansible.com/t/cannot-run-an-ansible-playbook-with-vsphere-guest-support/15133/2 "2014-05-01T17:14:30Z")

</div>

If you do the following, does it work as expected?

- name: test vsphere  
vsphere\_guest:  
…

If not, it would seem that you’ve got some issue with your module path.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [May 1, 2014, 9:27pm UTC](https://forum.ansible.com/t/cannot-run-an-ansible-playbook-with-vsphere-guest-support/15133/3 "2014-05-01T21:27:47Z")

</div>

You are writing a list of tasks so can’t just run the task file directly.

- hosts: localhost  
tasks:
- include: your\_other\_file.yml
- shell: task goes here

ETC

So it thinks you are defining a play, not a list of tasks, and needs vsphere\_guest at task level.

---

<div class="post-metadata">

**Author:** ![Prashant\_Shelke](https://avatars.discourse-cdn.com/v4/letter/p/3e96dc/32.png) [@Prashant\_Shelke](https://forum.ansible.com/u/Prashant_Shelke)\
**Post date:** [June 24, 2015, 2:03pm UTC](https://forum.ansible.com/t/cannot-run-an-ansible-playbook-with-vsphere-guest-support/15133/4 "2015-06-24T14:03:31Z")

</div>

Hi,

Did you get the resolution to the problem? I am also facing similar issue.

Thanks,  
Prashant

---

<div class="post-metadata">

**Author:** ![ecoutin\_boingo](https://avatars.discourse-cdn.com/v4/letter/e/ac91a4/32.png) [@ecoutin\_boingo](https://forum.ansible.com/u/ecoutin_boingo)\
**Post date:** [July 17, 2015, 8:51pm UTC](https://forum.ansible.com/t/cannot-run-an-ansible-playbook-with-vsphere-guest-support/15133/5 "2015-07-17T20:51:34Z")

</div>

The solution is to index the vsphere\_guest module call under tasks, as Michael Dehaan posted, like this:

- hosts: localhost  
tasks:
- vsphere\_guest:  
vcenter\_hostname: myvcenter

---

<div class="post-metadata">

**Author:** ![Billy\_B](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@Billy\_B](https://forum.ansible.com/u/Billy_B)\
**Post date:** [April 20, 2017, 9:10pm UTC](https://forum.ansible.com/t/cannot-run-an-ansible-playbook-with-vsphere-guest-support/15133/6 "2017-04-20T21:10:35Z")

</div>

Hi,

I am having the same problem.

How can I check my module path please?

thanks
