[chef] Re: Actions taken when adding new nodes


Chronological Thread 
  • From: Aaron Abramson < >
  • To:
  • Subject: [chef] Re: Actions taken when adding new nodes
  • Date: Thu, 25 Aug 2011 09:57:30 -0500

I'm new to chef myself, so I hope I have this right... :)

If your recipe uses a search function, that search function is executed every 
time the recipe is run, thus whenever chef-client is executed on the node, 
the template using the search results will be updated.

Example: when using Amazon EC2, you have 2 instances with role "webserver" 
and once instance with role "load balancer" running HAProxy.   Since ec2 
instances are all referenced by dns names, and they can change, the HAproxy 
config uses a search function to find the internal DNS names for any nodes 
with role "webserver" and adds them to its loadbalancing pool.

Chef-client on the haproxy instance is configured to run in daemon mode every 
30 minutes (or via cron every 30 minutes), so if one of the webserver 
instances dies, and respawns with a new internal dns address, within 30 
minutes the haproxy config will be updated with the new address because the 
search is executed again.


On Aug 25, 2011, at 8:30 AM, 
< >
 wrote:

> I see that Chef has a feature where a node recipe can take actions based on
> searching, for example, for all existing nodes that have a particular role, 
> say
> XX. If a node with role XX is then added or removed, the value of the search
> will then be different. Is there some mechanism that will cause the code 
> that
> did the search to be run again? If so, what is the mechanism and are there 
> any
> potential pitfalls when using it?




Archive powered by MHonArc 2.6.16.

§