Ansible + vpshere_guest

Hello all,

I’m starting with Ansible, and I would like to provsion a VMWare Cluster with it.
To do that, I use the vsphere-guest module. However, I try to use it!

So I create a role /etc/ansible/role/esx/task/main.yml and try to set up a VM.
I follow the the official documentetion: http://docs.ansible.com/vsphere_guest_module.html

But when I try to run my playbook, it doesn’t work.
I’ve this error:

ansible-playbook -i /etc/ansible/hosts /etc/ansible/base.yml -C
GATHERING FACTS ***************************************************************
failed: [ip_of_esx] => {“failed”: true, “parsed”: false}
Traceback (most recent call last):
File “//.ansible/tmp/ansible-tmp-1418582864.23-99769666634275/setup”, line 204, in
import grp
ImportError: No module named grp

And I don’t find anything about this error, and I don’t know how to solve it…

pysphere in lastest version is install (easy_install -U pysphere)
I try this command: ansible esx -m raw -a “date”
It works fine.

Somebody already try this module? Maybe I don’t use it well…

Thanks a lot.

  • hosts: vmware
    gather_facts: false
    tasks:
  • raw: uname -a
  • vsphere_guest:
    vcenter_hostname: “{{ ansible_ssh_host|default(inventory_hostname) }}”
    username: “{{ hostvars[inventory_hostname].ansible_ssh_user|quote }}”
    password: “{{ hostvars[inventory_hostname].ansible_ssh_pass|quote }}”
    guest: “My Guest”
    vmware_guest_facts: yes