パッカーでオプション変数を使用する可能性を理解しようとしてきました。私のスクリプトは次のとおりです。
"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