| | 1 | * Puppet Overview |
| | 2 | |
| | 3 | ** Puppet Master |
| | 4 | |
| | 5 | Most configuration files reside on the master host. |
| | 6 | |
| | 7 | *** File structure |
| | 8 | |
| | 9 | **** /etc/puppet |
| | 10 | |
| | 11 | {{{ |
| | 12 | 0 betelgeuse:/etc/puppet# ls -l |
| | 13 | total 44 |
| | 14 | -rw-r--r-- 1 root root 2479 2010-09-02 20:12 auth.conf |
| | 15 | drwxr-xr-x 4 root root 4096 2009-11-14 16:40 files |
| | 16 | -rw-r--r-- 1 root root 364 2010-09-02 20:12 fileserver.conf |
| | 17 | drwxr-xr-x 5 root root 4096 2010-09-02 20:12 manifests |
| | 18 | drwxr-xr-x 136 root root 4096 2010-09-04 20:52 modules |
| | 19 | drwxr-xr-x 2 root root 4096 2010-08-31 23:17 notes |
| | 20 | drwxr-xr-x 6 root root 4096 2009-12-23 23:36 old_modules |
| | 21 | -rw-r--r-- 1 root root 414 2010-08-08 20:34 puppet.conf |
| | 22 | -rw-r--r-- 1 root root 162 2010-04-26 16:02 puppet.conf.dpkg-dist |
| | 23 | drwxr-x--x 7 root root 4096 2009-06-28 20:11 ssl |
| | 24 | drwxr-xr-x 2 root root 4096 2010-06-25 16:11 templates |
| | 25 | 0 betelgeuse:/etc/puppet# |
| | 26 | }}} |
| | 27 | |
| | 28 | **** common.pp |
| | 29 | |
| | 30 | This file determines what to do with given domains. |
| | 31 | |
| | 32 | 0 betelgeuse:/etc/puppet/manifests# less common.pp |
| | 33 | |
| | 34 | # make sure all modules are available for use |
| | 35 | |
| | 36 | {{{ |
| | 37 | import "modules.pp" |
| | 38 | |
| | 39 | |
| | 40 | # 2009-10-13 - greg - Empty base node for all nodes to inherit. |
| | 41 | |
| | 42 | # Anything that all nodes should have will go here. |
| | 43 | |
| | 44 | node base { |
| | 45 | } |
| | 46 | }}} |
| | 47 | |
| | 48 | *What to do with specified domains.* |
| | 49 | {{{ |
| | 50 | case $domain { |
| | 51 | # "mayfirst.org": { import "mfpl/*" } |
| | 52 | "tachanka.org": { import "tachanka/nodes.pp" } |
| | 53 | # "rat.burntout.org": { import "rat.burntout/*" } |
| | 54 | } |
| | 55 | }}} |
| | 56 | |
| | 57 | This is a programming language that helps define the state of a given |
| | 58 | machine. |
| | 59 | |
| | 60 | **** /etc/puppet/manifest |
| | 61 | |
| | 62 | Manifest is the directory where the basic node configurations get |
| | 63 | stored. Manifests are all specific to the particular configuration. |
| | 64 | |
| | 65 | Create directories for each node type that will configure each node of |
| | 66 | this type. |
| | 67 | |
| | 68 | ***** ../manifest/mfpl/root.bashrc.pp |
| | 69 | {{{ |
| | 70 | #+BEGIN_CODE |
| | 71 | 0 betelgeuse:/etc/puppet/manifests/mfpl# less root.bashrc.pp |
| | 72 | class root_bashrc { |
| | 73 | file { "/root/.bashrc": |
| | 74 | owner => "root", |
| | 75 | group => "root", |
| | 76 | mode => 644, |
| | 77 | source => "puppet://betelgeuse.redetoile.net/files/mfpl/root.bashrc", |
| | 78 | ensure => present, |
| | 79 | } |
| | 80 | } |
| | 81 | }}} |
| | 82 | |
| | 83 | The puppet master offers a library of files to choose from. Above |
| | 84 | says, define the class root_bashrc and say that .bashrc should be read |
| | 85 | from the source. |
| | 86 | |
| | 87 | Files must end with '.pp'. |
| | 88 | |
| | 89 | ***** analyze-server.pp |
| | 90 | |
| | 91 | {{{ |
| | 92 | class analyze_server { |
| | 93 | $packagelist = [ "cron", "logrotate" ] |
| | 94 | package { |
| | 95 | $packagelist: |
| | 96 | ensure => installed |
| | 97 | } |
| | 98 | file { |
| | 99 | "/var/log/cpu-by-user": |
| | 100 | owner => "nobody", |
| | 101 | group => "nogroup", |
| | 102 | ensure => present, |
| | 103 | } |
| | 104 | file { |
| | 105 | "/etc/cron.d/mf-log-cpu-by-user": |
| | 106 | owner => "root", |
| | 107 | group => "root", |
| | 108 | mode => 644, |
| | 109 | source => "puppet://betelgeuse.redetoile.net/files/mfpl/analyze-server/cron.d/mf-log |
| | 110 | -cpu-by-user", |
| | 111 | ensure => present, |
| | 112 | } |
| | 113 | file { |
| | 114 | "/etc/logrotate.d/mf-log-cpu-by-user": |
| | 115 | |
| | 116 | }}} |
| | 117 | |
| | 118 | This file "not complete above" shows the general server analysis |
| | 119 | structure. |
| | 120 | |
| | 121 | |
| | 122 | **** Modules |
| | 123 | |
| | 124 | Puppet modules are specific types of actions that puppet can take. |
| | 125 | This is basically the api layer of puppet that can make generic |
| | 126 | installations. |
| | 127 | |
| | 128 | ***** Add on modules |
| | 129 | |
| | 130 | Apparently leftist hackers around the world have created a bunch of |
| | 131 | modules for using puppet. |
| | 132 | |
| | 133 | ** puppet |
| | 134 | |
| | 135 | On this server, the only real configuration issue is whether or not to |
| | 136 | communicate with the master. |
| | 137 | |
| | 138 | *** file structure |
| | 139 | {{{ |
| | 140 | 0 bernice:/etc/puppet# ls |
| | 141 | files puppet.conf puppet.conf~ |
| | 142 | 0 bernice:/etc/puppet# ls -l |
| | 143 | total 12 |
| | 144 | drwxr-xr-x 2 root root 4096 2009-01-07 20:17 files |
| | 145 | -rw-r--r-- 1 root root 234 2009-12-15 00:25 puppet.conf |
| | 146 | -rw-r--r-- 1 root root 202 2009-01-05 20:26 puppet.conf~ |
| | 147 | 0 bernice:/etc/puppet# less puppet.conf |
| | 148 | [main] |
| | 149 | logdir=/var/log/puppet |
| | 150 | vardir=/var/lib/puppet |
| | 151 | ssldir=/var/lib/puppet/ssl |
| | 152 | rundir=/var/run/puppet |
| | 153 | factpath=$vardir/lib/facter |
| | 154 | pluginsync=true |
| | 155 | server=betelgeuse.redetoile.net |
| | 156 | |
| | 157 | [puppetmasterd] |
| | 158 | templatedir=/var/lib/puppet/templates |
| | 159 | }}} |