我尝试了许多现有的过滤器,但找不到解决方案。我要对字典列表内的内部列表的每个元素以及该字典的键执行一些操作(假设debug
)。
输入数据:
---
- hosts: localhost
tasks:
- debug: msg='{{ mykey_item }} with {{ inner_list_item }}'
loop: '{{ something_here }}'
vars:
example:
- mykey: key1
inner_list:
- one
- two
- mykey: key2
inner_list:
- three
- four
预期输出:
key1 with one
key1 with two
key2 with three
key2 with four