4

I am trying to use the Ansible find module to create a list of files to pass to the file module to change file permissions on files owned by a specific user in a directory that contains files owned my various users. The Ansible find module does not appear to allow me to use owner or group as search criteria. There are no other distinguishing factors about the files other than the owner. Is it possible or would I have to use the shell module instead?

1

You might want to loop stat module with the list of files from the 'find' module. The 'stat' module will provide you with 'pw_name' key which can be used to conditionally run the 'file' module.

1

If the target is a directory, setting this to yes will make it the default acl for entities created inside the directory.

Select if and when to recalculate the effective right masks of the files, see setfacl documentation for more info. Incompatible with state=query.

See: acl - Sets and retrieves file ACL information.

1

I ended up using the command module to run a find to ascertain which files were owned by the required user, put them in a register and pass that register to the file module using with_items.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.