[chef] Re: Re: include recipe twice


Chronological Thread 
  • From: Zac Stevens < >
  • To:
  • Subject: [chef] Re: Re: include recipe twice
  • Date: Fri, 22 Nov 2013 09:17:04 +0000

On Fri, Nov 22, 2013 at 8:54 AM, Mrigesh Priyadarshi < " target="_blank"> > wrote:
That is limitation of include recipe (http://docs.opscode.com/chef/dsl_recipe.html).

If a recipe is included more than once in a recipe, only the first inclusion will be processed and any subsequent inclusion will be ignored. For work around, you can create directly call the part you want  to execute from your Foo::bar by putting that part in the calling recipe and putting a depend option in metadata.

It's not a limitation - it's a feature.  "include_recipe" lets you ensure that some resources have been included in your Chef run.  It is especially useful when you have a recipe containing common resources, that many other of your recipes depend upon - each can call include_recipe, and you will be confident that the dependencies will always included at the right time - no matter which recipe, or combination of recipes, you are using).

If you need a recipe to "run" more than once, you probably want to use a Definition[1] or an LWRP[2].


Zac





Archive powered by MHonArc 2.6.16.

§