microsoft.ad.dn_escape filter – Escape an LDAP DistinguishedName value string.

Note

This filter plugin is part of the microsoft.ad collection (version 1.7.1).

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.dn_escape.

New in microsoft.ad 1.5.0

Synopsis

  • Escapes a string value for use in an LDAP DistinguishedName.

  • This can be used to escape special characters when building a DistinguishedName value.

Input

This describes the input of the filter, the value before | microsoft.ad.dn_escape.

Parameter

Comments

Input

string / required

The string value to escape.

This should be just the RDN value not including the attribute type that prefixes the value, for example MyValue and not CN=MyValue.

See Also

See also

microsoft.ad.parse_dn

microsoft.ad.parse_dn filter

microsoft.ad.ldap

microsoft.ad.ldap inventory

Examples

# This is an example used in the microsoft.ad.ldap plugin

search_base: OU={{ my_ou_variable | microsoft.ad.dn_escape }},DC=domain,DC=com

# This is an example with the microsoft.ad.user module

- microsoft.ad.user:
    name: MyUser
    password: MyPassword123
    state: present
    path: OU={{ my_ou_variable | microsoft.ad.dn_escape }},DC=domain,DC=com

Return Value

Key

Description

Return value

string

The escaped RDN attribute value.

Returned: success

Authors

  • Jordan Borean (@jborean93)

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.