Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have been "playing" (well, child play really) with puppet for a few weeks now and cannot figure out how to implement a module which name is a client; this module would be invoked as such:

client { "client-name":
    "apache-node" => "name-of-apache-node",
    "tomcat-node" => "name-of-tomcat-node",
    "https" => true,
    # probably other parameters, and other nodes may be implied as well
}

and this would then automatically generate the configuration for all relevant nodes and distribute the configuration.

Note: I wish NOT to use external sources (LDAP or others), just puppet proper: I have a hard enough time with puppet alone and will consider this only when I have sufficient mastery (make that a few months, probably...).

Note 2: puppet is version 2.6.12, facter is version 1.5.9.

Is it possible, or is it a pipe dream?

share|improve this question

1 Answer 1

Sure, this should be workable.

First off, you'd need to either include it somewhere that it applies to both nodes, then filter out the configuration that needs to apply to the different nodes (probably with a big case statement), or else have different classes for the tomcat side of the app and the apache side (this would probably be cleaner).

Here's the approach I'd take:

Set up a multi-class module for your client application:

modules
 -> client-app
     -> manifests
         -> apache.pp
         -> tomcat.pp

Set up those classes with the config you need:

class client-app::apache ($tomcatnodes = undef, $https = true) {
    package { 'apache2':
        ensure => present,
    }
    # ... etc etc
    # use a template file that utilizes the $tomcatnodes and $https
    # variables to set the config that you need
}

Then attach those to your nodes:

node tomcatserver1 {
    class { 'client-app::tomcat':
        apachenode = 'apacheserver',
        https = true,
    }
}
node tomcatserver2 {
    class { 'client-app::tomcat':
        apachenode = 'apacheserver',
        https = true,
    }
}
node apacheserver {
    class { 'client-app::apache':
        tomcatnodes = [ 'tomcatserver1', 'tomcatserver2' ],
        https = true,
    }
}

Some further reading for you on this implementation: see here and here.

share|improve this answer
    
Hmm, interesting... Supplementary question: what if one Apache server acts as a frontend for several clients? –  fge Jan 12 '12 at 20:07

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.