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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/78fe62ba-e39d-47ac-83a2-1fbaf602f4fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to