Take a look at the ldapsearch lookup plugin: https://docs.ansible.com/ansible/latest/collections/community/general/ldap_search_module.html
On Fri, 27 Aug 2021 at 18:06, [email protected] <[email protected]> wrote: > 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 > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/fa6014bc-3429-440d-abde-00614598e977n%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/fa6014bc-3429-440d-abde-00614598e977n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Sent from a mobile device - please excuse the brevity, spelling and punctuation. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwOZZGtGkNVAH4B69ojLtW-Aoveu%2BO9-S_j-Hdm-0N%3DAgg%40mail.gmail.com.
