Closed kagehisa closed 1 year ago
Ok I figured out a way to assemble the AD String in a way that it is accepted by the module. Create ou as a list:
ad_path:
- OU=server
- DC=test
- DC=de
And use it like this in the module:
- name: create computer object
community.windows.win_domain_computer:
name: "{{ inventory_hostname_short | upper }}"
sam_account_name: "{{ inventory_hostname_short | upper }}$"
dns_hostname: "{{ inventory_hostname }}"
ou: "{{ ad_path | join(',') }}"
description: "{{ desc }}"
enabled: yes
state: present
I still don't know why this works and the other solution didn't but it works.
SUMMARY
When using
win_domain_computer
to create a computer object. It is not possible to define the OU in a variable and hand it over to the module. It is always necessary to write the OU in the task directly. This works:This does not:
The Example with OU provided via a variable gives me the following error:
ISSUE TYPE
COMPONENT NAME
win_domain_computer
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Execution Host: Suse 15 SP4 Target Host: Windows Server 2019
STEPS TO REPRODUCE
EXPECTED RESULTS
Since all attributes are defined as string I would expect that the ou path can be supplied via a variable, just like the other parameters.
ACTUAL RESULTS
I receive an error like the one below: