diff options
author | mh <mh@immerda.ch> | 2012-06-05 18:59:39 -0300 |
---|---|---|
committer | mh <mh@immerda.ch> | 2012-06-08 13:09:47 -0300 |
commit | 09c8eaf304d1075980d8d9143545f2f16a1db34d (patch) | |
tree | 57ab2c761e74eb95f873b72a109c2a620656469b /manifests/master | |
parent | af97bf0e96167e916e36110eb858f257ccf083e6 (diff) |
new style for 2.7
Diffstat (limited to 'manifests/master')
-rw-r--r-- | manifests/master/base.pp | 31 | ||||
-rw-r--r-- | manifests/master/centos.pp | 12 | ||||
-rw-r--r-- | manifests/master/checklastrun.pp | 25 | ||||
-rw-r--r-- | manifests/master/checklastrun/disable.pp | 12 | ||||
-rw-r--r-- | manifests/master/cleanup_reports.pp | 7 | ||||
-rw-r--r-- | manifests/master/cleanup_reports/disable.pp | 6 | ||||
-rw-r--r-- | manifests/master/cluster.pp | 5 | ||||
-rw-r--r-- | manifests/master/cluster/base.pp | 9 | ||||
-rw-r--r-- | manifests/master/debian.pp | 19 | ||||
-rw-r--r-- | manifests/master/hasdb.pp | 17 | ||||
-rw-r--r-- | manifests/master/hasdb/mysql.pp | 32 | ||||
-rw-r--r-- | manifests/master/linux.pp | 18 | ||||
-rw-r--r-- | manifests/master/munin.pp | 9 | ||||
-rw-r--r-- | manifests/master/package.pp | 9 | ||||
-rw-r--r-- | manifests/master/package/base.pp | 10 | ||||
-rw-r--r-- | manifests/master/package/centos.pp | 7 | ||||
-rw-r--r-- | manifests/master/package/debian.pp | 10 | ||||
-rw-r--r-- | manifests/master/passenger.pp | 20 | ||||
-rw-r--r-- | manifests/master/storeconfigs.pp | 8 |
19 files changed, 266 insertions, 0 deletions
diff --git a/manifests/master/base.pp b/manifests/master/base.pp new file mode 100644 index 0000000..80fe8e0 --- /dev/null +++ b/manifests/master/base.pp @@ -0,0 +1,31 @@ +class puppet::master::base inherits puppet::base { + + file { $puppet::master::fileserverconfig: + source => [ "puppet:///modules/site_puppet/master/${::fqdn}/fileserver.conf", + "puppet:///modules/site_puppet/master/fileserver.conf", + "puppet:///modules/puppet/master/fileserver.conf" ], + owner => root, group => puppet, mode => 640; + } + + if $puppet::master::storeconfigs { + include puppet::master::storeconfigs + } + + + if $puppet::master::mode == 'passenger' { + include puppet::master::passenger + File[$puppet::master::fileserverconfig]{ + notify => Exec['notify_passenger_puppetmaster'], + } + File[puppet_config]{ + notify => Exec['notify_passenger_puppetmaster'], + } + } else { + File[$puppet::master::fileserverconfig]{ + notify => Service[puppetmaster], + } + File[puppet_config]{ + notify => Service[puppetmaster], + } + } +} diff --git a/manifests/master/centos.pp b/manifests/master/centos.pp new file mode 100644 index 0000000..82a8436 --- /dev/null +++ b/manifests/master/centos.pp @@ -0,0 +1,12 @@ +# manifests/puppetmaster/centos.pp +class puppet::master::centos inherits puppet::master::package { + + file { '/etc/sysconfig/puppetmaster': + source => [ "puppet:///modules/site_puppet/sysconfig/${::fqdn}/puppetmaster", + "puppet:///modules/site_puppet/sysconfig/${::domain}/puppetmaster", + "puppet:///modules/site_puppet/sysconfig/puppetmaster", + "puppet:///modules/puppet/sysconfig/puppetmaster" ], + notify => Service[puppetmaster], + owner => root, group => 0, mode => 0644; + } +} diff --git a/manifests/master/checklastrun.pp b/manifests/master/checklastrun.pp new file mode 100644 index 0000000..bde5a97 --- /dev/null +++ b/manifests/master/checklastrun.pp @@ -0,0 +1,25 @@ +class puppet::master::checklastrun { + + $puppet_lastruncheck_ignorehosts_str = $puppet::master::lastruncheck_ignorehosts ? { + '' => '', + undef => '', + default => "--ignore-hosts ${puppet::master::lastruncheck_ignorehosts}" + } + + $puppet_lastruncheck_timeout_str = $puppet::master::lastruncheck_timeout ? { + '' => '', + undef => '', + default => "--timeout ${puppet::master::lastruncheck_timeout}" + } + + file{ + '/usr/local/sbin/puppetlast': + source => [ "puppet:///modules/puppet/master/lastruncheck" ], + owner => root, group => 0, mode => 0700; + + '/etc/cron.d/puppetlast.cron': + content => "${puppetmaster_lastruncheck_cron} root /usr/local/sbin/puppetlast ${puppet_lastruncheck_timeout_str} ${puppet_lastruncheck_ignorehosts_str} ${puppet::master::lastruncheck_additionaloptions}\n", + require => File["/usr/local/sbin/puppetlast"], + owner => root, group => 0, mode => 0644, + } +} diff --git a/manifests/master/checklastrun/disable.pp b/manifests/master/checklastrun/disable.pp new file mode 100644 index 0000000..655253d --- /dev/null +++ b/manifests/master/checklastrun/disable.pp @@ -0,0 +1,12 @@ +class puppet::master::checklastrun::disable inherits puppet::master::checklastrun { + + File['/usr/local/sbin/puppetlast']{ + source => undef, + ensure => absent, + } + + File['/etc/cron.d/puppetlast.cron']{ + ensure => absent, + } +} + diff --git a/manifests/master/cleanup_reports.pp b/manifests/master/cleanup_reports.pp new file mode 100644 index 0000000..98cb81a --- /dev/null +++ b/manifests/master/cleanup_reports.pp @@ -0,0 +1,7 @@ +class puppet::master::cleanup_reports { + # clean up reports older than $puppetmaster_cleanup_reports days + file { '/etc/cron.daily/puppet_reports_cleanup.sh': + content => "#!/bin/bash\nfind ${puppet::master::reports_dir} -maxdepth 2 -type f -ctime +${puppet::master::cleanup_reports} -exec rm {} \\;\n", + owner => root, group => 0, mode => 0700; + } +} diff --git a/manifests/master/cleanup_reports/disable.pp b/manifests/master/cleanup_reports/disable.pp new file mode 100644 index 0000000..e93e72a --- /dev/null +++ b/manifests/master/cleanup_reports/disable.pp @@ -0,0 +1,6 @@ +class puppet::master::cleanup_reports::disable inherits puppet::master::cleanup_reports { + + File['/etc/cron.daily/puppet_reports_cleanup.sh']{ + ensure => absent, + } +} diff --git a/manifests/master/cluster.pp b/manifests/master/cluster.pp new file mode 100644 index 0000000..d6aa4fd --- /dev/null +++ b/manifests/master/cluster.pp @@ -0,0 +1,5 @@ +class puppet::master::cluster inherits puppet::master { + + include puppet::master::cluster::base + +} diff --git a/manifests/master/cluster/base.pp b/manifests/master/cluster/base.pp new file mode 100644 index 0000000..cad0d7d --- /dev/null +++ b/manifests/master/cluster/base.pp @@ -0,0 +1,9 @@ +class puppet::master::cluster::base inherits puppet::master::base { + + include mongrel, nginx + + File[puppet_config] { + require +> [ Package[mongrel], Package[nginx], File[nginx_config] ], + } +} + diff --git a/manifests/master/debian.pp b/manifests/master/debian.pp new file mode 100644 index 0000000..f51a319 --- /dev/null +++ b/manifests/master/debian.pp @@ -0,0 +1,19 @@ +class puppet::master::debian inherits puppet::master::package { + + if $puppet::master::mode != 'passenger' { + case $::lsbdistcodename { + squeeze,sid: { + Service['puppetmaster'] { hasstatus => true, hasrestart => true } + } + } + } + + file { '/etc/default/puppetmaster': + source => [ "puppet:///modules/site_puppet/master/debian/${::fqdn}/puppetmaster", + "puppet:///modules/site_puppet/master/debian/${::domain}/puppetmaster", + "puppet:///modules/site_puppet/master/debian/puppetmaster", + "puppet:///modules/puppet/master/debian/puppetmaster" ], + notify => Service[puppetmaster], + owner => root, group => 0, mode => 0644; + } +} diff --git a/manifests/master/hasdb.pp b/manifests/master/hasdb.pp new file mode 100644 index 0000000..d3bf388 --- /dev/null +++ b/manifests/master/hasdb.pp @@ -0,0 +1,17 @@ +define puppet::master::hasdb ( + $dbtype = 'mysql', + $dbname = 'puppet', + $dbhost = 'localhost', + # this is needed due to the collection of the databases + $dbhostfqdn = $::fqdn, + $dbuser = 'puppet', + $dbpwd = hiera('puppet_master_storeconfigs_password',false), + $dbconnectinghost = 'locahost' +) { + + if !$dbpwd { fail("No \$puppet_master_storeconfig_password is set, please set it in your hiera database") } + + case $dbtype { + 'mysql': { puppet::master::hasdb::mysql{$name: dbname => $dbname, dbhost => $dbhost, dbuser => $dbuser, dbpwd => $dbpwd, } } + } +} diff --git a/manifests/master/hasdb/mysql.pp b/manifests/master/hasdb/mysql.pp new file mode 100644 index 0000000..bc15756 --- /dev/null +++ b/manifests/master/hasdb/mysql.pp @@ -0,0 +1,32 @@ +# don't use this define use the general interface +define puppet::master::hasdb::mysql ( + $dbname = 'puppet', + $dbhost = 'localhost', + $dbhostfqdn = $::fqdn, + $dbuser = 'puppet', + $dbpwd, + $dbconnectinghost = 'localhost' ) +{ + @@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["${dbuser}@${dbconnectinghost}"], + tag => "mysql_${dbhostfqdn}", + } + + if hiera('use_munin',false) { + munin::plugin::deploy { 'puppetresources': + source => "puppet/munin/puppetresources.mysql", + config => "env.mysqlopts --user=$dbuser --password=$dbpwd -h $dbhost\nenv.puppetdb $dbname", + } + } +} diff --git a/manifests/master/linux.pp b/manifests/master/linux.pp new file mode 100644 index 0000000..d2fb5b1 --- /dev/null +++ b/manifests/master/linux.pp @@ -0,0 +1,18 @@ +class puppet::master::linux inherits puppet::linux { + + if $puppet::master::mode == 'passenger' { + exec { 'notify_passenger_puppetmaster': + refreshonly => true, + command => 'touch /etc/puppet/rack/tmp/restart.txt && sleep 1 && rm /etc/puppet/rack/tmp/restart.txt', + } + } else { + service { 'puppetmaster': + ensure => running, + enable => true, + require => [ Package[puppet] ], + } + } + Service[puppet]{ + require +> Service[puppetmaster], + } +} diff --git a/manifests/master/munin.pp b/manifests/master/munin.pp new file mode 100644 index 0000000..8046162 --- /dev/null +++ b/manifests/master/munin.pp @@ -0,0 +1,9 @@ +class puppet::master::munin { + + munin::plugin::deploy { + [ 'puppetmaster_memory', 'puppet_clients' ]: + source => "puppet/munin/puppet_", + config => "user root" + } + +} diff --git a/manifests/master/package.pp b/manifests/master/package.pp new file mode 100644 index 0000000..03d8de6 --- /dev/null +++ b/manifests/master/package.pp @@ -0,0 +1,9 @@ +# manifests/puppetmaster/package.pp + +class puppet::master::package inherits puppet::master::linux { + case $::operatingsystem { + centos: { include puppet::master::package::centos } + debian: { include puppet::master::package::debian } + default: { include puppet::master::package::base } + } +} diff --git a/manifests/master/package/base.pp b/manifests/master/package/base.pp new file mode 100644 index 0000000..0a1fa33 --- /dev/null +++ b/manifests/master/package/base.pp @@ -0,0 +1,10 @@ +class puppet::master::package::base inherits puppet::master::package { + + package { 'puppetmaster': + ensure => $puppet::ensure_version, + } + + Service['puppetmaster']{ + require +> Package['puppetmaster'], + } +} diff --git a/manifests/master/package/centos.pp b/manifests/master/package/centos.pp new file mode 100644 index 0000000..63adc64 --- /dev/null +++ b/manifests/master/package/centos.pp @@ -0,0 +1,7 @@ +class puppet::master::package::centos inherits puppet::master::package::base { + + Package['puppetmaster']{ + name => 'puppet-server', + alias => 'puppetmaster', + } +} diff --git a/manifests/master/package/debian.pp b/manifests/master/package/debian.pp new file mode 100644 index 0000000..0cb351c --- /dev/null +++ b/manifests/master/package/debian.pp @@ -0,0 +1,10 @@ +class puppet::master::package::debian inherits puppet::master::package::base { + + package { 'puppetmaster-common': + ensure => present, + } + + Package['puppetmaster']{ + require => Package['puppetmaster-common'] + } +} diff --git a/manifests/master/passenger.pp b/manifests/master/passenger.pp new file mode 100644 index 0000000..03e1aa4 --- /dev/null +++ b/manifests/master/passenger.pp @@ -0,0 +1,20 @@ +# class to use passenger for serving puppetmaster + +class puppet::master::passenger inherits puppet::master::base { + + include ::passenger + + # A reference configuration is available at : + # http://github.com/reductivelabs/puppet/tree/master/ext/rack + + file { + ['/etc/puppet/rack', '/etc/puppet/rack/public', '/etc/puppet/rack/tmp']: + ensure => directory, + owner => root, group => 0, mode => 0755; + + '/etc/puppet/rack/config.ru': + source => [ "puppet:///modules/site_puppet/master/config.ru", + "puppet:///modules/puppet/master/config.ru" ], + owner => puppet, group => 0, mode => 0644; + } +} diff --git a/manifests/master/storeconfigs.pp b/manifests/master/storeconfigs.pp new file mode 100644 index 0000000..e3ba6fb --- /dev/null +++ b/manifests/master/storeconfigs.pp @@ -0,0 +1,8 @@ +# This class sets up the necessary ActiveRecord bits +# so storeconfigs works. + +class puppet::master::storeconfigs { + include rails + include mysql::server + include mysql::client::ruby +} |