Question:
Suppose there’s a directory /dir/tools.
tools contains a bunch of scripts, say, a.sh, b.sh, c.sh.
I need to set the permissions of a.sh, b.sh, and c.sh to 0775.
I’ve currently done it in the following manner:
1 2 3 4 5 6 7 |
- name: Fix 'support_tools' permissions file: path={{ item }} owner=abc group=abc mode=0775 with_items: - /dir/tools/a.sh - /dir/tools/b.sh - /dir/tools/c.sh |
Btw, ‘file: path=/dir/tools owner=abc group=abc mode=0775’ sets the permission of tools directory but not of the files inside it.
Is there a better way of achieving this?
Answer:
Try:
1 2 3 |
- name: Fix 'support_tools' permissions file: path=/dir/tools owner=abc group=abc mode=0775 state=directory recurse=yes |