VMware Cloud Community
justinsmith
Enthusiast
Enthusiast

Ansible VM Guest Customization

So I wrote a playbook that builds a VM and configures etc. and it works great. I use the customization piece in the vmware_guest module for ansible that joins it to the domain but I'm looking to get the VM added to a specific OU. Asking here because I've tried to use the runonce command but those all want to use the netdom command, which doesnt exist by default on server 2019. Curious if/how others are doing this? I've looked into the ansible module for windows but I dont want to have a windows bridge computer.

0 Kudos
4 Replies
justinsmith
Enthusiast
Enthusiast

I figured it out...

the ansible module uses the same thing sysprep uses.In this case the MachineObjectOU is the parameter you can add. Its not on any ansible documentation either.

customization:

     domainadmin: "{{ joinDomainUser }}"

     domainadminpassword: "{{ joinDomainPassword }}"

     joindomain: "{{ joinDomainName }}"

     MachineObjectOU: "{{ domainOuPath }}"

0 Kudos
justinsmith
Enthusiast
Enthusiast

Nevermind. I never deleted the old computer account in AD. Thats not the fix, unfortunately

0 Kudos
tdubb123
Expert
Expert

were you able to get a vm clone to join a particular machine OU with

machineobjectou in ansible customization?

I am trying the same thing and it doesnt do it. It joins the domain but keeps putting it in computer objects OU

0 Kudos
Gabriel_22
Contributor
Contributor

Were you able to solve the issue?

I'm having the same problem. 

0 Kudos