diff options
author | mh <mh@immerda.ch> | 2008-05-29 16:15:40 +0000 |
---|---|---|
committer | mh <mh@immerda.ch> | 2008-05-29 16:15:40 +0000 |
commit | 56ec15e0d9e63749aff8f8e03614bd24e80632ad (patch) | |
tree | 159eaf5af9f1f741dbb257de2b53bb2a86d0c120 /manifests | |
parent | e6c656d503d8a7272d29f6191688520c43cf8fb8 (diff) |
merged from puzzle
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/init.pp | 88 | ||||
-rw-r--r-- | manifests/puppetmaster.pp | 132 | ||||
-rw-r--r-- | manifests/storeconfigs.pp | 5 |
3 files changed, 149 insertions, 76 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 7f1abd4..5707500 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,6 +1,10 @@ -# modules/puppet/manifests/init.pp - manage puppet stuff -# Copyright (C) 2007 admin@immerda.ch -# +# puppet module +# original by luke kanies +# http://github.com/lak +# adaapted by puzzel itc +# merged with immerda project group's +# solution +####################################### # modules_dir { "puppet": } @@ -21,17 +25,14 @@ class puppet { file { 'puppet_config': path => "$real_puppet_config", - owner => root, - group => 0, - mode => 600, source => [ "puppet://$server/files/puppet/client/${fqdn}/puppet.conf", "puppet://$server/files/puppet/client/puppet.conf.$operatingsystem", "puppet://$server/files/puppet/client/puppet.conf", "puppet://$server/puppet/client/puppet.conf.$operatingsystem", "puppet://$server/puppet/client/puppet.conf" ], notify => Service[puppet], + owner => root, group => 0, mode => 600; } - } class puppet::linux { @@ -50,14 +51,10 @@ class puppet::linux { require => Package[puppet], } - file{'/etc/cron.d/puppetd': - owner => root, - group => 0, - mode => 0644, - source => [ "puppet://$server/files/puppet/cron.d/puppetd", - "puppet://$server/puppet/cron.d/puppetd.$operatingsystem", - "puppet://$server/puppet/cron.d/puppetd" - ], + file{'/etc/cron.d/puppetd.cron': + source => [ "puppet://$server/puppet/cron.d/puppetd.${operatingsystem}", + "puppet://$server/puppet/cron.d/puppetd" ], + owner => root, group => 0, mode => 0644; } } class puppet::gentoo inherits puppet::linux { @@ -79,64 +76,3 @@ class puppet::openbsd { ensure => running, } } - -class puppetmaster inherits puppet { - case $kernel { - linux: { include puppetmaster::linux } - } - File[puppet_config]{ - source => [ "puppet://$server/files/puppet/master/puppet.conf", - "puppet://$server/puppet/master/puppet.conf" ], - notify => [Service[puppet],Service[puppetmaster] ], - } - - $real_puppet_fileserverconfig = $puppet_fileserverconfig ? { - '' => "/etc/puppet/fileserver.conf", - default => $puppet_fileserverconfig, - } - - file { "$real_puppet_fileserverconfig": - owner => root, - group => 0, - mode => 600, - source => [ "puppet://$server/files/puppet/master/fileserver.conf", - "puppet://$server/puppet/master/fileserver.conf" ], - notify => [Service[puppet],Service[puppetmaster] ], - } -} - -class puppetmaster::linux inherits puppet::linux { - service{'puppetmaster': - ensure => running, - require => Package[puppet], - } - - - Service[puppet]{ - require +> Service[puppetmaster], - } - -} - -class puppetmaster::cluster inherits puppetmaster { - include mongrel, nginx - - Service[puppetmaster]{ - require +> Service[ngnix], - } - - File[puppet_config] { - require => [ Package[mongrel], Package[nginx], File[nginx_config] ], - } - - file{"/etc/init.d/puppetmaster": - source => [ "puppet://$server/files/puppet/cluster/init.d/puppetmaster-${fqdn}", - "puppet://$server/puppet/cluster/init.d/puppetmaster.${operatingsystem}", - "puppet://$server/puppet/cluster/init.d/puppetmaster" ], - owner => root, - group => 0, - mode => 0755, - require => [ Package[puppet], Package[mongrel], Package[nginx], File[nginx_config] ], - notify => Service[puppetmaster], - } -} diff --git a/manifests/puppetmaster.pp b/manifests/puppetmaster.pp new file mode 100644 index 0000000..821cb80 --- /dev/null +++ b/manifests/puppetmaster.pp @@ -0,0 +1,132 @@ +# manifests/puppetmaster.pp + +import "storeconfigs.pp" + +class puppet::puppetmaster inherits puppet { + case $operatingsystem { + centos,debian, redhat: { include puppet::puppetmaster::package } + default: { + case $kernel { + linux: { include puppet::puppetmaster::linux } + } + } + } + + File[puppet_config]{ + source => [ "puppet://$server/files/puppet/master/puppet.conf", + "puppet://$server/puppet/master/puppet.conf" ], + notify => [Service[puppet],Service[puppetmaster] ], + } + + $real_puppet_fileserverconfig = $puppet_fileserverconfig ? { + '' => "/etc/puppet/fileserver.conf", + default => $puppet_fileserverconfig, + } + + file { "$real_puppet_fileserverconfig": + source => [ "puppet://$server/files/puppet/master/fileserver.conf", + "puppet://$server/puppet/master/fileserver.conf" ], + notify => [Service[puppet],Service[puppetmaster] ], + owner => root, group => 0, mode => 600; + } + + if $puppetmaster_storeconfigs { + include puppet::puppetmaster::storeconfigs + } + + # restart the master from time to time to avoid memory problems + file{'/etc/cron.d/puppetmaster.cron': + source => [ "puppet://$server/puppet/cron.d/puppetmaster.${operatingsystem}", + "puppet://$server/puppet/cron.d/puppetmaster" ], + owner => root, group => 0, mode => 0644; + } +} + +class puppet::puppetmaster::linux inherits puppet::linux { + + service{'puppetmaster': + ensure => running, + enable => true, + require => [ Package[puppet] ], + } + + Service[puppet]{ + require +> Service[puppetmaster], + } +} + +class puppet::puppetmaster::package inherits puppet::puppetmaster::linux { + package { puppet-server: ensure => present } + + Service[puppetmaster]{ + require +> Package[puppet-server], + } +} + +class puppet::puppetmaster::cluster inherits puppet::puppetmaster { + include mongrel, nginx + + Service[puppetmaster]{ + require +> Service[ngnix], + } + + File[puppet_config] { + require => [ Package[mongrel], Package[nginx], File[nginx_config] ], + } + + case $operatingsystem { + gentoo, centos: { + file{"/etc/init.d/puppetmaster": + source => "puppet://$server/puppet/init.d/puppetmaster.${operatingsystem}", + owner => root, group => 0, mode => 0755; + } + } + } +} + +define puppet::puppetmaster::hasdb( + $dbtype = 'mysql', + $dbname = 'puppet', + $dbhost = 'localhost', + # this is needed due to the collection of the databases + $dbhostfqdn = "${fqdn}", + $dbuser = 'puppet', + $dbpwd = $puppet_storeconfig_password, + $dbconnectinghost = 'locahost' +){ + + case $puppet_storeconfig_password { + '': { fail("No \$puppet_storeconfig_password is set, please set it in your manifests or site.pp to add a password") } + } + + case $dbtype { + 'mysql': { puppet::puppetmaster::hasdb::mysql{$name: dbname => $dbname, dbhost => $dbhost, dbuser => $dbuser, dbpwd => $dbpwd, } } + } +} + +# don't use this define use the general interface +define puppet::puppetmaster::hasdb::mysql( + $dbname = 'puppet', + $dbhost = 'localhost', + $dbhostfqdn = "${fqdn}", + $dbuser = 'puppet', + $dbpwd, + $dbconnectinghost = 'locahost' +){ + @@mysql_database{$dbname: + tag => "mysql_${dbhostfqdn}", + } + + @@mysql_user{"${dbuser}@$${dbconnectinghost}": + password_hash => mysql_password("$dbpwd"), + require => Mysql_database[$dbname], + tag => "mysql_${dbhostfqdn}", + } + + + @@mysql_grant{"${dbuser}@$${dbconnectinghost}/${dbname}": + privileges => all, + require => Mysql_user['munin@localhost'], + tag => "mysql_${dbhostfqdn}", + } +} diff --git a/manifests/storeconfigs.pp b/manifests/storeconfigs.pp new file mode 100644 index 0000000..32aaa7f --- /dev/null +++ b/manifests/storeconfigs.pp @@ -0,0 +1,5 @@ +# This class sets up the necessary ActiveRecord bits +# so storeconfigs works. +class puppet::puppetmaster::storeconfigs { + include rails +} |