Getting error in deploying VMs using Ansible vsphere_guest module

I am getting below error while using Ansible (version 1.8.2) vSphere_guest module,

osboxes@osboxes:~$ ansible-playbook /etc/ansible/playbooks/main.yml -K
sudo password:

PLAY [localhost] **************************************************************

TASK: [vsphere_guest ] ********************************************************
failed: [localhost] => {“failed”: true, “parsed”: false}
SUDO-SUCCESS-ldmjglnajxpocoybboumisekhbbnmhnp
Traceback (most recent call last):
File “/home/osboxes/.ansible/tmp/ansible-tmp-1423728228.54-220175308723408/vsphere_guest”, line 2791, in
main()
File “/home/osboxes/.ansible/tmp/ansible-tmp-1423728228.54-220175308723408/vsphere_guest”, line 1197, in main
config_check(“vm_disk”, vm_disk, proto_vm_disk, module)
File “/home/osboxes/.ansible/tmp/ansible-tmp-1423728228.54-220175308723408/vsphere_guest”, line 1012, in config_check
if diff.recursive_diff():
File “/home/osboxes/.ansible/tmp/ansible-tmp-1423728228.54-220175308723408/vsphere_guest”, line 983, in recursive_diff
if k in self.check_dict[key]:
TypeError: argument of type ‘NoneType’ is not iterable

FATAL: all hosts have already failed – aborting

PLAY RECAP ********************************************************************
to retry, use: --limit @/home/osboxes/main.retry

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

Did anybody face this issue before? It may be, I am doing some silly mistake but unable to catch that.

Thanks

Can you post the vsphere_guest task that’s failing? I can’t pick it exactly from that error but we use it a fair bit so can at least have a gander for any of the things we tripped up on while figuring it out.

Cheers,
Daniel

Please share the task definition (without confidential data).

Giovanni

Hi,

Below is yml am using,

I think you need to fix the indentation:

       vm_disk:
         disk1:
          size_gb: 1
          type: thin
          datastore: compute

http://yaml.org/spec/current.html#id2519916

Giovanni

You might be getting bitten by something I fixed in December…

https://github.com/ansible/ansible-modules-core/pull/562

Does it do the same if you use the devel branch?

Thank you Giovanni!! That solved the problem.

-Nitin

Thanks Mark, Daniel. That was the yml issue.