I'm using environments in chef, and I want to use per-environment run lists. The problems is that I don't want to repeat myself (like I'm doing now). Example:
{
"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": {
}
}
Is there a way I can avoid repeating this?
"role[base]",
"recipe[mysql::client]",
"recipe[myapp]",
I just want to avoid environment run lists falling out of sync and breaking deployments.
At this time, no. Roles are purely declarative and not dynamic in that way. You could create a role that includes those three items and include that in the per environment run lists.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With