- From: Peter Donald <
>
- To: Chef Dev <
>
- Subject: [chef-dev] Re: Re: Re: Re: Add "url" to depends/metadata ?
- Date: Fri, 16 Nov 2012 07:38:47 +1100
On Thu, Nov 15, 2012 at 6:42 PM, Kevin Nuckolls
<
>
wrote:
>
I've always thought that include_recipe is an anti-pattern if you're
>
including recipes outside of the cookbook you're in.
...
While I can see how you have got to the place you are currently at, it
is almost the exact opposite to where we are.
We started out using your approach but as roles are un-versioned or we
wanted more complex logic in resolving our attributes between
roles/environments/nodes we found ourselves engineered into a dead
end. Our roles now all include one recipe, the so called "role
recipe".
This role cookbook depends on all the cookbooks it uses and the role
recipe includes them in a particular order. This allows us to have
multiple versions of the role deployed. i.e. We could add a recipe to
the role in version 2 of the role cookbook and roll it out to the
development environment while version 1 is still present in the
integration/uat/staging/production environments.
When we want complex resolution rules around attributes we can also
put it in the role recipe rather than trying to navigate the attribute
precedence rules.
All in all. The only value that the roles structure in chef provides
us is the ability to identify top level cookbook/recipes that can be
safely applied to a node.
Here's an illustrative example...
--- roles/foo.rb ---
name "foo"
description "Foo Server"
run_list("recipe[mybiz-foo]")
----------------------
--- cookbooks/mybiz-foo/metadata.rb ---
...
depends "ntp"
depends "git"
depends "foo"
----------------------
--- cookbooks/mybiz-foo/recipes/default.rb ---
include_recipe "ntp"
include_recipe "git"
include_recipe "foo"
----------------------
>
Maintainer_repo as a url within the metadata.rb is a good idea. But I think
>
the depends statement should take a git/url parameter so the dependency
>
chain is more explicit and less reliant on context and naming.
That is actually fairly interesting to us. But rather than a git URL I
would prefer it to be a namespace that correlates to the namespace in
community site when/if that ever happens.
--
Cheers,
Peter Donald
Archive powered by MHonArc 2.6.16.