HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Ansible Find Module

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
moduleansiblefind

Problem

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?

Solution

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.

Context

StackExchange DevOps Q#5333, answer score: 2

Revisions (0)

No revisions yet.