Return List of Users with LDAP Query

381 views
Skip to first unread message

david....@bmt.ky

unread,
Aug 27, 2021, 12:06:07 PM8/27/21
to Ansible Project
Hi All,

I'm trying to use Ansible to query my Domain Controller to return a list of users with a specific set of criteria and then modify those returned users to add them to a group.

How this looks in practice is that I want Ansible to return a list of users based on this query:

(&(objectClass=User)(extensionAttribute10=AttribPresent)(!(memberOf=CN=MyGroup,OU=MyOU2,OU=MyOU,DC=Domain)))

This returns a list of users that I want to loop over and add to a group in AD: DaveGroup.

So far I can't seem to find a way to do this, other than with PowerShell maybe?

Any help would be amazing!

Thanks

Dick Visser

unread,
Aug 27, 2021, 3:23:41 PM8/27/21
to ansible...@googlegroups.com
Take a look at the ldapsearch lookup plugin:


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/fa6014bc-3429-440d-abde-00614598e977n%40googlegroups.com.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.
Reply all
Reply to author
Forward
0 new messages