I'm trying to configure Red Hat Ansible Tower to authenticate via LDAPS. It has a web GUI to configure LDAPS settings but the only way to test it is via the ldapsearch CLI utility. I've never used LDAPS before getting this project dumped on my lap.

I think ldapsearch -x -H ldaps://myldapserver:ldapport -D "CN=ansible,OU=blah,DC=blah" -b "OU=ansiblegroup,DC=blah" -w passwd returns the following:

# search result
search: 2
result: 0 Success

# numResponses: 3
# numEntires: 2

Truthfully I have no clue what these results mean, but I assume it's working because it says Success. I tried putting the -H as Tower's "LDAP Server URI", the -D as "LDAP Bind DN" and the -b as "LDAP Group Type Parameters" but no luck.

There is an additional OU called accessgroup within ansiblegroup that contains the actual users (let's say user1 and user2), but if I change it to -b "OU=accessgroup,OU=ansiblegroup,DC=blah I get this instead:

search: 2
result: 32 No such object
matchedDN: OU=ansiblegroup,DC=blah"

So where do I go from here? Is there anything short of a 1,000 page LDAP manual that might be of use?

  • Maybe show the LDIF of the object you are searching.
    – U. Windl
    Apr 5, 2022 at 9:35
  • Try the -v option first.
    – gerhard d.
    Apr 5, 2022 at 17:35

1 Answer 1


Lets assume there is the following configuration

curl --silent --user "${ACCOUNT}:${PASSWORD}" --location "https://${TOWER_URL}/api/v2/settings/ldap" | jq '.'

resulting into an output of

  "AUTH_LDAP_SERVER_URI": "ldaps://ad.example.com:636",
  "AUTH_LDAP_BIND_DN": "CN=tower_ldap,OU=service_accounts,OU=accounts,DC=example,DC=com",
  "AUTH_LDAP_BIND_PASSWORD": "$encrypted$",
    "first_name": "givenName",
    "last_name": "sn",
    "email": "userPrincipalName"
  "AUTH_LDAP_GROUP_TYPE": "NestedActiveDirectoryGroupType",
  "AUTH_LDAP_REQUIRE_GROUP": "CN=tower_user,OU=resource_groups,OU=groups,DC=example,DC=com",
  "AUTH_LDAP_1_BIND_DN": "",
  "AUTH_LDAP_1_START_TLS": true,

You could query the directory for name as follow

ldapsearch -h ad.example.com -p 389 \
           -D "tower_ldap" -x -w "${LDAP_PASSWORD}" \
           -b "DC=example,DC=com" \
           -s sub "(& (memberOf:1.2.840.113556.1.4.1941:=CN=tower_user,OU=resource_groups,OU=groups,DC=example,DC=com) )" name \
           | grep "name:" | cut -d " " -f 2-

to get just the usernames of users which are allowed to login or search further for cn instead with

... cn | grep "cn:" | cut -d " " -f 2-
... cn | grep "cn:" | cut -d " " -f 2- | wc -l

Please take note that

"AUTH_LDAP_REQUIRE_GROUP": "CN=tower_user,OU=resource_groups,OU=groups,DC=example,DC=com"

contains a role group as member only


therefore the query for NestedActiveDirectoryGroupType.

Further Q&A

Further Documenation

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .