microsoft.ad.split_dn filter – Splits an LDAP DistinguishedName.
Note
This filter plugin is part of the microsoft.ad collection (version 1.8.0).
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.split_dn
.
New in microsoft.ad 1.8.0
Synopsis
Splits the provided LDAP DistinguishedName (
DN
) string value giving you the first/leaf RDN component or the remaining/parent RDN components.The rules for parsing as defined in RFC 4514.
Each DN contains Relative DistinguishedNames (
RDN
) separated by,
.The returned string for each DN will be either the first/leaf RDN component representing the name of the object, or the remaining/parent components representing the parent DN path. Use the section kwarg to control what should be returned.
A DN that is invalid will raise a filter error.
As the values are canonicalized, the returned values may not match the original DN string provided but do represent the same LDAP DN value.
Leading and trailing whitespace from each component is removed from the returned value.
Input
This describes the input of the filter, the value before | microsoft.ad.split_dn
.
Parameter |
Comments |
---|---|
The LDAP DistinguishedName string to split. |
Keyword parameters
This describes keyword parameters of the filter. These are the values key1=value1
, key2=value2
and so on in the following
example: input | microsoft.ad.split_dn(key1=value1, key2=value2, ...)
Parameter |
Comments |
---|---|
The DN section to return. Defaults to Set to Do not specify Choices:
|
See Also
See also
- microsoft.ad.dn_escape
microsoft.ad.dn_escape filter
- microsoft.ad.parse_dn
microsoft.ad.parse_dn filter
Examples
- name: Gets the leaf RDN of a DN
set_fact:
my_dn: '{{ "CN=Foo,DC=domain,DC=com" | microsoft.ad.split_dn }}'
# CN=Foo
- name: Gets the parent RDNs of a DN
set_fact:
my_dn: >-
{{
"CN=Acme\, Inc.,O=OrgName,C=AU+ST=Queensland" |
microsoft.ad.split_dn("parent")
}}
# O=OrgName,C=AU+ST=Queensland,
Return Value
Key |
Description |
---|---|
The split RDN components based on the section requested. Returned: success Sample: |