- From:
- To: chef <
>
- Subject: [chef] env-independent recipes don't run within base role
- Date: Wed, 14 Sep 2011 15:51:04 -0700
hiya,
i guess i'm doing something wrong here. i have defined a base role.
in the base role definition, i desire a set of common recipes to execute
regardless of the environment setting (recipe[snmp], recipe[toolbin]).
i also desire to have certain users created depending on which
environment is set.
however, when the client runs, the environment-independent recipes
aren't running. how can i accomplish this? or do i need to think about
this in a different way? (e.g. i could move recipe[snmp] to role[snmp],
adding the latter to the node's run list, but that seems silly.)
lots of detail below. thanks much.
kallen
given base.json below, i'd expect a node in env "prod" to run the
following from the base role: recipe[users::ops], recipe[snmp],
recipe[toolbin]. but, only recipe[users::ops] runs.
chefsrv:~/sbox/ops/chef-repo$ cat roles/base.json
{
"name": "base",
"default_attributes": {
},
"json_class": "Chef::Role",
"env_run_lists": {
"prod" : [
"recipe[users::ops]"
],
"dev": [
"recipe[users::ops]",
"recipe[users::eng]"
]
},
"run_list": [
"recipe[snmp]",
"recipe[toolbin]"
],
"description": "Base system",
"chef_type": "role",
"override_attributes": {
}
}
[sous-chef1 ~]# tail -1 /etc/chef/client.rb
environment "dev"
chefsrv:~/sbox/ops/chef-repo$ knife node show sous-chef1.dev.hewwoh.com -r
run_list:
role[base]
role[dns-client]
role[mail-client]
role[syslog-ng-client]
NOTE: all of the above roles do run on the client. but again, the
environment-independent recipes within the base role don't run.
chefsrv:~/sbox/ops/chef-repo$ knife role show base
chef_type: role
default_attributes:
description: Base system
env_run_lists:
prod: recipe[users::ops]
dev: recipe[users::ops], recipe[users::eng]
json_class: Chef::Role
name: base
override_attributes:
run_list: recipe[snmp], recipe[toolbin]
chefsrv:~/sbox/ops/chef-repo$ knife environment show dev
chef_type: environment
cookbook_versions:
default_attributes:
resolver:
domain: dev.hewwoh.com
nameservers:
10.69.69.69
10.69.69.68
10.69.69.67
search: dev.hewwoh.com
description: Development environment (dev)
json_class: Chef::Environment
name: dev
override_attributes:
- [chef] env-independent recipes don't run within base role, kallen, 09/14/2011
Archive powered by MHonArc 2.6.16.