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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm reading the latest puppet book, and it breaks things down into modules which is nice.

In one example, they created a module for SSH, so:

/modules/ssh/{files, manifests, ...}

Then you can include that module to your node classes.

My question is, for a live production puppet config, this basically means you will have a lot of modules correct? I mean if you create one for ssh, the list is going to be pretty long wouldn't you say?

I need: nginx, ssh, mysql, phusion passenger, etc. etc.

Those are the major components, but if I write a module for each service I need, the list I think will get long.

On the other hand, ssh already comes setup with Ubuntu, so maybe the example in the book was a little contrived just to teach the idea behind modules?

share|improve this question

Here is one way to do it..

You basically have a default node which includes everything all servers should do.. Then you can even have a production node that inherits default and includes everything production servers need. Then you have your node which inherits production in your site.pp

So for example

node default {
    include linux
    include ssh::install
node prod inherits default {
    include postfix::relay
node inherits prod {
    include apache::install

So my node will include

share|improve this answer
Use composite classes instead of inheriting node. – Nan Liu Jun 1 '11 at 22:53

Well, turn that question on its head. If you don't use modules, where are you going to put all your configuration?

Let's take, for example, ssh. Indeed, ssh comes installed on pretty much any modern Unix, however...

  • Do you have each server's ssh key on /etc/ssh/ssh_known_keys?
  • Is your /etc/ssh/ssh_known_keys readable by all?

The answer is no on both counts for Ubuntu and no on the first count for any system. The ssh module I use (and which I got from github) takes care of copying each server's key to the known keys of every other server.

Now, to get that, I just need an include ssh::server. Isn't that much easier than having the whole configuration on each server?

The other aspect to consider is that a module can include other modules, and so on. And you can have classes and definitions not inside any module also including them.

For example, a typical node of mine has just a few lines like these:

include linux-server
include agencia

Where linux-server has everything that is required of standard linux servers (with lots of conditionals to handle stuff like virtual servers vs physical servers), and agencia is a template for one particular application, including configuration for apache, php, drupal, exported configurations for nginx and varnish, etc.

share|improve this answer

Your Answer


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.