[chef] Re: Re: Re: Object-Oriented Chef


Chronological Thread 
  • From: Tensibai < >
  • To:
  • Subject: [chef] Re: Re: Re: Object-Oriented Chef
  • Date: Thu, 17 Sep 2015 10:11:58 +0200

 In fact, when starting out with Chef a couple of months ago, I was very surprised to find that cookbooks could not nest arbitrarily.

Usually when I ear that, I've the reaction "You're doing it wrong".

If you need arbitrary nesting of cookbooks, than you're not anymore describing a state but the steps to get to this state.

If you use Chef to replace scripts and run it only on-demand I see why you're looking for this, but IMHO you're using the wrong tool in this case as Chef is aimed to be run periodically to enforce a state, so you should avoid nested steps.

There's some case where a "dual run" is needed as you can't do the whole state in one pass, in this case my usual way is to set a tag on node on the first pass, skip what has to be skipped on the first pass when the tag is absent, and use a execute resource to schedule the next run in 1 min or more, depending on the use case.

I do this to provision mysql clusters, I can't tell who the replication partner will be before it's up, so I schedule a new chef run every 2 mins until the partner is found in search and the initial replication is done.

This leave unused code in the long term run for those boxes, but it's better than looping within the run waiting the other box to get in (which may never be true if your vagrant driver provision sequentially as the vSphere plugin did before 1.0.2 for example)

This was my $.2 on the subject :)

 



Archive powered by MHonArc 2.6.16.

§