我正在尝试使用循环并在剧本中要求在具有特定属性的服务器上创建多个目录:模式所有者组。
我想我已经接近了,但没有得到它的工作。
我收到此错误:
(文件)模块不支持的参数:recursive 支持的参数包括:_diff_peek、_original_basename、access_time、access_time_format、attributes、backup、content、delimiter、directory_mode、follow、force、group、mode、modification_time、modification_time_format、owner、path、recurse、regexp ,remote_src,selevel,serole,setype,seuser,src,状态,unsafe_writes
任何建议将不胜感激:
这是剧本示例:
- name: ansible create directory with_items example
file:
path: "{{ item.dest }}"
mode: "{{item.mode}}"
owner: "{{item.owner}}"
group: "{{item.group}}"
recursive: true
state: directory
loop:
- { dest: '/var/lib/tftpboot/os/uefi/debian11', mode: '0744', owner: 'root', group: 'root' }
- { dest: '/var/lib/tftpboot/os/uefi/ubuntu2004D', mode: '0744', owner: 'root', group: 'root'}
- { dest: '/var/lib/tftpboot/os/uefi/f34w', mode: '0744', owner: 'root', group: 'root'}
- { dest: '/var/lib/tftpboot/os/uefi/f34s', mode: '0744', owner: 'root', group: 'root'}
- { dest: '/srv/nfs/isos', mode: '0744', owner: 'root', group: 'rpcuser'}
- { dest: '/srv/nfs/pxe/debian11', mode: '0744', owner: 'root', group: 'rpcuser'}
- { dest: '/srv/nfs/pxe/ubuntu2004', mode: '0744', owner: 'root', group: 'rpcuser'}
- { dest: '/srv/nfs/pxe/f34w', mode: '0744', owner: 'root', group: 'rpcuser'}
- { dest: '/srv/nfs/pxe/f34s', mode: '0744', owner: 'root', group: 'rpcuser'}
- { dest: '/tmp/debian11', mode: '0744', owner: 'root', group: 'root'}
- { dest: '/tmp/f34w', mode: '0744', owner: 'root', group: 'root'}
- { dest: '/tmp/ubuntu2004D', mode: '0744', owner: 'root', group: 'root'}
你的参数有错别字。参数被调用
recurse
,你已经写好了recursive
。