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?
Asked
Active
Viewed 564 times
5
3 Answers
2
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.
Vladimir Botka
- 1,946
- 6
- 12
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.
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.
moogster
- 61
- 2