[chef] Re: Strange issue with node attributes


Chronological Thread 
  • From: Zac Stevens < >
  • To:
  • Subject: [chef] Re: Strange issue with node attributes
  • Date: Tue, 29 Oct 2013 11:15:12 +0000

Hi Anand,

On Tue, Oct 29, 2013 at 12:37 AM, Anand < " target="_blank"> > wrote:
Hi All,
I'm running into an issue with node attributes and I'm not sure what I'm doing
wrong.

I wrote a wrapper cookbook to the Opscode openssh cookbook
(http://community.opscode.com/cookbooks/openssh). My wrapper is called
"test_openssh" and within it I have two recipes: "test_openssh::base"
 and "test_openssh::compute_node". The idea is that the attribute file for
"base" will set the sshd_config params for nodes that have test_openssh::base
in their run_list and nodes that have test_openssh::compute_node get the
sshd_config params in this recipe applied and not anything else. Below are the
contents of the two recipes and the associated attributes files:

The thing to note here is that attribute files are not associated with recipes.  You can have multiple attributes files, and they can have names like your recipes, but that doesn't affect whether they're loaded.  If your cookbook is loaded, Chef will always load the attributes from "default.rb" first, then load all of the remaining attributes files.  This documentation describes how to affect the order:


If you want some attributes to be set only for particular recipes, you'll need to set the attributes within those recipes.  Another approach is to have roles for "base" and "compute_node" which override attributes as required.


Zac




Archive powered by MHonArc 2.6.16.

§