我正在Chef中使用环境,并且我想使用每个环境的运行列表。问题是我不想重复自己(就像我现在做的那样)。例子:
{
"name": "myapp",
"default_attributes": {
},
"json_class": "Chef::Role",
"env_run_lists": {
"production": [
# Has less packages because services are spread across specialized nodes
"role[base]",
"recipe[mysql::client]",
"recipe[myapp]"
],
"staging": [
# Has less packages because services are spread across specialized nodes
"role[base]",
"recipe[mysql::client]",
"recipe[myapp]"
],
"development": [
"role[base]",
"recipe[mysql::client]",
"recipe[myapp]",
"role[utility]",
"role[cache]"
]
},
"run_list": [
],
"description": "The myapp.com core application role",
"chef_type": "role",
"override_attributes": {
}
}
有什么办法可以避免重复此步骤?
"role[base]",
"recipe[mysql::client]",
"recipe[myapp]",
我只想避免环境运行列表不同步并破坏部署。
最佳答案
目前没有。角色纯粹是声明性的,不是那种动态的。您可以创建一个包含这三个项目的角色,并将其包含在每个环境运行列表中。
关于ruby - 厨师: Can I share common per-environment run list items?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9688959/