wiki:puppet_notes_12_11_2010
  • Puppet Overview

Puppet Master

Most configuration files reside on the master host.

* File structure

/etc/puppet

0 betelgeuse:/etc/puppet# ls -l
total 44
-rw-r--r--   1 root root 2479 2010-09-02 20:12 auth.conf
drwxr-xr-x   4 root root 4096 2009-11-14 16:40 files
-rw-r--r--   1 root root  364 2010-09-02 20:12 fileserver.conf
drwxr-xr-x   5 root root 4096 2010-09-02 20:12 manifests
drwxr-xr-x 136 root root 4096 2010-09-04 20:52 modules
drwxr-xr-x   2 root root 4096 2010-08-31 23:17 notes
drwxr-xr-x   6 root root 4096 2009-12-23 23:36 old_modules
-rw-r--r--   1 root root  414 2010-08-08 20:34 puppet.conf
-rw-r--r--   1 root root  162 2010-04-26 16:02 puppet.conf.dpkg-dist
drwxr-x--x   7 root root 4096 2009-06-28 20:11 ssl
drwxr-xr-x   2 root root 4096 2010-06-25 16:11 templates
0 betelgeuse:/etc/puppet# 

common.pp

This file determines what to do with given domains.

0 betelgeuse:/etc/puppet/manifests# less common.pp

# make sure all modules are available for use

import "modules.pp"


# 2009-10-13 - greg - Empty base node for all nodes to inherit.

# Anything that all nodes should have will go here.

node base {
}

*What to do with specified domains.*

case $domain {
#  "mayfirst.org": { import "mfpl/*" } 
  "tachanka.org": { import "tachanka/nodes.pp" }
#  "rat.burntout.org": { import "rat.burntout/*" }
}

This is a programming language that helps define the state of a given machine.

/etc/puppet/manifest

Manifest is the directory where the basic node configurations get stored. Manifests are all specific to the particular configuration.

Create directories for each node type that will configure each node of this type.

* ../manifest/mfpl/root.bashrc.pp

#+BEGIN_CODE
0 betelgeuse:/etc/puppet/manifests/mfpl# less root.bashrc.pp                              
class root_bashrc {                                                                       
  file { "/root/.bashrc":                                                                 
    owner => "root",                                                                      
    group => "root",                                                                      
    mode => 644,                                                                          
    source => "puppet://betelgeuse.redetoile.net/files/mfpl/root.bashrc",                 
    ensure => present,                                                                    
  }                                                                                       
}           

The puppet master offers a library of files to choose from. Above says, define the class root_bashrc and say that .bashrc should be read from the source.

Files must end with '.pp'.

* analyze-server.pp

class analyze_server {                                                                    
  $packagelist = [ "cron", "logrotate" ]                                                  
  package {                                                                               
    $packagelist:                                                                         
      ensure => installed                                                                 
  }                                                                                       
  file {                                                                                  
    "/var/log/cpu-by-user":                                                               
      owner => "nobody",                                                                  
      group => "nogroup",                                                                 
      ensure => present,                                                                  
  }                                                                                       
  file {                                                                                  
    "/etc/cron.d/mf-log-cpu-by-user":                                                     
      owner => "root",                                                                    
      group => "root",                                                                    
      mode => 644,                                                                        
      source => "puppet://betelgeuse.redetoile.net/files/mfpl/analyze-server/cron.d/mf-log
-cpu-by-user",                                                                            
      ensure => present,
  }
  file {
    "/etc/logrotate.d/mf-log-cpu-by-user":

This file "not complete above" shows the general server analysis structure.

Modules

Puppet modules are specific types of actions that puppet can take. This is basically the api layer of puppet that can make generic installations.

* Add on modules

Apparently leftist hackers around the world have created a bunch of modules for using puppet.

puppet

On this server, the only real configuration issue is whether or not to communicate with the master.

* file structure

0 bernice:/etc/puppet# ls
files  puppet.conf  puppet.conf~
0 bernice:/etc/puppet# ls -l
total 12
drwxr-xr-x 2 root root 4096 2009-01-07 20:17 files
-rw-r--r-- 1 root root  234 2009-12-15 00:25 puppet.conf
-rw-r--r-- 1 root root  202 2009-01-05 20:26 puppet.conf~
0 bernice:/etc/puppet# less puppet.conf
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
pluginsync=true
server=betelgeuse.redetoile.net

[puppetmasterd]
templatedir=/var/lib/puppet/templates
Last modified 9 years ago Last modified on Dec 15, 2010, 8:31:24 PM