【发布时间】:2021-08-17 12:11:36
【问题描述】:
我有两本字典:
- Test1:
1: pass
2: fail
3: pass
- Test2:
1.1.1.1: val1
2.2.2.2: val2
3.3.3.3: val3
条件是 Test1.value contians 失败时
- name: test
debug:
msg: "{{item.1.value}} {{item.1.key}} {{item.0.key}} {{item.0.value}}"
with_together:
- "{{Test1}}"
- "{{Test2}}"
when: item.0.value == "fail"
这无法按预期工作,无法在一个循环中同时获取 2 dict 的键和值
【问题讨论】:
-
我需要字典键和循环内的值
标签: ansible ansible-2.x ansible-inventory ansible-facts ansible-template