I figured it out. I also switched to batch mode instead of single mode:

shell: "find /home/staff -gid {{item.0.stdout}} -exec chgrp {{item.1.stdout}} 
\\{\\} +"


On Wednesday, July 6, 2016 at 11:49:19 AM UTC-5, Joanna Delaporte wrote:
>
> I want to find and chown about 4000 users' files while migrating to a new 
> authentication protocol and domain.
>
> I have a task that looks like this: 
>   - name: find and fix UID ownerships in all staff homedirs
>     shell: "find {{'~'+item.name | expanduser }} -uid {{item.uid}} -exec 
> chown {{item.name}} {} \;"
>     with_items:
>     - "{{staff|default([])}}"
>     - "{{students|default([])}}"
>     - "{{staffstuaccounts|default([])}}"
>     when: item.uid is defined
>
>
> And I get this syntax error:
>   - name: find and fix UID ownerships in all staff homedirs
>     shell: "find {{'~'+item.name | expanduser }} -uid {{item.uid}} -exec 
> chown {{item.name}} {} \;"
>                                                                           
>                        ^ here
> We could be wrong, but this one looks like it might be an issue with
> missing quotes.  Always quote template expression brackets when they
> start a value. 
>
> I would use built-in modules, but find doesn't find owners. Stat (as far 
> as I can tell) doesn't go recursive. I'm a little nervous about registering 
> output from find and then writing a new file task to chown the results 
> (which would have to use with_together, I think), in case the user list 
> order gets out of sync between two tasks. Is there a way to escape this 
> shell expression so it will work?
>
> Thanks!
> Joanna
>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/646fc3ea-ae13-4ba2-9970-036dd1d724b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to