【发布时间】:2021-03-16 09:34:11
【问题描述】:
我有一个目录/read-only-others-group,others 组中的用户应该对所有文件具有递归的只读访问权限。我尝试使用file 模块:
- name: Ensure /read-only-others-group directory exists and gives read-only access to others group
file:
path: /read-only-others-group
state: directory
recurse: yes
owner: someuser
group: somegroup
mode: "0754"
此权限不允许其他组中的用户 ls 或 cat 文件或 cd 进入目录或其下的任何目录。
可以用 shell 模块解决:
find /read-only-others-group -type d -print0 | xargs -0 chmod 755
find /read-only-others-group -type f -print0 | xargs -0 chmod 754
有没有更好的幂等解决方案?
【问题讨论】:
标签: ansible file-permissions ansible-2.x