Answers: <p>You might want to loop <a href="https://docs.ansible.com/ansible/latest/modules/stat_module.html" rel="nofollow noreferrer">stat</a> 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.</p>
  
Answers: CC BY-SA 4.0
Answers: 2018-11-05T17:36:45.150Z
Answers: 2018-11-05T17:36:45.150Z
Answers: Vladimir Botka
Answers: <p>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.  </p>
  
Answers: CC BY-SA 4.0
Answers: 2018-11-08T07:30:18.833Z
Answers: 2018-11-08T07:30:18.833Z
Answers: moogster
Answers: <p>If the target is a directory, setting this to yes will make it the default <code>acl</code> for entities created inside the directory.</p>
  
  <p>Select if and when to recalculate the effective right masks of the files, see <code>setfacl</code> documentation for more info. Incompatible with state=query.</p>
  
  <p>See: <a href="https://docs.ansible.com/ansible/latest/modules/acl_module.html#acl-module" rel="nofollow noreferrer">acl - Sets and retrieves file ACL information</a>.</p>
  
Answers: CC BY-SA 4.0
Answers: 2018-11-06T04:39:24.887Z
Answers: 2018-11-06T12:15:27.193Z
Answers: 2018-11-06T12:15:27.193Z
Answers: hakkican
Body: <p>I am trying to use the Ansible <code>find</code> module to create a list of files to pass to the <code>file</code> module to change file permissions on files owned by a specific user in a directory that contains files owned my various users.  The Ansible <code>find</code> 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 <code>shell</code> module instead?</p>
  
Tags: <ansible>
Title: Ansible Find Module
UserDisplayName: moogster
ThreadText: # Ansible Find Module
  
  (Asked by: username_0 on 2018-11-05)
  
  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?
  
  **Tags:** ansible
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2018-11-05. Score: 2
  
  You might want to loop [stat](https://docs.ansible.com/ansible/latest/modules/stat_module.html) 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.
  
  
  ---
  
  ### Answer by username_0 on 2018-11-08. Score: 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.
  
  
  ---
  
  ### Answer by username_2 on 2018-11-06. Score: 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](https://docs.ansible.com/ansible/latest/modules/acl_module.html#acl-module).
  
  
  ---
  
  