【发布时间】:2019-10-28 14:01:57
【问题描述】:
我必须运行这样的步骤大约 20-25 次。我该如何处理 for 循环(with_items)。
我可以预先定义参数 URL1、Location1、pkg1.comamd1、$pkg1.command2,我可以在 ansible 剧本中定义它们。 Pkg1 值将从 jenkins 脚本传递
- get_url:
url: "$URL1"
dest: $Location1
when: $Pkg1 != 'NONE'
- Name : run the commands
Shell: sh $pkg1.comamd1; sh $pkg1.command2
when: Pkg1 != 'NONE'
如何创建变量数组并使用_items 来完成
VarDetails {Pkg1, URL1, Location1, comamd1a, $command1b
Pkg2, URL2, Location2, comamd2a, $command2b
Pkg3, URL3, Location3, comamd3a, $command3b
....................
....................
}
【问题讨论】: