Hi, I want to ensure that a directory and all its children belongs to a user/group. Normally I would do following with Ansible:
file: dest: /path/to/dir owner: userx group: groupx recurse: yes
However this approach takes in my case about 10 minutes or more, because the folder contains recursively hundreds of subfolders and thousands of files. With the following approach this task takes me just seconds:
command: "chown -R userx:groupx /path/to/dir" changed_when: false
Why is the Ansible native approach so much slower? Is it because it checks the state before/after the (possible) change? Or is there a faster good practice approach with Ansible?