我正在尝试与特定所有者/组创建一些符号链接,但它始终是使用owner=root 和group=root 创建的。为什么?
这是我的代码:
- name: Get the directories to create symbolic links
find:
paths: /myPath/
register: result
- name: Creation of symbolic links
file:
src: "{{ item.path }}"
dest: /Path_Dest/{{ item.path | basename }}
owner: 'owner1'
group: 'group1'
state: link
with_items: "{{ result.files }}"
Run Code Online (Sandbox Code Playgroud)
笔记 :
如果您不指定follow=False,则将遵循符号链接(因为默认为 follow=True),并且所有权和组将应用于目标路径。使用:
- name: Creation of symbolic links
file:
src: "{{ item.path }}"
dest: /Path_Dest/{{ item.path | basename }}
owner: 'owner1'
group: 'group1'
state: link
follow: False
with_items: "{{ result.files }}"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1973 次 |
| 最近记录: |