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:
---
- 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”
}
}