Thank you for that suggestion!  Worked perfectly!  I appreciate it very 
much.

Thanks,
Harry

On Thursday, July 1, 2021 at 5:09:28 PM UTC-4 [email protected] wrote:

> for instance using selectattr.
>
> "{{ fs.files|selectattr('pw_name', 'equalto', 'some_user')|list }}"
>
>
> On Thu, 1 Jul 2021 at 21:20, [email protected] <[email protected]> wrote:
> >
> > I'm trying to use the find module to search a path and return all files 
> owned by a particular user. I can get the list of all files in the folder, 
> but the data returned has both the path and the pw_name for each file. How 
> can I narrow the search to return only files where pw_name is a certain 
> user?
> >
> > ---
> > - hosts: localhost
> > become: yes
> > become_method: sudo
> > gather_facts: no
> >
> > tasks:
> >
> > - name: Find all files under /tmp
> > find:
> > paths: /tmp
> > recurse: yes
> > register: fs
> >
> > - name: Print output
> > debug:
> > msg: "{{ fs }}"
> >
> > What gets printed is every single file found, and fs.files has both path 
> and pw_name. I want to only show any file where pw_name is the user I'm 
> looking for.
> >
> > Any ideas?
> >
> > Thanks,
> > Harry
> >
> > --
> > 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/ac36dc28-a5a1-40d2-84af-c8d07384b65cn%40googlegroups.com
> .
>
>
>
> -- 
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
>

-- 
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/7873fec9-21e3-4ca0-b8c6-e4c1cc1befccn%40googlegroups.com.

Reply via email to