diff options
-rw-r--r-- | files/client/puppet.conf | 22 | ||||
-rw-r--r-- | files/improvements/functions/slash_escape.rb | 6 | ||||
-rw-r--r-- | files/master/fileserver.conf | 31 | ||||
-rw-r--r-- | files/master/puppet.conf | 34 | ||||
-rw-r--r-- | manifests/init.pp | 122 |
5 files changed, 212 insertions, 3 deletions
diff --git a/files/client/puppet.conf b/files/client/puppet.conf new file mode 100644 index 0000000..307692e --- /dev/null +++ b/files/client/puppet.conf @@ -0,0 +1,22 @@ +[main] + logdir=/var/log/puppet + vardir=/var/lib/puppet + rundir=/var/run/puppet + + #ssldir=/var/lib/puppet/ssl + ssldir=/etc/puppet/ssl + + # Where 3rd party plugins and modules are installed + libdir = /var/lib/puppet/lib + + templatedir=/var/lib/puppet/templates + + # Turn plug-in synchronization on. + pluginsync = true + pluginsource = puppet://$server/plugins + factpath = $vardir/lib/facter + +[puppetd] + report=true + server=puppet.glei.ch + diff --git a/files/improvements/functions/slash_escape.rb b/files/improvements/functions/slash_escape.rb new file mode 100644 index 0000000..70cd892 --- /dev/null +++ b/files/improvements/functions/slash_escape.rb @@ -0,0 +1,6 @@ +# escape slashes in a String +module Puppet::Parser::Functions + newfunction(:slash_escape, :type => :rvalue) do |args| + args[0].gsub(/\//, '\\/') + end +end diff --git a/files/master/fileserver.conf b/files/master/fileserver.conf new file mode 100644 index 0000000..98f4ead --- /dev/null +++ b/files/master/fileserver.conf @@ -0,0 +1,31 @@ +# This file consists of arbitrarily named sections/modules +# defining where files are served from and to whom + +# Define a section 'files' +# Adapt the allow/deny settings to your needs. Order +# for allow/deny does not matter, allow always takes precedence +# over deny +#[files] +# path /var/lib/puppet/files +# allow *.example.com +# deny *.evil.example.com +# allow 192.168.0.0/24 +# +[dist] + path /var/lib/puppet/dist + allow 127.0.0.1 + allow *.euskal.internal + allow *.glei.ch + +[secfiles] + path /var/lib/puppet/secfiles + allow 127.0.0.1 + allow *.euskal.internal + allow *.glei.ch + +[modules] + allow 127.0.0.1 + allow *.glei.ch + allow *.euskal.internal +# path /var/lib/puppet/modules + diff --git a/files/master/puppet.conf b/files/master/puppet.conf new file mode 100644 index 0000000..cdd4178 --- /dev/null +++ b/files/master/puppet.conf @@ -0,0 +1,34 @@ +[main] + logdir=/var/log/puppet + vardir=/var/lib/puppet + rundir=/var/run/puppet + + #ssldir=/var/lib/puppet/ssl + ssldir=/etc/puppet/ssl + + # Where 3rd party plugins and modules are installed + libdir = /var/lib/puppet/lib + + templatedir=/var/lib/puppet/templates + + # Turn plug-in synchronization on. + pluginsync = true + pluginsource = puppet://$server/plugins + factpath = $vardir/lib/facter + +[puppetmasterd] + reportdir = $logdir/reports + storeconfigs=true + dbadapter=mysql + dbserver=localhost + dbuser=puppet + dbpassword=PcjS3d5pMdU,cR,v + dbsocket=/var/run/mysqld/mysqld.sock + + #reports=log + modulepath=/var/lib/puppet/modules_src + +[puppetd] + report=true + server=puppet.glei.ch + diff --git a/manifests/init.pp b/manifests/init.pp index b591518..2575121 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,9 +1,125 @@ -# modules/skeleton/manifests/init.pp - manage skeleton stuff +# modules/puppet/manifests/init.pp - manage puppet stuff # Copyright (C) 2007 admin@immerda.ch # -# modules_dir { "skeleton": } +# modules_dir { "puppet": } -class skeleton { +class puppet { + Package{'puppet': + name => 'puppet', + category => $operatingsystem ? { + gentoo: 'app-admin', + default => '', + }, + ensure => present, + } + + Package{'facter': + name => 'facter', + category => $operatingsystem ? { + gentoo: 'dev-ruby' + default => '', + }, + ensure => present, + } + + + Service{'puppet': + enable => true, + ensure => running, + require => Package[puppet], + } + + file {"$rubysitedir/puppet/parser/functions/": + ensure => directory, + owner => root, + group => 0, + mode => 744, + } + + file { 'slash_escape_function': + path => "$rubysitedir/puppet/parser/functions/slash_escape.rb", + ensure => file, + owner => 'root', + group => 0, + mode => 644, + source => "puppet://$server/puppet/improvements/functions/slash_escape.rb", + } + + file { 'puppet_patch_script': + path => "/root/puppet_install.sh", + ensure => absent, + } + + file { 'puppet_patch': + path => "/root/puppet_0.23.2-13.diff", + ensure => absent, + } + + file { 'puppet_patch2': + path => "/root/puppet_module_plugin_dirs.patch", + ensure => absent, + } +} + +class puppetmaster inherits puppet { + Service{'puppetmaster': + enable => true, + ensure => running, + require => Package[puppet], + } } + +puppet::config($source = ''){ + + $real_source = $source ? { + '' => 'puppet/client/puppet.conf' + default => $source, + } + + file { 'pupet_config': + path => '/etc/puppet/puppet.conf' + owner => root, + group => 0, + mode => 600, + source => $real_source, + notify => Service[puppet], + } +} + +puppet::masterconfig( + $puppetsource = '', + $fileserversource = '' +){ + + + $real_puppetsource = $puppetsource ? { + '' => 'puppet/master/puppet.conf' + default => $source, + } + + $real_fileserversource = $fileserversource ? { + '' => 'puppet/master/fileserver.conf' + default => $source, + } + + file { 'pupet_config': + path => '/etc/puppet/puppet.conf' + owner => root, + group => 0, + mode => 600, + source => $real_puppetsource, + notify => [Service[puppet],Service[puppetmaster], + } + file { 'fileserver_config': + path => '/etc/puppet/fileserver.conf' + owner => root, + group => 0, + mode => 600, + source => $real_fileserversource, + notify => [Service[puppet],Service[puppetmaster], + } +} + + |