Note
This filter plugin is part of the microsoft.ad collection (version 1.9.2).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install microsoft.ad.
To use it in a playbook, specify: microsoft.ad.parse_dn.
New in microsoft.ad 1.5.0
DN) string value into a structured object.RDN) separated by , and each RDN can contain multiple attribute type values also known as an AVA. While Microsoft Active Directory DNs can only contain 1 AVA in an RDN this parser supports multiple AVAs., and the inner list is each AVA separated by = and +. Each RDN entry is guaranteed to have 2 string values for the AVA type and value but can contain more if the RDN contains multiple AVAs separated by +.This describes the input of the filter, the value before | microsoft.ad.parse_dn.
Parameter | Comments |
|---|---|
Input string / required | The LDAP DistinguishedName string to parse. |
See also
microsoft.ad.dn_escape filter
microsoft.ad.split_dn filter
microsoft.ad.ldap inventory
- name: Parses a simple DN
set_fact:
my_dn: '{{ "CN=Foo,DC=domain,DC=com" | microsoft.ad.parse_dn }}'
# [
# ["CN", "Foo"],
# ["DC", "domain"],
# ["DC", "com"],
# ]
- name: Parses a DN with an escaped and multi attribute values
set_fact:
my_dn: '{{ "CN=CA,O=Acme\, Inc.,C=AU+ST=Queensland" | microsoft.ad.parse_dn }}'
# [
# ["CN", "CA"],
# ["O", "Acme, Inc."],
# ["C", "AU", "ST", "Queensland"]
# ]
# Extract the group names the computer is a member of in the ldap inventory
# plugin, for example gets the first RDN value inside the parsed DN.
attributes:
memberOf:
computer_membership: this | microsoft.ad.parse_dn | map(attribute="0.1")
Key | Description |
|---|---|
Return value list / elements=list | The parsed LDAP DN values. Returned: success Sample: |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/microsoft/ad/parse_dn_filter.html