【发布时间】:2021-02-04 18:30:43
【问题描述】:
我需要在嵌套循环中遍历另一组 dicts 列表的 dicts 列表,以从我得到的输出中读取所有值。我是 ansible 的新手,也尝试过 with_items、loop、with_subelements 和 with_nested。没有什么能满足我从输出中读取所有值的需要。有人可以阐明我们如何进行嵌套循环吗?非常感谢您的帮助。
Outer-List: [
{
Key1: value1
Key2: value2
Inner-List: [
{
Key31: value-A
Key32: value-B
}
{
Key33: value-C
Key34: value-D
}
],
}, ====> OuterList[0] ends here
{ ====> OuterList[1] starts here
Key1: value1
Key2: value2
Inner-List: [
{
Key31: value-E
Key32: value-F
}
{
Key33: value-G
Key34: value-H
}
],
} ====> OuterList[1] ends here
] ====> OuterList ends here
【问题讨论】:
标签: dictionary ansible nested-loops