假设有一个目录/ dir/tools。 工具包含一堆脚本,比如说a.sh,b.sh,c.sh.Ansible:在.yml文件中更改目录中文件的权限
我需要设置的a.sh,b.sh和c.sh到0775.
我通过以下方式完成目前它的权限:
- 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
顺便说一句, 'file:path =/dir/tools owner = abc group = abc mode = 0775'设置工具目录的权限,但不是其中的文件的权限。
有没有更好的方法来实现这一目标?
你有没有尝试添加'状态= directory'到第二次尝试? – ydaetskcoR