- From: Fabien Delpierre <
>
- To: chef <
>
- Subject: [chef] Re: Chef Naming conventions
- Date: Fri, 20 Mar 2015 14:12:32 -0400
Chef doesn't force you to do this kind of thing one way or another. You should aim to write recipes that can be applied to as many systems as possible, and the way Chef is designed can help a lot with that, but it's not always possible. Certainly the differences between OSX and RHEL can warrant having separate recipes, even just for the sake of clarity.
You could just have a single recipe that does something like this (and this isn't real code obviously):
case 'os'
when 'osx'
do a and b
when 'rhel'
do c and d
end
do more things that work regardless of the OS
Or you can do something like this in the default recipe:
do foo # this works regardless of the OS
do bar # and so does this
include_recipe "mycookbook::#{node['os']}"and have a recipe for each OS type you wish your cookbook to support.
https://github.com/L2G/timezone-ii/blob/master/recipes/default.rb is an example of the latter.
- [chef] Exposing attributes from cookbooks you depend on, Hajducko, Steven, 03/19/2015
- [chef] Re: Exposing attributes from cookbooks you depend on, Lamont Granquist, 03/19/2015
- [chef] Re: Exposing attributes from cookbooks you depend on, Hajducko, Steven, 03/19/2015
- [chef] Re: Exposing attributes from cookbooks you depend on, Lamont Granquist, 03/19/2015
- [chef] Re: Re: Exposing attributes from cookbooks you depend on, Torben Knerr, 03/20/2015
- [chef] Re: Re: Re: Exposing attributes from cookbooks you depend on, Lamont Granquist, 03/20/2015
- [chef] Re: Re: Re: Exposing attributes from cookbooks you depend on, Hajducko, Steven, 03/20/2015
- [chef] Re: Re: Re: Exposing attributes from cookbooks you depend on, Lamont Granquist, 03/20/2015
- [chef] Chef Naming conventions, michael david mosier, 03/20/2015
- [chef] Re: Chef Naming conventions, Kent Perrier, 03/20/2015
- [chef] Re: Chef Naming conventions, Fabien Delpierre, 03/20/2015
- [chef] Re: Chef Naming conventions, Ranjib Dey, 03/20/2015
- [chef] chef-client and error handlers, michael david mosier, 03/23/2015
- [chef] Re: chef-client and error handlers, Tensibai, 03/23/2015
- [chef] Re: chef-client and error handlers, Mike, 03/23/2015
- [chef] Re: chef-client and error handlers, Ranjib Dey, 03/23/2015
- [chef] Re: Re: Re: Re: Exposing attributes from cookbooks you depend on, Julian C. Dunn, 03/20/2015
- [chef] Re: Re: Re: Re: Re: Exposing attributes from cookbooks you depend on, Torben Knerr, 03/21/2015
- [chef] Re: Re: Re: Re: Re: Exposing attributes from cookbooks you depend on, Torben Knerr, 03/21/2015
- [chef] Re: Re: Re: Re: Re: Exposing attributes from cookbooks you depend on, Torben Knerr, 03/21/2015
Archive powered by MHonArc 2.6.16.