Closed marksie1988 closed 5 months ago
Unfortunately as the error is happening inside Add-Computer
we don't have much control over how/why it is failing. An older issue https://github.com/ansible/ansible/issues/57313 seemed to indicate the domain_ou_path
may have been invalid in that scenario so this would be a good place to start investigation. Running the same command locally outside of Ansible might also help narrow down if it's a network logon problem or something else.
I ran the command outside of ansible and In this instance it also seems that this was caused by the OU not existing as its a test lab, I have removed that and it works now.
Not sure if it would be a good idea to add a message if this error happens to warn users it could be an incorrect OU path?
It would be a nice idea except that it would require a fair bit of code to resolve the domain controller hostname to actually do the ldap queries. I’m not sure if there is a builtin Windows mechanism to do so outside of what Add-Computer does internally.
I've just merged https://github.com/ansible-collections/microsoft.ad/pull/92 which tries to catch this particular error and add on a note saying to check the domain_ou_path
on a failure. Hopefully that should help others who come across this problem in the future.
SUMMARY
Trying to join a number of Windows server 2022 to a test domain and they all keep failing saying "the system cannot find the file specified.
ISSUE TYPE
COMPONENT NAME
microsoft.ad.membership
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Server 2022
STEPS TO REPRODUCE
I am using the following play:
with these groupvars:
EXPECTED RESULTS
Servers should be joined to the domain
ACTUAL RESULTS