Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

If i have a a software system that has a lot of dependencies on other libraries, like libssl, or libxml etc, should I be creating separate cookbooks for each of these libraries (with a recipe that really only has like 2 lines) or do people do several 'package' blocks in a cookbook to ensure the dependencies are there (and not split out these package blocks to their external cookbooks)?

share|improve this question
2  
Libraries can be a part of the software cookbook itself. ( Eg: libxml, libssl ). There are 100s of libraries and creating a cookbook for each of them doesn't make sense and is not practical. – CS3 Apr 24 '12 at 15:38
Right, that's what i thought. thanks! – Josh Nankin Apr 24 '12 at 15:42

2 Answers

As CS3 said it really isn't practical to have hundreds of cookbooks just to end up installing one application. Chef actually uses your system's package manager and can automatically resolve the dependencies for you.

The only reason you would want to split off a dependency is if you have some specific configuration items that may change across systems, or may vary based on the package that depends on it.

share|improve this answer

If you only need to install package dependecies, you can do something simple like this:

%w{ package1 package2 package3 }.each do |pkg|
  package pkg
end

Or you can even create an attribute and iterate through those.

attributes/default.rb:

default['app']['deps'] = [ "package1", "package2" ]

recipes/deps.rb:

node['app']['deps'].each do |pkg|
  package pkg
end

The second way will allow you to update the package list via overrides.

You can even add this to a seperate recipe in your cookbook that you can add to the bootstrap run_list, or the application role.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.