[chef] Re: Re: Dynamically building attributes (ie. via search) for cross-service, cross-node configuration


Chronological Thread 
  • From: Charles Duffy < >
  • To:
  • Subject: [chef] Re: Re: Dynamically building attributes (ie. via search) for cross-service, cross-node configuration
  • Date: Tue, 28 Dec 2010 14:01:35 -0600

Thanks -- that's exactly what I was looking for.

The remaining piece is ensuring that the shorewall recipe is in the run_list *after* anything/everything which might update the attributes it uses.

It would be nice if there a way to do that automatically ("include_later"?), but worst-case I should be able to hack something together myself.

On Tue, Dec 28, 2010 at 12:52 PM, Joshua Timberman < "> > wrote:
Hello!

On Tue, Dec 28, 2010 at 9:25 AM, Charles Duffy < "> > wrote:
> How can I build up a description of my firewall rules using knowledge of the
> other nodes' configuration, and ensure that this information is available
> when the templates are applied?

We recommend using the attributes files in the cookbook simply for
setting default values.

default[:shorewall][:rules] = []

So they don't cause nil errors when accessed elsewhere.

Then you can use the recipe to do a search, generate the rules as
hashes (per your code example, but assign to generated_rules), then
something like:

node.set[:shorewall][:rules] = generated_rules

Near the end.

--
Opscode, Inc
Joshua Timberman, Technical Evangelist
IRC, Skype, Twitter, Github: jtimberman




Archive powered by MHonArc 2.6.16.

§