Ansible with_items vs循环 [英] Ansible with_items vs loop
问题描述
使用 with_items 与推荐答案
Update: The most recent Documentation lists down the differences as below
旧答案 根据文档, 在2.5 Ansible之前,主要使用with_关键字创建循环,而loop关键字基本上类似于with_list. Before 2.5 Ansible mainly used the with_ keywords to create loops, the loop keyword is basically analogous to with_list. 因此,它们基本上是相同的,只有较新的版本在其语法中使用 So basically they are pretty much the same, only the newer version uses 这篇关于Ansible with_items vs循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
loop
.从2.7.12版本开始,两者都可以按预期工作,但是为了将来的兼容性,建议使用loop
关键字.loop
in its syntax. And as of version 2.7.12 both work as expected but using the loop
keyword is encouraged for future compatibility.