是否可以使用Ansible Playbook与with_dict和with_nested一起循环?

ave*_*ble 7 ansible ansible-playbook

我试图循环哈希和与之关联的数组,如下所示:

VAR:

  dictionary:
    aword: [ ant, den ]
    bword: [ fat, slim ]
Run Code Online (Sandbox Code Playgroud)

任务:

name: Create symlinks
command: do something with item[0] over item[1]
with_nested:
  - "{{ item.key }}"
  - "{{ item.value }}"
with_dict: dictionary
Run Code Online (Sandbox Code Playgroud)

这不起作用.我做错了什么或Ansible不支持这样的迭代?

ave*_*ble 6

我用这个解决了这个

with_subelements
Run Code Online (Sandbox Code Playgroud)

像这样

瓦尔:

dictionary:
- name: aword
  words:
    - ant
    - den
- name: bword
  words:
    - fat
    - slim
Run Code Online (Sandbox Code Playgroud)

任务:

name: Create symlinks
command: do something with item.0.name over item.1
with_subelements: 
  - dictionary
  - words
Run Code Online (Sandbox Code Playgroud)