我一直在尝试弄清楚在packer中使用选项变量的可能性,我的脚本如下:
"provisioners": [{
"type": "shell",
"scripts": [
"scripts/centos/5.11/puppet-{{user `config`}}.sh",
]
}],
"variables": {
"config": "{{user `type`}} | slave",
}
一个典型的命令如下:
packer build \
-var 'config=master' \
template.json
但也需要能够仅执行以下操作:
packer build template.json # were config would default to slave