Ask Your Question

Master site.pp best practices

asked 2014-04-25 14:26:45 -0500

kwhite gravatar image

I'm getting closer to fully deploying puppet and now that I'm rounding out all the modules my organization is going to be using I'm looking into best practices on using the puppet masters site.pp.

I wanted to originally build out separate modules for each server we have and name each module after the customer that owns the server, but now I'm seeing that best practices say not to include classes from modules in different modules.

Basically, I have a Base module and an application module. I have CustomerA and CustomerB, I wanted to create a CustomerA and CustomerB module and reference the base and application module from these, that way I can keep the site.pp cleaner and really differentiate between each customer.

I'm curious how large everyone's site.pp is (I'm deploying first to 20-30 nodes, but later to 300+ nodes). I'm also wondering if my above plan would work out or if I should just be declaring these all within the node declarations in the site.pp?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-04-25 17:36:58 -0500

spuder gravatar image

updated 2014-04-27 18:13:25 -0500

While you can include other files from the site.pp, this functionality is deprecated in 3.5 and likely will be removed in 4.0

At my company, the site.pp just consists of an include to the nodes.pp file which has 1 line for every node

cat site.pp
import 'nodes.pp'
filebucket { 'main':
        path   => false,
        server => '',

File { backup => main, }

nodes file

cat nodes.pp | head -n2 
## Debian / Ubuntu Nodes
node "" { include foo_ldap,foo_snmpd_debian}

The solution that you are suggesting sounds like the best option to me. Create a simple customer specific module and include it on the node

node "customerA" { include base, include customer_a_config}
node "customerB" { include base, include customer_b_config}

If the configuration between customers is simple, you could create 1 configuration module that implements parameterized classes. Then just pass variables to the module.

node "customerA" { include base, 
  class { '::customer_config': 
    mysql.conf => 'foo' 

Note, if you have a lot of nodes, I would highly recommend looking into an external node classifier (enc) such as the foreman. Also, katello looks like a great option if you use centos based nodes, as it integrates with pulp.

edit flag offensive delete link more


+1 for ENC. You will NOT be happy managing hundreds of nodes in a text file.

lavaman gravatar imagelavaman ( 2014-04-25 18:05:41 -0500 )edit

answered 2014-04-26 09:39:04 -0500

t0m gravatar image

A combination of the roles+profiles pattern and hiera data is probably what you want here.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-04-25 14:26:45 -0500

Seen: 1,165 times

Last updated: Apr 27 '14