[chef] Re: Re: Organizing cookbooks in a logical way


Chronological Thread 
  • From: Joseph Djomeda < >
  • To: chef < >
  • Subject: [chef] Re: Re: Organizing cookbooks in a logical way
  • Date: Tue, 04 Aug 2015 10:35:29 +0000

Hello Fabien,

Thanks for the answers provided. I am getting the sense of what you are saying. I am planing to have a webserver cookbook which will have nginx and apache cookbooks with specific recipes for each server (apache | nginx) and templates for all scenario, nginx proxy, nginx normal virtual host, apache normal hosting, mod_proxy http| ajp etc.
So I will maintain the attributes A.json and B.json for client A and B in some version control.

Now for a cluster of tomcat like say 10 nodes, I find it a bit difficult bootstraping them one of the other. Is there any bulk bootstraping (:D I am being lazy here) for :
a) nodes with same recipes
b) nodes with mixed recipes

Best Regards,

On Mon, Aug 3, 2015 at 11:36 PM Fabien Delpierre < "> > wrote:
So the real question is if this is a project A, so I should create a cookbook A which will use the the listed cookbooks above. Now project B is for client B and will need the same stack should this differentiation be at attributes level or cookbook level?

In general, cookbooks should be re-usable and as generic as possible. In your case, you can create a linuxsecurity cookbook (don't use underscores in cookbook names -- it'll work at first but can cause you grief later when you start creating resources, which is a more advanced topic), an nginx or apache2 cookbook, and a Wordpress or Joomla cookbook. Or instead of creating them, use a community cookbook, if available. You can use Berkshelf to make it easier to manage your dependencies.

Now this is where you have some options. If you foresee that a typical client deployment will be similar from one client to another, you could put together a simple, generic cookbook that includes the three cookbooks created earlier, and you can customize it for each client using environments.
Or, you can create specific cookbooks for each client, that will be mostly similar to the other option I just explained, but less reliant on environments, since you can store client-specific attributes in the attributes/ directory.
 
How to use the role in practice? For example where to map that nodes a.servers.com b.servers.com, c.servers.com are all linux, web server/nginx ?

In my opinion, don't use roles at all. But to answer your question, you don't need to do that mapping at all, you just bootstrap each node using Knife and assign a run list to each of them.

You might want to read this about how to avoid using Chef roles:
http://realityforge.org/code/2012/11/19/role-cookbooks-and-wrapper-cookbooks.html
Note that in the examples, they use node.override['foo']['bar'] but you shouldn't need to do that, just set attributes as you normally would, by adding attribute files to the attributes/ directory.

--
Joseph Kodjo-Kuma Djomeda
check out my pains at : www.mycodingpains.com
We become what we think about ourselves........



Archive powered by MHonArc 2.6.16.

§