admin管理员组文章数量:1122847
I'm trying to understand the best way to achieve this in a packer template.
For example: I have a list of 3 values. Let's use red, blue, and green as an example
I want to create 3 separate builds (or however many items in the list I have) that do the same exact thing except in one of the provisioners, pass this value to a script being run there.
Create one build using:
provisioner "shell" {
execute_command = "{{ .Vars }} sudo -E bash '{{ .Path }}'"
inline = [
"/tmp/my_script.sh red
]
}
Second build:
provisioner "shell" {
execute_command = "{{ .Vars }} sudo -E bash '{{ .Path }}'"
inline = [
"/tmp/my_script.sh blue
]
}
etc.
I currently have 1 source and 1 build block, but need a way to create dynamically as many as there are items in the list
本文标签: hclHow to create parallel builds foreach item in list using packer templateStack Overflow
版权声明:本文标题:hcl - How to create parallel builds foreach item in list using packer template - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736478018a1944339.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论