How to modify folder ownership and permissions recursively using Ansible

Ansible file module can be used to modify the ownership and permissions of folders and files recursively.

Sample snippet is sharing below.

file: dest=path-to-folder
  owner=username 
  group=groupname 
  mode=u=rwX,g=rX,o=rX 
  recurse=yes

Here we need to replace the path-to-folder, username and groupname with the required values according to the requirement. The permissions value is also customizable as per the requirements.

That's all…

Leave a Reply

Your email address will not be published. Required fields are marked *