vmware_guest: "unsupported parameter for module: datacenter"

Hello folks,

I’m having difficulties using the vmware_guest module to create a guest vm on my VMware vCenter 6. My playbook looks as follows:

`

Create a new VM on an ESX server

  • hosts: localhost
    tasks:
  • vsphere_guest:
    hostname:
    username: ‘domain\user’
    password: “password”
    name: rhel-t4
    state: powerdon
    folder: JKA
    disk:
  • size_gb: 18
    type: thin
    datastore:
    nic:
  • type: vmxnet3
    network: VLAN30
    hardware:
    memory_mb: 2048
    num_cpus: 1
    osid: rhel64guest
    scsi: paravirtual
    datacenter: “HRZ-TEST4”
    esxi_hostname:
    template: RHEL72-EN

`

When running the playbook I get the following error:

`
ansible-playbook create_vm_on_vcenter.yml -C

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

TASK [setup] *******************************************************************
ok: [localhost]

TASK [vsphere_guest] ***********************************************************
fatal: [localhost]: FAILED! => {“changed”: false, “failed”: true, “msg”: “unsupported parameter for module: datacenter”}

NO MORE HOSTS LEFT *************************************************************
[WARNING]: Could not create retry file ‘create_vm_on_vcenter.retry’. [Errno 2] No such file or directory: ‘’

PLAY RECAP *********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1
`

The error message implies that the parameter “datacenter” is not supported by the module vmware_guest. But fromwhat is written in vmware_guest - Manages virtualmachines in vcenter this is a required parameter. Could some explain what’s wrong here, please?

Best regards,
Joerg

Hello folks,

I'm having difficulties using the vmware_guest module to create a guest vm
on my VMware vCenter 6. My playbook looks as follows:
# Create a new VM on an ESX server

- hosts: localhost
  tasks:
  - vsphere_guest:

[ snip ]

The error message implies that the parameter "datacenter" is not supported
by the module vmware_guest. But fromwhat is written in vmware_guest -
Manages virtualmachines in vcenter
<http://docs.ansible.com/ansible/vmware_guest_module.html&gt; this is a
required parameter. Could some explain what's wrong here, please?

vsphere_guest != vmware_guest

vsphere_guest doesn’t have datacenter
https://docs.ansible.com/ansible/vsphere_guest_module.html

vmware_guest is a new module in the upcoming 2.2 release.

Ah ok, I see I mixed that up. Thank you for your quick reply.