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
3 Replies
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
Enthusiast
Enthusiast

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

0 Kudos
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