# Seeking Guidance with the vmware\_guest Module

**URL:** <https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662>\
**Category:** Get Help\
**Tags:** windows, vmware\
**Created:** [April 10, 2025, 6:05pm UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662 "2025-04-10T18:05:55Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![vuser](https://avatars.discourse-cdn.com/v4/letter/v/41988e/32.png) [@vuser](https://forum.ansible.com/u/vuser)\
**Post date:** [April 10, 2025, 6:05pm UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/1 "2025-04-10T18:05:56Z")

</div>

Ive only resently started using Ansible (about 3 weeks). Ive gotten the hang of the basics; however, im having some challanges with deploying a VM and getting it to domain join. The error seems to reference domain\_ou which im specifying and the OU does exist. The account im using is a domain admin as well.

If i remove all the domain join related stuff the VM deploys without issue. I suspect that it may be formating? Ive searched just about every where and tried different methods but same results.

Here is the playbook:

```auto
---
- name: Create a new VM from a template
  hosts: localhost
  gather_facts: false
  tasks:
    - name: Deploy VM from template "{{ vm_template }}"
      community.vmware.vmware_guest:
        hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_username }}"
        password: "{{ vcenter_password }}"
        validate_certs: false
        name: "{{ vm_hostname }}"
        template: "{{ vm_template }}"
        datacenter: "{{ vcenter_datacenter }}"
        cluster: "{{ vm_dest }}"
        datastore: "{{ vm_datastore }}"
        convert: thin
        folder: "{{ vm_folder }}"
        annotation: "{{ vm_notes }} "
        state: "{{ vm_pstate }}"
        networks:
          - name: "{{ vm_network }}"
            connected: true
            start_connected: yes
            device_type: vmxnet3
            ip: "{{ vm_address }}"
            netmask: "{{ vm_netmask }}"
            gateway: "{{ vm_gateway }}"
            dns_suffix: myplayground.com
            domain: myplayground.com
            dns_servers:
              - "{{ dns_server1 }}"
              - "{{ dns_server2 }}"
            wait_for_ip_address: true
        customization:
          autologon: true
          autologoncount: 1
          fullname: LocalAdmin
          hostname: "{{ vm_hostname }}"
          domain: myplayground.com
          joindomain: myplayground.com
          domain_ou: "OU=AnsibleTest,OU=TargetOU,OU=TO,OU=PATH,DC=MYPLAYGROUND,DC=COM"
          domainadmin: "{{ domain_admin }}"
          domainadminpassword: "{{ domain_adminpass }}"
          orgname: AnsibLab
          password: "{{ vcenter_password }}"
          productid: 'NPPR9-FWDCX-D2C8J-H872K-2YT43'
          timezone: '004'
        wait_for_customization: true

```

I get this error when attempting to domain join:

{  
“module\_stdout”: “”,  
“module\_stderr”: “Traceback (most recent call last):\n File "/usr/local/lib/python3.11/site-packages/pyVmomi/VmomiSupport.py", line 463, in GetPropertyInfo\n while name not in type.\_propInfo:\n ^^^^^^^^^^^^^^\nAttributeError: type object ‘object’ has no attribute ‘\_propInfo’\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "/home/runner/.ansible/tmp/ansible-tmp-1744309730.6326966-25-43156245065951/AnsiballZ\_vmware\_guest.py", line 107, in \n \_ansiballz\_main()\n File "/home/runner/.ansible/tmp/ansible-tmp-1744309730.6326966-25-43156245065951/AnsiballZ\_vmware\_guest.py", line 99, in \_ansiballz\_main\n invoke\_module(zipped\_mod, temp\_path, ANSIBALLZ\_PARAMS)\n File "/home/runner/.ansible/tmp/ansible-tmp-1744309730.6326966-25-43156245065951/AnsiballZ\_vmware\_guest.py", line 47, in invoke\_module\n runpy.run\_module(mod\_name=‘ansible\_collections.community.vmware.plugins.modules.vmware\_guest’, init\_globals=dict(\_module\_fqn=‘ansible\_collections.community.vmware.plugins.modules.vmware\_guest’, \_modlib\_path=modlib\_path),\n File "", line 226, in run\_module\n File "", line 98, in \_run\_module\_code\n File "", line 88, in \_run\_code\n File "/tmp/ansible\_community.vmware.vmware\_guest\_payload\_79q0j9el/ansible\_community.vmware.vmware\_guest\_payload.zip/ansible\_collections/community/vmware/plugins/modules/vmware\_guest.py", line 3682, in \n File "/tmp/ansible\_community.vmware.vmware\_guest\_payload\_79q0j9el/ansible\_community.vmware.vmware\_guest\_payload.zip/ansible\_collections/community/vmware/plugins/modules/vmware\_guest.py", line 3671, in main\n File "/tmp/ansible\_community.vmware.vmware\_guest\_payload\_79q0j9el/ansible\_community.vmware.vmware\_guest\_payload.zip/ansible\_collections/community/vmware/plugins/modules/vmware\_guest.py", line 3052, in deploy\_vm\n File "/tmp/ansible\_community.vmware.vmware\_guest\_payload\_79q0j9el/ansible\_community.vmware.vmware\_guest\_payload.zip/ansible\_collections/community/vmware/plugins/modules/vmware\_guest.py", line 2380, in customize\_vm\n File "/usr/local/lib/python3.11/site-packages/pyVmomi/VmomiSupport.py", line 663, in **setattr** \n CheckField(self.\_GetPropertyInfo(name), val)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/usr/local/lib/python3.11/site-packages/pyVmomi/VmomiSupport.py", line 468, in GetPropertyInfo\n raise AttributeError(name)\nAttributeError: domainOU\n”,  
“exception”: “Traceback (most recent call last):\n File "/usr/local/lib/python3.11/site-packages/pyVmomi/VmomiSupport.py", line 463, in GetPropertyInfo\n while name not in type.\_propInfo:\n ^^^^^^^^^^^^^^\nAttributeError: type object ‘object’ has no attribute ‘\_propInfo’\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "/home/runner/.ansible/tmp/ansible-tmp-1744309730.6326966-25-43156245065951/AnsiballZ\_vmware\_guest.py", line 107, in \n \_ansiballz\_main()\n File "/home/runner/.ansible/tmp/ansible-tmp-1744309730.6326966-25-43156245065951/AnsiballZ\_vmware\_guest.py", line 99, in \_ansiballz\_main\n invoke\_module(zipped\_mod, temp\_path, ANSIBALLZ\_PARAMS)\n File "/home/runner/.ansible/tmp/ansible-tmp-1744309730.6326966-25-43156245065951/AnsiballZ\_vmware\_guest.py", line 47, in invoke\_module\n runpy.run\_module(mod\_name=‘ansible\_collections.community.vmware.plugins.modules.vmware\_guest’, init\_globals=dict(\_module\_fqn=‘ansible\_collections.community.vmware.plugins.modules.vmware\_guest’, \_modlib\_path=modlib\_path),\n File "", line 226, in run\_module\n File "", line 98, in \_run\_module\_code\n File "", line 88, in \_run\_code\n File "/tmp/ansible\_community.vmware.vmware\_guest\_payload\_79q0j9el/ansible\_community.vmware.vmware\_guest\_payload.zip/ansible\_collections/community/vmware/plugins/modules/vmware\_guest.py", line 3682, in \n File "/tmp/ansible\_community.vmware.vmware\_guest\_payload\_79q0j9el/ansible\_community.vmware.vmware\_guest\_payload.zip/ansible\_collections/community/vmware/plugins/modules/vmware\_guest.py", line 3671, in main\n File "/tmp/ansible\_community.vmware.vmware\_guest\_payload\_79q0j9el/ansible\_community.vmware.vmware\_guest\_payload.zip/ansible\_collections/community/vmware/plugins/modules/vmware\_guest.py", line 3052, in deploy\_vm\n File "/tmp/ansible\_community.vmware.vmware\_guest\_payload\_79q0j9el/ansible\_community.vmware.vmware\_guest\_payload.zip/ansible\_collections/community/vmware/plugins/modules/vmware\_guest.py", line 2380, in customize\_vm\n File "/usr/local/lib/python3.11/site-packages/pyVmomi/VmomiSupport.py", line 663, in **setattr** \n CheckField(self.\_GetPropertyInfo(name), val)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/usr/local/lib/python3.11/site-packages/pyVmomi/VmomiSupport.py", line 468, in GetPropertyInfo\n raise AttributeError(name)\nAttributeError: domainOU\n”,  
“msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”,  
“rc”: 1,  
“\_ansible\_no\_log”: false,  
“changed”: false,  
“\_ansible\_delegated\_vars”: {  
“ansible\_host”: “localhost”,  
“ansible\_port”: null,  
“ansible\_user”: “root”,  
“ansible\_connection”: “local”  
}  
}

---

<div class="post-metadata">

**Author:** ![dld](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dld/32/8086_2.png) [@dld](https://forum.ansible.com/u/dld)\
**Post date:** [April 10, 2025, 6:50pm UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/2 "2025-04-10T18:50:08Z")

</div>

Here is what Grok thinks about it…

````auto
# Fixing the Ansible Playbook Error for VMware VM Domain Join

The error you're encountering in your Ansible playbook is related to the `customization` section of the `vmware_guest` module, specifically with the `domain_ou` parameter. The traceback indicates an `AttributeError: domainOU`, which suggests that the `domain_ou` parameter is not recognized by the underlying VMware API or the Ansible module.

## Root Cause

The `vmware_guest` module relies on the `pyVmomi` library to interact with VMware vSphere. The error occurs because `domain_ou` (or its camelCase variant `domainOU`) is not a valid property in the `CustomizationSpec` object used by `pyVmomi` for VM customization. The correct parameter to specify an Organizational Unit (OU) for domain joining is `ou`, not `domain_ou`.

## Fix

Update the `customization` section in your playbook to use `ou` instead of `domain_ou`. Below is the corrected portion of your playbook:

```yaml
customization:
  autologon: true
  autologoncount: 1
  fullname: LocalAdmin
  hostname: "{{ vm_hostname }}"
  domain: myplayground.com
  joindomain: myplayground.com
  ou: "OU=AnsibleTest,OU=TargetOU,OU=TO,OU=PATH,DC=MYPLAYGROUND,DC=COM" # Changed from domain_ou to ou
  domainadmin: "{{ domain_admin }}"
  domainadminpassword: "{{ domain_adminpass }}"
  orgname: AnsibLab
  password: "{{ vcenter_password }}"
  productid: 'NPPR9-FWDCX-D2C8J-H872K-2YT43'
  timezone: '004'

````

Explanation  
The ou parameter specifies the Organizational Unit in the Active Directory where the VM’s computer account will be placed after joining the domain.

The domain\_ou parameter you used does not exist in the vmware\_guest module’s customization spec, which is why the error occurs when pyVmomi tries to set this attribute.

Additional Notes  
Validate Variables: Ensure all variables (e.g., domain\_admin, domain\_adminpass, vm\_hostname, etc.) are defined in your inventory, group vars, or passed via -e in the Ansible command. Undefined variables can cause other failures.

Credentials: Double-check that domainadmin and domainadminpassword have sufficient privileges to join the VM to the domain and place it in the specified OU.

Network Configuration: Ensure the dns\_servers, vm\_address, vm\_netmask, and vm\_gateway are correctly configured, as domain joining requires proper DNS resolution.

Debugging: If the issue persists, run the playbook with verbose output (ansible-playbook -vvv) to get more detailed logs.

Testing the Fix  
After making the change, rerun the playbook with the following command:  
bash

ansible-playbook your\_playbook.yml -vvv

If the VM deploys and joins the domain successfully, the task should complete without the AttributeError.

---

<div class="post-metadata">

**Author:** ![vuser](https://avatars.discourse-cdn.com/v4/letter/v/41988e/32.png) [@vuser](https://forum.ansible.com/u/vuser)\
**Post date:** [April 10, 2025, 7:18pm UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/3 "2025-04-10T19:18:41Z")

</div>

This does not work unfortunately. The supported parameter per the documentation is domain\_ou. If i do switch to ou: then the playbook immediately fails due to that parameter.

This is where im stuck. The documentation stated to enter the value as “LDAP Path” which ive done…but doesnt work. I then switched to DN as shown in active directory and it doesnt work. Both return an error that is similar to what I included in the post.

Oh I also want to add that I omitted the domain\_ou parameter and get the same error, even though the docummentation states that its not required.

---

<div class="post-metadata">

**Author:** ![bvitnik](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bvitnik/32/4132_2.png) [@bvitnik](https://forum.ansible.com/u/bvitnik)\
**Post date:** [April 11, 2025, 12:08am UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/4 "2025-04-11T00:08:30Z")

</div>

Does it work if you remove the “customization” block? In other words, can you successfully deploy a plain VM from template, without any customization?

It’s a little bit hard to decipher your error message because it was not pasted in original form and in code block so it’s messed up. Anyway, this looks like a bug. Some incompatibility between Python/pyvmomi and vCenter API perhaps.

What version of Ansible, pyvmomi, community.vmware collection and VMware vCenter are you using?

I had some weird issues with vCenter 8.0.3 compared to 8.0.2.

---

<div class="post-metadata">

**Author:** ![mariolenz](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mariolenz/32/108_2.png) [@mariolenz](https://forum.ansible.com/u/mariolenz)\
**Post date:** [April 11, 2025, 2:36pm UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/5 "2025-04-11T14:36:44Z")

</div>

What pyVmomi version are you using?

_edit_:  
`"/usr/local/lib/python3.11/site-packages/pyVmomi/VmomiSupport.py", line 468, in GetPropertyInfo\n raise AttributeError(name)\nAttributeError: domainOU` looks like pyVmomi doesn’t know this attribute. Since the documentation says domain\_ou works for vSphere 8.0U2 and above, I guess you probably also need [pyvmomi 8.0.2.0](https://pypi.org/project/pyvmomi/#history) or later.

And just to make this clear: You _are_ running vSphere 8.0U2+?

For the record: This has been implemented [here](https://github.com/ansible-collections/community.vmware/pull/2276).

---

<div class="post-metadata">

**Author:** ![vuser](https://avatars.discourse-cdn.com/v4/letter/v/41988e/32.png) [@vuser](https://forum.ansible.com/u/vuser)\
**Post date:** [April 11, 2025, 3:29pm UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/6 "2025-04-11T15:29:58Z")

</div>

If i remove the `joindomain` parameter I am able to deploy the VM successfully without issue, and I am able to include any others well. If I omit the `domain_ou` and just include the `joindomain` i still get the same error.

I am running vCenter 8u3d and the ESXi is also 8u3d. The VM version is 21 and vmtools on the template is also on the latest, 12.5.1

I am running a trial of Ansible Automation Platform 2.5 and im running from there using the prebuilt execution environments so ill have to check. I do believe it had ansible core 2.14.17 but i could be mistaken. Thank you for the reply!

---

<div class="post-metadata">

**Author:** ![mariolenz](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mariolenz/32/108_2.png) [@mariolenz](https://forum.ansible.com/u/mariolenz)\
**Post date:** [April 11, 2025, 3:36pm UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/7 "2025-04-11T15:36:35Z")

</div>

I think we don’t support ansible-core \< 2.17. But I don’t think that’s the problem here.

ATM it looks like a (too) old pyvmomi version to me. Although this is just an educated guess.

---

<div class="post-metadata">

**Author:** ![vuser](https://avatars.discourse-cdn.com/v4/letter/v/41988e/32.png) [@vuser](https://forum.ansible.com/u/vuser)\
**Post date:** [April 11, 2025, 3:36pm UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/8 "2025-04-11T15:36:54Z")

</div>

Thank you for the reply! It sounds like my issue may possible be with the pyvmomi version then. I am running the latest version and build on vSphere. The vcsa is at 8u3d and the esxi is also 8u3d.

---

<div class="post-metadata">

**Author:** ![vuser](https://avatars.discourse-cdn.com/v4/letter/v/41988e/32.png) [@vuser](https://forum.ansible.com/u/vuser)\
**Post date:** [April 11, 2025, 3:37pm UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/9 "2025-04-11T15:37:36Z")

</div>

excuse my ignorance, but this would be on the execution environment correct?

edit: i am using ansible automation platform 2.5 which is Redhats latest build. I didnt deviate much from their defaults so I will have to check on if i can get support from them.

---

<div class="post-metadata">

**Author:** ![wayt](https://avatars.discourse-cdn.com/v4/letter/w/3be4f8/32.png) [@wayt](https://forum.ansible.com/u/wayt)\
**Post date:** [April 25, 2025, 5:08am UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/10 "2025-04-25T05:08:01Z")

</div>

Your OU path doesn’t include a ` ` (space) in it does it? Apparently there is a [bug in vSphere Guest Customization](https://knowledge.broadcom.com/external/article/312178/windows-guest-os-customization-fails-to.html) …

Does it work directly in the UI of vSphere (right click; clone; etc)?

---

<div class="post-metadata">

**Author:** ![vuser](https://avatars.discourse-cdn.com/v4/letter/v/41988e/32.png) [@vuser](https://forum.ansible.com/u/vuser)\
**Post date:** [May 12, 2025, 8:54pm UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/11 "2025-05-12T20:54:34Z")

</div>

hey thank you for the reply.

It was actually an issue with pyvmomi. It wasnt that it was too old…it was missing completely lol. The latest was added and I was able to run the playbook successfully!

---

<div class="post-metadata">

**Author:** ![bmohanraj](https://avatars.discourse-cdn.com/v4/letter/b/b487fb/32.png) [@bmohanraj](https://forum.ansible.com/u/bmohanraj)\
**Post date:** [July 11, 2025, 3:23pm UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/12 "2025-07-11T15:23:10Z")

</div>

How to add pyvmomi to execution environment? thanks

---

<div class="post-metadata">

**Author:** ![mariolenz](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mariolenz/32/108_2.png) [@mariolenz](https://forum.ansible.com/u/mariolenz)\
**Post date:** [July 12, 2025, 12:03pm UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/13 "2025-07-12T12:03:50Z")

</div>

@bmohanraj I don’t use EEs, so I’m not really sure. But if I understand [this](https://ansible.readthedocs.io/projects/ansible/latest/getting_started_ee/build_execution_environment.html) correctly, it should be added automatically because it’s mentioned in the `requirements.txt` of `community.vmware`.

---

<div class="post-metadata">

**Author:** ![Tuxedo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tuxedo/32/7791_2.png) [@Tuxedo](https://forum.ansible.com/u/Tuxedo)\
**Post date:** [July 12, 2025, 4:05pm UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/14 "2025-07-12T16:05:37Z")

</div>

Which execution environment are you using in AAP2.5? The minimal ees might not have the pyvmoni but the supported one definitely have it.

---

<div class="post-metadata">

**Author:** ![bmohanraj](https://avatars.discourse-cdn.com/v4/letter/b/b487fb/32.png) [@bmohanraj](https://forum.ansible.com/u/bmohanraj)\
**Post date:** [July 15, 2025, 2:24pm UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/15 "2025-07-15T14:24:35Z")

</div>

Yes using AAP, can I get to know the supported EE name please, thanks.

---

<div class="post-metadata">

**Author:** ![bmohanraj](https://avatars.discourse-cdn.com/v4/letter/b/b487fb/32.png) [@bmohanraj](https://forum.ansible.com/u/bmohanraj)\
**Post date:** [July 15, 2025, 2:25pm UTC](https://forum.ansible.com/t/seeking-guidance-with-the-vmware-guest-module/41662/16 "2025-07-15T14:25:14Z")

</div>

But I am getting similar error as posted in the original message.
