我有一个默认的目标 Linux 节点umask=0077
。当我运行剧本时
- name: Create folder for app
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: app_user
mode: 0755
with_items:
- "/opt/app/folder1/bin"
- "/etc/program/folder2"
参数“mode”仅适用于最后一个文件夹(bin
和folder2
)。根据 umask,所有父目录都具有严格权限。
如何设置父目录所需的权限(不是全部/opt
或/etc
仅针对链):
/opt
,,,,/opt/app
/opt/app/folder1
/opt/app/folder1/bin
/etc
,,/etc/program
/etc/program/folder2