Are all attribute files evaluated for all nodes in the same cookbook?
(Assuming no conditionals that would exclude.)
For some reason, we thought we could have different “role recipes” that
included different attribute files, rather than setting the attributes
inside the recipe. But it wasn’t working, and this page seems to confirm
that all attribute files would be evaluated even if you’re not
intentionally “including” them:
http://docs.opscode.com/essentials_cookbook_attribute_files.html
If that’s the case, what’s the best practice here? To only put default
values in any attributes file, and then set role differences inside role
recipes? (We’re starting to move to role recipes, but we might have several
roles within the same cookbook, so we were hoping to set each role’s
attributes with a different attributes file.)
Thanks,
johnny
On 10/31/2013 2:27 PM, Johnny Tan wrote:
Are all attribute files evaluated for all nodes in the same cookbook?
(Assuming no conditionals that would exclude.)
Yes.
For some reason, we thought we could have different "role recipes" that
included different attribute files, rather than setting the attributes
I made this assumption too. I had an attributes/foo.rb that I
thought would only be used for recipes/foo.rb. I was wrong 
inside the recipe. But it wasn't working, and this page seems to confirm
that all attribute files would be evaluated even if you're not
intentionally "including" them:
About Attributes
If that's the case, what's the best practice here? To only put default
values in any attributes file, and then set role differences inside role
recipes? (We're starting to move to role recipes, but we might have
several roles within the same cookbook, so we were hoping to set each
role's attributes with a different attributes file.)
Looking forward to others' info here as well.
Hi Johnny.
Yes, all attribute files from all cookbooks get loaded in the chef-client
run.
Best practice is to namespace them in the hashes.
default['cookbookname']['possibly_even_recipe_name']['foo'] = "bar"
-s
On Thu, Oct 31, 2013 at 2:27 PM, Johnny Tan johnnydtan@gmail.com wrote:
Are all attribute files evaluated for all nodes in the same cookbook?
(Assuming no conditionals that would exclude.)
For some reason, we thought we could have different "role recipes" that
included different attribute files, rather than setting the attributes
inside the recipe. But it wasn't working, and this page seems to confirm
that all attribute files would be evaluated even if you're not
intentionally "including" them:
About Attributes
If that's the case, what's the best practice here? To only put default
values in any attributes file, and then set role differences inside role
recipes? (We're starting to move to role recipes, but we might have several
roles within the same cookbook, so we were hoping to set each role's
attributes with a different attributes file.)
Thanks,
johnny
Thanks Sean.
On Thu, Oct 31, 2013 at 3:45 PM, Sean OMeara someara@gmail.com wrote:
Hi Johnny.
Yes, all attribute files from all cookbooks get loaded in the chef-client
run.
Best practice is to namespace them in the hashes.
default['cookbookname']['possibly_even_recipe_name']['foo'] = "bar"
-s
On Thu, Oct 31, 2013 at 2:27 PM, Johnny Tan johnnydtan@gmail.com wrote:
Are all attribute files evaluated for all nodes in the same cookbook?
(Assuming no conditionals that would exclude.)
For some reason, we thought we could have different "role recipes" that
included different attribute files, rather than setting the attributes
inside the recipe. But it wasn't working, and this page seems to confirm
that all attribute files would be evaluated even if you're not
intentionally "including" them:
About Attributes
If that's the case, what's the best practice here? To only put default
values in any attributes file, and then set role differences inside role
recipes? (We're starting to move to role recipes, but we might have several
roles within the same cookbook, so we were hoping to set each role's
attributes with a different attributes file.)
Thanks,
johnny