LDAP integration with ldap_entry module.

30 views
Skip to first unread message

Nikhil

unread,
Apr 3, 2019, 4:16:13 AM4/3/19
to Ansible Project
Hi,

  Am trying to interface with LDAP on Linux and creating a new user. if uid doesn't exist, then it should ideally create one. However, am getting below error. 

My ansible playbbok is as below:

- name: LDAP user check
  hosts: LOCAL
  tasks:
  - name: check ldap entry
    ldap_entry:
                dn: cn=admin,dc=example,dc=com
                objectClass:
                        - simpleSecurityObject
                        - organizationalRole

  - name: Ensure an LDAP entry exists for uid
    ldap_entry:
           server_uri: ldaps://directory.example.com:636
           bind_dn: cn=admin,dc=example,dc=com
           bind_pw: XXXXXX
           dn: uid=njain10,ou=people,dc=example,dc=com
           objectClass:
                - account
           attributes:
                   uid: njain10

ERROR:
----------

TASK [Ensure an LDAP entry exists for uid] *****************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NO_SUCH_OBJECT: {'matched': u'dc=example,dc=com', 'desc': u'No such object'}
fatal: [192.168.XXX.XXX]: FAILED! => {"changed": false, "details": "{'matched': u'dc=example,dc=com', 'desc': u'No such object'}", "msg": "Entry action failed."}


Appreciate anyone's help here.

Regards,
Nikhil

Javi Legido

unread,
Apr 21, 2020, 1:17:53 AM4/21/20
to Ansible Project
Hi there.

I strongly suggest first try to create the user by hand, to discard errors such as wrong domain and so on.

Cheers.
Reply all
Reply to author
Forward
0 new messages