我的打包程序代码包含packer chef solo provisioner
{
"type": "chef-solo",
"cookbook_paths": ["chef/cookbooks/vendor"],
"run_list": ["recipe[cicada-jenkins-cookbook::default]","recipe[cicada-jenkins-cookbook::support_tools]","recipe[cicada-jenkins-cookbook::cft_seed_dsl]","recipe[cicada-jenkins-cookbook::terraform_seed_dsl]"]
}
在这里我需要覆盖属性如何在打包器中传递它们
答案 0 :(得分:3)
{
"type": "chef-solo",
"cookbook_paths": ["chef/cookbooks/vendor"],
"roles_path": "chef/roles",
"json": {
"jenkins": {
"master": {
"port": 8080
},
"executor": {
"timeout": 300
}
},
"jenkins-cookbook": {
"admin_user": "uname",
"admin_pass": "pwd"
}
},
"run_list":["role[jenkins]"]
}
答案 1 :(得分:1)
尝试在Chef角色中定义属性覆盖,而不是覆盖Packer“json”属性中的值。然后使用'roles_path'指向本地磁盘上角色目录的位置。
"provisioners":
[
{
"type": "chef-solo",
"cookbook_paths": ["cookbooks"],
"roles_path": "cookbooks/dev-boxes/roles",
"run_list": [
"role[java]",
"role[sbt]",
"recipe[dev-boxes::recipe1]",
"recipe[dev-boxes::recipe2]"
]
}
],