From 09c8eaf304d1075980d8d9143545f2f16a1db34d Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 5 Jun 2012 18:59:39 -0300 Subject: new style for 2.7 --- README | 18 +++--- manifests/base.pp | 29 ++++----- manifests/base/master.pp | 6 ++ manifests/centos.pp | 6 +- manifests/cron.pp | 20 ++++++- manifests/cron/base.pp | 24 ++++++-- manifests/cron/linux.pp | 13 +--- manifests/cron/openbsd.pp | 26 +++----- manifests/debian.pp | 23 ++++--- manifests/init.pp | 22 ++++--- manifests/linux.pp | 12 ++-- manifests/master.pp | 73 +++++++++++++++++++++++ manifests/master/base.pp | 31 ++++++++++ manifests/master/centos.pp | 12 ++++ manifests/master/checklastrun.pp | 25 ++++++++ manifests/master/checklastrun/disable.pp | 12 ++++ manifests/master/cleanup_reports.pp | 7 +++ manifests/master/cleanup_reports/disable.pp | 6 ++ manifests/master/cluster.pp | 5 ++ manifests/master/cluster/base.pp | 9 +++ manifests/master/debian.pp | 19 ++++++ manifests/master/hasdb.pp | 17 ++++++ manifests/master/hasdb/mysql.pp | 32 ++++++++++ manifests/master/linux.pp | 18 ++++++ manifests/master/munin.pp | 9 +++ manifests/master/package.pp | 9 +++ manifests/master/package/base.pp | 10 ++++ manifests/master/package/centos.pp | 7 +++ manifests/master/package/debian.pp | 10 ++++ manifests/master/passenger.pp | 20 +++++++ manifests/master/storeconfigs.pp | 8 +++ manifests/puppetmaster.pp | 49 --------------- manifests/puppetmaster/base.pp | 38 ------------ manifests/puppetmaster/centos.pp | 12 ---- manifests/puppetmaster/checklastrun.pp | 25 -------- manifests/puppetmaster/checklastrun/disable.pp | 12 ---- manifests/puppetmaster/cleanup_reports.pp | 8 --- manifests/puppetmaster/cleanup_reports/disable.pp | 6 -- manifests/puppetmaster/cluster.pp | 5 -- manifests/puppetmaster/cluster/base.pp | 9 --- manifests/puppetmaster/debian.pp | 19 ------ manifests/puppetmaster/hasdb.pp | 17 ------ manifests/puppetmaster/hasdb/mysql.pp | 32 ---------- manifests/puppetmaster/linux.pp | 18 ------ manifests/puppetmaster/munin.pp | 9 --- manifests/puppetmaster/package.pp | 9 --- manifests/puppetmaster/package/base.pp | 10 ---- manifests/puppetmaster/package/centos.pp | 7 --- manifests/puppetmaster/package/debian.pp | 10 ---- manifests/puppetmaster/passenger.pp | 20 ------- manifests/puppetmaster/storeconfigs.pp | 8 --- 51 files changed, 447 insertions(+), 414 deletions(-) create mode 100644 manifests/base/master.pp create mode 100644 manifests/master.pp create mode 100644 manifests/master/base.pp create mode 100644 manifests/master/centos.pp create mode 100644 manifests/master/checklastrun.pp create mode 100644 manifests/master/checklastrun/disable.pp create mode 100644 manifests/master/cleanup_reports.pp create mode 100644 manifests/master/cleanup_reports/disable.pp create mode 100644 manifests/master/cluster.pp create mode 100644 manifests/master/cluster/base.pp create mode 100644 manifests/master/debian.pp create mode 100644 manifests/master/hasdb.pp create mode 100644 manifests/master/hasdb/mysql.pp create mode 100644 manifests/master/linux.pp create mode 100644 manifests/master/munin.pp create mode 100644 manifests/master/package.pp create mode 100644 manifests/master/package/base.pp create mode 100644 manifests/master/package/centos.pp create mode 100644 manifests/master/package/debian.pp create mode 100644 manifests/master/passenger.pp create mode 100644 manifests/master/storeconfigs.pp delete mode 100644 manifests/puppetmaster.pp delete mode 100644 manifests/puppetmaster/base.pp delete mode 100644 manifests/puppetmaster/centos.pp delete mode 100644 manifests/puppetmaster/checklastrun.pp delete mode 100644 manifests/puppetmaster/checklastrun/disable.pp delete mode 100644 manifests/puppetmaster/cleanup_reports.pp delete mode 100644 manifests/puppetmaster/cleanup_reports/disable.pp delete mode 100644 manifests/puppetmaster/cluster.pp delete mode 100644 manifests/puppetmaster/cluster/base.pp delete mode 100644 manifests/puppetmaster/debian.pp delete mode 100644 manifests/puppetmaster/hasdb.pp delete mode 100644 manifests/puppetmaster/hasdb/mysql.pp delete mode 100644 manifests/puppetmaster/linux.pp delete mode 100644 manifests/puppetmaster/munin.pp delete mode 100644 manifests/puppetmaster/package.pp delete mode 100644 manifests/puppetmaster/package/base.pp delete mode 100644 manifests/puppetmaster/package/centos.pp delete mode 100644 manifests/puppetmaster/package/debian.pp delete mode 100644 manifests/puppetmaster/passenger.pp delete mode 100644 manifests/puppetmaster/storeconfigs.pp diff --git a/README b/README index 3c71a5f..d30a8e9 100644 --- a/README +++ b/README @@ -1,10 +1,10 @@ Puppet-Module for configuring Puppet itself, both the master and the clients ============================================================================ -Use a seperate local module called "site-puppet", where you place your customized +Use a seperate local module called "site_puppet", where you place your customized files, under: - site-puppet/files/master/fileserver.conf - site-puppet/files/master/puppet.conf + site_puppet/files/master/fileserver.conf + site_puppet/files/master/puppet.conf Usage ===== @@ -19,14 +19,14 @@ By default puppet runs as its own daemon. However, you might want to run puppet by cron. To do this, you have to include `puppet::cron` instead of `puppet`. If you include puppet::cron then by default puppet will run twice an hour, spread amongst the half an hour depending on the host's fqdn. If you wish to change -that interval, you can tweak $puppet_crontime (NOTE: this variable only operates +that interval, you can tweak $crontime (NOTE: this variable only operates on the minute cron field). Clientbucket cleanup: --------------------- The individual node client buckets aren't cleaned up automatically, unless you -specify $puppet_cleanup_clientbucket = 'X', where X is the number of days you +specify cleanup_clientbucket = 'X', where X is the number of days you want to keep clientbucket files for. Use http compression @@ -95,7 +95,7 @@ $puppet_storeconfig_password to the puppet database password, and then set $puppetmaster_storeconfigs = true to enable stored configs. Then you will need to either put in your node definition, or in -site-puppet/manifests/init.pp puppet::puppetmaster::hasdb to setup the database +site_puppet/manifests/init.pp puppet::puppetmaster::hasdb to setup the database with the right parameters. This will setup your storeconfigs database, adding to the database the correct user, the correct grant permissions, and also setup a munin graph, if you have $use_munin = true @@ -115,14 +115,14 @@ node puppetmaster { $use_munin = true $puppetmaster_mode = 'passenger' $puppet_crontime = "0,12 * * * *" - include site-puppet::master + include site_puppet::master include puppet::cron include puppet::puppetmaster ... -in your site-puppet/manifests/master.pp you could include something like: +in your site_puppet/manifests/master.pp you could include something like: -class site-puppet::master { +class site_puppet::master { ... puppet::puppetmaster::hasdb { "puppet": dbname => 'puppetmaster', diff --git a/manifests/base.pp b/manifests/base.pp index 695241c..9e597a8 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -1,36 +1,33 @@ class puppet::base { - if !$puppet_config { $puppet_config = '/etc/puppet/puppet.conf' } - - $puppet_majorversion = regsubst($puppetversion,'^(\d+\.\d+).*$','\1') - - case $puppet_cleanup_clientbucket { + $puppet_majorversion = regsubst($::puppetversion,'^(\d+\.\d+).*$','\1') + case $puppet::cleanup_clientbucket { # if not set, don't do anything - '',undef: {} - default: { + '',undef,false: {} + default: { tidy { "/var/lib/puppet/clientbucket": backup => false, recurse => true, rmdirs => true, type => mtime, - age => "$puppet_cleanup_clientbucket"; + age => "$puppet::cleanup_clientbucket"; } } } file { 'puppet_config': - path => "$puppet_config", - source => [ "puppet:///modules/site-puppet/client/${fqdn}/puppet.conf", - "puppet:///modules/site-puppet/client/puppet.conf.$operatingsystem", - "puppet:///modules/site-puppet/client/puppet.conf", - "puppet:///modules/puppet/client/${puppet_majorversion}/puppet.conf.$operatingsystem", + path => $puppet::config, + source => [ "puppet:///modules/site_puppet/client/${::fqdn}/puppet.conf", + "puppet:///modules/site_puppet/client/puppet.conf.${::operatingsystem}", + "puppet:///modules/site_puppet/client/puppet.conf", + "puppet:///modules/puppet/client/${puppet_majorversion}/puppet.conf.${::operatingsystem}", "puppet:///modules/puppet/client/${puppet_majorversion}/puppet.conf", - "puppet:///modules/puppet/client/puppet.conf.$operatingsystem", + "puppet:///modules/puppet/client/puppet.conf.${::operatingsystem}", "puppet:///modules/puppet/client/puppet.conf" ], notify => Service[puppet], - # if puppetmasterd is deployed by apache2/passenger it needs to read puppet.conf + # if puppetmasterd is deployed by apache2/passenger it needs to read puppet.conf # therefore it must be readable by puppet - owner => puppet, group => 0, mode => 600; + owner => puppet, group => 0, mode => 600; } service { 'puppet': diff --git a/manifests/base/master.pp b/manifests/base/master.pp new file mode 100644 index 0000000..09c9b62 --- /dev/null +++ b/manifests/base/master.pp @@ -0,0 +1,6 @@ +class puppet::base::master inherits puppet::base { + File[puppet_config]{ + source => [ "puppet:///modules/site_puppet/master/puppet.conf", + "puppet:///modules/puppet/master/puppet.conf" ], + } +} diff --git a/manifests/centos.pp b/manifests/centos.pp index 61aa065..547b064 100644 --- a/manifests/centos.pp +++ b/manifests/centos.pp @@ -1,9 +1,9 @@ class puppet::centos inherits puppet::linux { file { '/etc/sysconfig/puppet': - source => [ "puppet:///modules/site-puppet/sysconfig/${fqdn}/puppet", - "puppet:///modules/site-puppet/sysconfig/${domain}/puppet", - "puppet:///modules/site-puppet/sysconfig/puppet", + source => [ "puppet:///modules/site_puppet/sysconfig/${::fqdn}/puppet", + "puppet:///modules/site_puppet/sysconfig/${::domain}/puppet", + "puppet:///modules/site_puppet/sysconfig/puppet", "puppet:///modules/puppet/sysconfig/puppet" ], notify => Service[puppet], owner => root, group => 0, mode => 0644; diff --git a/manifests/cron.pp b/manifests/cron.pp index 5f9f227..5e3cc64 100644 --- a/manifests/cron.pp +++ b/manifests/cron.pp @@ -1,9 +1,23 @@ -class puppet::cron inherits puppet { - case $operatingsystem { +class puppet::cron( + $cron_time, + $config = hiera('puppet_config','/etc/puppet/puppet.conf'), + $http_compression = hiera('puppet_http_compression',false), + $cleanup_clientbucket = hiera('puppet_cleanup_clientbucket',false), + $ensure_version = hiera('puppet_ensure_version', 'installed'), + $ensure_facter_version = hiera('puppet_ensure_facter_version', 'installed'), +) { + class{'puppet': + config => $config, + http_compression => $http_compression, + cleanup_clientbucket => $cleanup_clientbucket, + ensure_version => $ensure_version, + ensure_facter_version => $ensure_facter_version + } + case $::operatingsystem { debian: { include puppet::cron::debian } openbsd: { include puppet::cron::openbsd } default: { - case $kernel { + case $::kernel { linux: { include puppet::cron::linux } default: { include puppet::cron::base } } diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp index 7b40da6..42222d6 100644 --- a/manifests/cron/base.pp +++ b/manifests/cron/base.pp @@ -1,19 +1,33 @@ # manifests/cron/base.pp class puppet::cron::base inherits puppet::base { - case $operatingsystem { - debian: { if $lsbdistcodename != 'lenny' { $stop_service = true } else { $stop_service = false } } + case $::operatingsystem { + debian: { if $::lsbdistcodename != 'lenny' { $stop_service = true } else { $stop_service = false } } openbsd, ubuntu: { $stop_service = false } default: { $stop_service = true } } - + + if !$puppet::cron::cron_time { + $crontime_interval_minute = fqdn_rand(29) + $crontime_interval_minute2 = inline_template("<%= 30+scope.lookupvar('puppet::cron::cron_time').to_i %>") + $crontime = "${crontime_interval_minute},${crontime_interval_minute2} * * * *" + } else { + $crontime = $puppet::cron::cron_time + } + + if $puppet::http_compression { + $http_compression_str = '--http_compression' + } else { + $http_compression_str = '' + } + Service['puppet']{ enable => false, } if $stop_service == true { - $puppet_majorversion = regsubst($puppetversion,'^(\d+\.\d+).*$','\1') - if $puppet_majorversion == '2.6' { + $puppet_majorversion = regsubst($::puppetversion,'^(\d+\.\d+).*$','\1') + if $puppet_majorversion == '2.6' { Service['puppet']{ ensure => stopped, } diff --git a/manifests/cron/linux.pp b/manifests/cron/linux.pp index bab9564..5452cc7 100644 --- a/manifests/cron/linux.pp +++ b/manifests/cron/linux.pp @@ -1,20 +1,11 @@ -# manifests/cron/linux.pp +# manifests/cron/linux.pp class puppet::cron::linux inherits puppet::linux { include puppet::cron::base - if !$puppet_config { $puppet_config = '/etc/puppet/puppet.conf' } - if $puppet_http_compression { $puppet_http_compression_str = '--http_compression' } - - - if !$puppet_crontime { - $puppet_crontime_interval_minute = fqdn_rand(29) - $puppet_crontime_interval_minute2 = inline_template('<%= 30+puppet_crontime_interval_minute.to_i %>') - $puppet_crontime = "${puppet_crontime_interval_minute},${puppet_crontime_interval_minute2} * * * *" - } File['/etc/cron.d/puppetd.cron']{ source => undef, - content => "#run puppet\n$puppet_crontime root output=\$(/usr/sbin/puppetd --onetime --no-daemonize --splay --config=/etc/puppet/puppet.conf --color false); ret=\$?; printf \"\\%s\" \"\$output\" | grep -E '(^err:|^alert:|^emerg:|^crit:)'; exit \$ret\n", + content => "#run puppet\n$puppet::cron::base::crontime root output=\$(/usr/sbin/puppetd --onetime --no-daemonize --splay --config=/etc/puppet/puppet.conf --color false ${puppet::cron::base::http_compression_str}); ret=\$?; printf \"\\%s\" \"\$output\" | grep -E '(^err:|^alert:|^emerg:|^crit:)'; exit \$ret\n", before => Service['puppet'], } } diff --git a/manifests/cron/openbsd.pp b/manifests/cron/openbsd.pp index 084b022..0e4a813 100644 --- a/manifests/cron/openbsd.pp +++ b/manifests/cron/openbsd.pp @@ -1,32 +1,24 @@ class puppet::cron::openbsd inherits puppet::openbsd { - include puppet::cron::base - if !$puppet_config { $puppet_config = '/etc/puppet/puppet.conf' } - if $puppet_http_compression { $puppet_http_compression_str = '--http_compression' } - - if !$puppet_crontime { - $puppet_crontime_interval_minute = fqdn_rand(29) - $puppet_crontime_interval_minute2 = inline_template('<%= 30+puppet_crontime_interval_minute.to_i %>') - $puppet_crontime = "${puppet_crontime_interval_minute},${puppet_crontime_interval_minute2} * * * *" - } + include puppet::cron::base Openbsd::Rc_local['puppetd']{ ensure => 'absent', } Cron['puppetd_check']{ - ensure => absent, + ensure => absent, } Cron['puppetd_restart']{ - ensure => absent, + ensure => absent, } cron { 'puppetd_run': - command => "/usr/local/bin/puppet agent --onetime --no-daemonize --config=$puppet_config --color false $puppet_http_compression_str | grep -E '(^err:|^alert:|^emerg:|^crit:)'", + command => "/usr/local/bin/puppet agent --onetime --no-daemonize --config=$puppet::config --color false ${puppet::cron::base::http_compression_str} | grep -E '(^err:|^alert:|^emerg:|^crit:)'", user => 'root', - minute => split(regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\1'),','), - hour => split(regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\2'),','), - weekday => split(regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\3'),','), - month => split(regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\4'),','), - monthday => split(regsubst($puppet_crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\5'),',') + minute => split(regsubst($puppet::cron::base::crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\1'),','), + hour => split(regsubst($puppet::cron::base::crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\2'),','), + weekday => split(regsubst($puppet::cron::base::crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\3'),','), + month => split(regsubst($puppet::cron::base::crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\4'),','), + monthday => split(regsubst($puppet::cron::base::crontime,'^([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+) ([\d,\-,*,/,\,]+)$','\5'),',') } } diff --git a/manifests/debian.pp b/manifests/debian.pp index f0479ae..70f8161 100644 --- a/manifests/debian.pp +++ b/manifests/debian.pp @@ -1,35 +1,34 @@ class puppet::debian inherits puppet::linux { file { '/etc/default/puppet': - source => [ "puppet:///modules/site-puppet/client/debian/${fqdn}/puppet", - "puppet:///modules/site-puppet/client/debian/${domain}/puppet", - "puppet:///modules/site-puppet/client/debian/puppet", + source => [ "puppet:///modules/site_puppet/client/debian/${::fqdn}/puppet", + "puppet:///modules/site_puppet/client/debian/${::domain}/puppet", + "puppet:///modules/site_puppet/client/debian/puppet", "puppet:///modules/puppet/client/debian/puppet" ], notify => Service[puppet], owner => root, group => 0, mode => 0644; - } + } - case $lsbdistcodename { + case $::lsbdistcodename { squeeze,sid: { - $real_puppet_hasstatus = true + $puppet_hasstatus = true } default: { - $real_puppet_hasstatus = false + $puppet_hasstatus = false } } - + Service[puppet]{ - hasstatus => $real_puppet_hasstatus, + hasstatus => $puppet_hasstatus, } - if !$puppet_ensure_version { $puppet_ensure_version = 'installed' } package{ 'puppet-common': - ensure => $puppet_ensure_version, + ensure => $puppet::ensure_version, } Package['puppet']{ require => Package['puppet-common'] - } + } } diff --git a/manifests/init.pp b/manifests/init.pp index e9d9748..d6f605c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -12,16 +12,22 @@ # Marcel Härry haerry+puppet(at)puzzle.ch # Simon Josi josi+puppet(at)puzzle.ch # -# This program is free software; you can redistribute -# it and/or modify it under the terms of the GNU -# General Public License version 3 as published by +# This program is free software; you can redistribute +# it and/or modify it under the terms of the GNU +# General Public License version 3 as published by # the Free Software Foundation. # -class puppet { - case $kernel { - linux: { - case $operatingsystem { +class puppet( + $config = hiera('puppet_config','/etc/puppet/puppet.conf'), + $http_compression = hiera('puppet_http_compression',false), + $cleanup_clientbucket = hiera('puppet_cleanup_clientbucket',false), + $ensure_version = hiera('puppet_ensure_version', 'installed'), + $ensure_facter_version = hiera('puppet_ensure_facter_version', 'installed'), +) { + case $::kernel { + linux: { + case $::operatingsystem { gentoo: { include puppet::gentoo } centos: { include puppet::centos } debian,ubuntu: { include puppet::debian } @@ -32,7 +38,7 @@ class puppet { default: { include puppet::base } } - if $use_shorewall { + if hiera('use_shorewall',false) { include shorewall::rules::out::puppet } } diff --git a/manifests/linux.pp b/manifests/linux.pp index fcd3936..6fc17ba 100644 --- a/manifests/linux.pp +++ b/manifests/linux.pp @@ -1,22 +1,20 @@ class puppet::linux inherits puppet::base { - if !$puppet_ensure_version { $puppet_ensure_version = 'installed' } package { 'puppet': - ensure => $puppet_ensure_version, + ensure => $puppet::ensure_version, } - if !$facter_ensure_version { $facter_ensure_version = 'installed' } package { 'facter': - ensure => $facter_ensure_version, + ensure => $puppet::ensure_facter_version, } Service['puppet']{ require => Package[puppet], } - + file { '/etc/cron.d/puppetd.cron': - source => [ "puppet:///modules/site-puppet/cron.d/puppetd", - "puppet:///modules/puppet/cron.d/puppetd.${operatingsystem}", + source => [ "puppet:///modules/site_puppet/cron.d/puppetd", + "puppet:///modules/puppet/cron.d/puppetd.${::operatingsystem}", "puppet:///modules/puppet/cron.d/puppetd" ], owner => root, group => 0, mode => 0644, } diff --git a/manifests/master.pp b/manifests/master.pp new file mode 100644 index 0000000..5ca0acc --- /dev/null +++ b/manifests/master.pp @@ -0,0 +1,73 @@ +# manifests/puppetmaster.pp +class puppet::master( + $config = hiera('puppet_config','/etc/puppet/puppet.conf'), + $http_compression = hiera('puppet_http_compression',false), + $cleanup_clientbucket = hiera('puppet_cleanup_clientbucket',false), + $cron_time = hiera('puppet_cron_time',false), + $ensure_version = hiera('puppet_ensure_version', 'installed'), + $ensure_facter_version = hiera('puppet_ensure_facter_version', 'installed'), + $lastruncheck_cron = hiera('puppet_master_lastruncheck_cron','40 10 * * *'), + $lastruncheck_ignorehosts = hiera('puppet_master_lastruncheck_ignorehosts',''), + $lastruncheck_timeout = hiera('puppet_master_lastruncheck_timeout',''), + $lastruncheck_additionaloptions = hiera('puppet_master_lastruncheck_additionaloptions',''), + $mode = hiera('puppet_master_mode','webrick'), + $cleanup_reports = hiera('puppet_master_cleanup_reports','30'), + $reports_dir = hiera('puppet_master_reports_dir','/var/lib/puppet/reports'), +) { + if $cron_time { + class{'puppet::cron': + config => $config, + http_compression => $http_compression, + cleanup_clientbucket => $cleanup_clientbucket, + cron_time => $cron_time, + ensure_version => $ensure_version, + ensure_facter_version => $ensure_facter_version, + } + } else { + class{'puppet': + config => $config, + http_compression => $http_compression, + cleanup_clientbucket => $cleanup_clientbucket, + ensure_version => $ensure_version, + ensure_facter_version => $ensure_facter_version, + } + } + case $::operatingsystem { + debian: { include puppet::master::debian } + centos: { include puppet::master::centos } + default: { + case $::kernel { + linux: { include puppet::master::linux } + } + } + } + + include puppet::master::base + + + if $puppet::master::lastruncheck_cron { + include puppet::master::checklastrun + } else { + include puppet::master::checklastrun::disable + } + + if $puppet::master::mode == 'passenger' { + include puppet::master::passenger + } elsif $puppet::master::mode == 'cluster' { + include puppet::master::cluster + } + + if $puppet::master::cleanup_reports { + include puppet::master::cleanup_reports + } else { + include puppet::master::cleanup_reports::disable + } + + if hiera('use_shorewall',false) { + include shorewall::rules::puppet::master + } + + if hiera('use_munin',false) { + include puppet::master::munin + } +} 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 +} diff --git a/manifests/puppetmaster.pp b/manifests/puppetmaster.pp deleted file mode 100644 index 3e8711c..0000000 --- a/manifests/puppetmaster.pp +++ /dev/null @@ -1,49 +0,0 @@ -# manifests/puppetmaster.pp -class puppet::puppetmaster inherits puppet { - case $operatingsystem { - debian: { include puppet::puppetmaster::debian } - centos: { include puppet::puppetmaster::centos } - default: { - case $kernel { - linux: { include puppet::puppetmaster::linux } - } - } - } - - include puppet::puppetmaster::base - - - case $puppetmaster_lastruncheck_cron { - '',undef: { $puppetmaster_lastruncheck_cron = '40 10 * * *' } - } - - if $puppetmaster_lastruncheck_cron { - include puppet::puppetmaster::checklastrun - } else { - include puppet::puppetmaster::checklastrun::disable - } - - if $puppetmaster_mode == 'passenger' { - include puppet::puppetmaster::passenger - } elsif $puppetmaster_mode == 'cluster' { - include puppet::puppetmaster::cluster - } - - case $puppetmaster_cleanup_reports { - '': { $puppetmaster_cleanup_reports = '30' } - } - - if $puppetmaster_cleanup_reports { - include puppet::puppetmaster::cleanup_reports - } else { - include puppet::puppetmaster::cleanup_reports::disable - } - - if $use_shorewall { - include shorewall::rules::puppet::master - } - - if $use_munin { - include puppet::puppetmaster::munin - } -} diff --git a/manifests/puppetmaster/base.pp b/manifests/puppetmaster/base.pp deleted file mode 100644 index 25709ea..0000000 --- a/manifests/puppetmaster/base.pp +++ /dev/null @@ -1,38 +0,0 @@ -class puppet::puppetmaster::base inherits puppet::base { - - File[puppet_config]{ - source => [ "puppet:///modules/site-puppet/master/puppet.conf", - "puppet:///modules/puppet/master/puppet.conf" ], - } - - if !$puppet_fileserverconfig { $puppet_fileserverconfig = '/etc/puppet/fileserver.conf' } - - file { "$puppet_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 $puppetmaster_storeconfigs { - include puppet::puppetmaster::storeconfigs - } - - - if $puppetmaster_mode == 'passenger' { - include puppet::puppetmaster::passenger - File[$puppet_fileserverconfig]{ - notify => Exec['notify_passenger_puppetmaster'], - } - File[puppet_config]{ - notify => Exec['notify_passenger_puppetmaster'], - } - } else { - File[$puppet_fileserverconfig]{ - notify => Service[puppetmaster], - } - File[puppet_config]{ - notify => Service[puppetmaster], - } - } -} diff --git a/manifests/puppetmaster/centos.pp b/manifests/puppetmaster/centos.pp deleted file mode 100644 index 2673a4d..0000000 --- a/manifests/puppetmaster/centos.pp +++ /dev/null @@ -1,12 +0,0 @@ -# manifests/puppetmaster/centos.pp -class puppet::puppetmaster::centos inherits puppet::puppetmaster::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/puppetmaster/checklastrun.pp b/manifests/puppetmaster/checklastrun.pp deleted file mode 100644 index 93ed8b9..0000000 --- a/manifests/puppetmaster/checklastrun.pp +++ /dev/null @@ -1,25 +0,0 @@ -class puppet::puppetmaster::checklastrun { - - $puppet_lastruncheck_ignorehosts_str = $puppet_lastruncheck_ignorehosts ? { - '' => '', - undef => '', - default => "--ignore-hosts ${puppet_lastruncheck_ignorehosts}" - } - - $puppet_lastruncheck_timeout_str = $puppet_lastruncheck_timeout ? { - '' => '', - undef => '', - default => "--timeout ${puppet_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_lastruncheck_additionaloptions}\n", - require => File["/usr/local/sbin/puppetlast"], - owner => root, group => 0, mode => 0644, - } -} diff --git a/manifests/puppetmaster/checklastrun/disable.pp b/manifests/puppetmaster/checklastrun/disable.pp deleted file mode 100644 index 8fff212..0000000 --- a/manifests/puppetmaster/checklastrun/disable.pp +++ /dev/null @@ -1,12 +0,0 @@ -class puppet::puppetmaster::checklastrun::disable inherits puppet::puppetmaster::checklastrun { - - File['/usr/local/sbin/puppetlast']{ - source => undef, - ensure => absent, - } - - File['/etc/cron.d/puppetlast.cron']{ - ensure => absent, - } -} - diff --git a/manifests/puppetmaster/cleanup_reports.pp b/manifests/puppetmaster/cleanup_reports.pp deleted file mode 100644 index 005a4d7..0000000 --- a/manifests/puppetmaster/cleanup_reports.pp +++ /dev/null @@ -1,8 +0,0 @@ -class puppet::puppetmaster::cleanup_reports { - case $puppetmaster_reports_dir { '',undef: { $puppetmaster_reports_dir = '/var/lib/puppet/reports' } } - # clean up reports older than $puppetmaster_cleanup_reports days - file { '/etc/cron.daily/puppet_reports_cleanup.sh': - content => "#!/bin/bash\nfind ${puppetmaster_reports_dir} -maxdepth 2 -type f -ctime +${puppetmaster_cleanup_reports} -exec rm {} \\;\n", - owner => root, group => 0, mode => 0700; - } -} diff --git a/manifests/puppetmaster/cleanup_reports/disable.pp b/manifests/puppetmaster/cleanup_reports/disable.pp deleted file mode 100644 index 8636223..0000000 --- a/manifests/puppetmaster/cleanup_reports/disable.pp +++ /dev/null @@ -1,6 +0,0 @@ -class puppet::puppetmaster::cleanup_reports::disable inherits puppet::puppetmaster::cleanup_reports { - - File['/etc/cron.daily/puppet_reports_cleanup.sh']{ - ensure => absent, - } -} diff --git a/manifests/puppetmaster/cluster.pp b/manifests/puppetmaster/cluster.pp deleted file mode 100644 index 8d635ab..0000000 --- a/manifests/puppetmaster/cluster.pp +++ /dev/null @@ -1,5 +0,0 @@ -class puppet::puppetmaster::cluster inherits puppet::puppetmaster { - - include puppet::puppetmaster::cluster::base - -} diff --git a/manifests/puppetmaster/cluster/base.pp b/manifests/puppetmaster/cluster/base.pp deleted file mode 100644 index 8c90153..0000000 --- a/manifests/puppetmaster/cluster/base.pp +++ /dev/null @@ -1,9 +0,0 @@ -class puppet::puppetmaster::cluster::base inherits puppet::puppetmaster::base { - - include mongrel, nginx - - File[puppet_config] { - require +> [ Package[mongrel], Package[nginx], File[nginx_config] ], - } -} - diff --git a/manifests/puppetmaster/debian.pp b/manifests/puppetmaster/debian.pp deleted file mode 100644 index 8cee0ea..0000000 --- a/manifests/puppetmaster/debian.pp +++ /dev/null @@ -1,19 +0,0 @@ -class puppet::puppetmaster::debian inherits puppet::puppetmaster::package { - - if $puppetmaster_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/puppetmaster/hasdb.pp b/manifests/puppetmaster/hasdb.pp deleted file mode 100644 index 2aca0e6..0000000 --- a/manifests/puppetmaster/hasdb.pp +++ /dev/null @@ -1,17 +0,0 @@ -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' ) -{ - - if !$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, } } - } -} diff --git a/manifests/puppetmaster/hasdb/mysql.pp b/manifests/puppetmaster/hasdb/mysql.pp deleted file mode 100644 index 1ed122a..0000000 --- a/manifests/puppetmaster/hasdb/mysql.pp +++ /dev/null @@ -1,32 +0,0 @@ -# don't use this define use the general interface -define puppet::puppetmaster::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 $use_munin { - 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/puppetmaster/linux.pp b/manifests/puppetmaster/linux.pp deleted file mode 100644 index 2670203..0000000 --- a/manifests/puppetmaster/linux.pp +++ /dev/null @@ -1,18 +0,0 @@ -class puppet::puppetmaster::linux inherits puppet::linux { - - if $puppetmaster_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/puppetmaster/munin.pp b/manifests/puppetmaster/munin.pp deleted file mode 100644 index 4500b74..0000000 --- a/manifests/puppetmaster/munin.pp +++ /dev/null @@ -1,9 +0,0 @@ -class puppet::puppetmaster::munin { - - munin::plugin::deploy { - [ 'puppetmaster_memory', 'puppet_clients' ]: - source => "puppet/munin/puppet_", - config => "user root" - } - -} diff --git a/manifests/puppetmaster/package.pp b/manifests/puppetmaster/package.pp deleted file mode 100644 index 145792e..0000000 --- a/manifests/puppetmaster/package.pp +++ /dev/null @@ -1,9 +0,0 @@ -# manifests/puppetmaster/package.pp - -class puppet::puppetmaster::package inherits puppet::puppetmaster::linux { - case $operatingsystem { - centos: { include puppet::puppetmaster::package::centos } - debian: { include puppet::puppetmaster::package::debian } - default: { include puppet::puppetmaster::package::base } - } -} diff --git a/manifests/puppetmaster/package/base.pp b/manifests/puppetmaster/package/base.pp deleted file mode 100644 index 363f827..0000000 --- a/manifests/puppetmaster/package/base.pp +++ /dev/null @@ -1,10 +0,0 @@ -class puppet::puppetmaster::package::base inherits puppet::puppetmaster::package { - - package { 'puppetmaster': - ensure => present, - } - - Service['puppetmaster']{ - require +> Package['puppetmaster'], - } -} diff --git a/manifests/puppetmaster/package/centos.pp b/manifests/puppetmaster/package/centos.pp deleted file mode 100644 index 43361fd..0000000 --- a/manifests/puppetmaster/package/centos.pp +++ /dev/null @@ -1,7 +0,0 @@ -class puppet::puppetmaster::package::centos inherits puppet::puppetmaster::package::base { - - Package['puppetmaster']{ - name => 'puppet-server', - alias => 'puppetmaster', - } -} diff --git a/manifests/puppetmaster/package/debian.pp b/manifests/puppetmaster/package/debian.pp deleted file mode 100644 index 9d7d397..0000000 --- a/manifests/puppetmaster/package/debian.pp +++ /dev/null @@ -1,10 +0,0 @@ -class puppet::puppetmaster::package::debian inherits puppet::puppetmaster::package::base { - - package { 'puppetmaster-common': - ensure => present, - } - - Package['puppetmaster']{ - require => Package['puppetmaster-common'] - } -} diff --git a/manifests/puppetmaster/passenger.pp b/manifests/puppetmaster/passenger.pp deleted file mode 100644 index c4bc062..0000000 --- a/manifests/puppetmaster/passenger.pp +++ /dev/null @@ -1,20 +0,0 @@ -# class to use passenger for serving puppetmaster - -class puppet::puppetmaster::passenger inherits puppet::puppetmaster::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/puppetmaster/storeconfigs.pp b/manifests/puppetmaster/storeconfigs.pp deleted file mode 100644 index 63c1191..0000000 --- a/manifests/puppetmaster/storeconfigs.pp +++ /dev/null @@ -1,8 +0,0 @@ -# This class sets up the necessary ActiveRecord bits -# so storeconfigs works. - -class puppet::puppetmaster::storeconfigs { - include rails - include mysql::server - include mysql::client::ruby -} -- cgit v1.2.3 From a83290235e9da22d05de814b22e265f53a0dc6bb Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 10 Jun 2012 16:20:01 -0300 Subject: use proper variable name --- manifests/master.pp | 1 + manifests/master/base.pp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/manifests/master.pp b/manifests/master.pp index 5ca0acc..2e3029f 100644 --- a/manifests/master.pp +++ b/manifests/master.pp @@ -1,6 +1,7 @@ # manifests/puppetmaster.pp class puppet::master( $config = hiera('puppet_config','/etc/puppet/puppet.conf'), + $fileserver = hiera('puppet_fileserver_config','/etc/puppet/fileserver.conf'), $http_compression = hiera('puppet_http_compression',false), $cleanup_clientbucket = hiera('puppet_cleanup_clientbucket',false), $cron_time = hiera('puppet_cron_time',false), diff --git a/manifests/master/base.pp b/manifests/master/base.pp index 80fe8e0..6e8efe4 100644 --- a/manifests/master/base.pp +++ b/manifests/master/base.pp @@ -1,6 +1,6 @@ class puppet::master::base inherits puppet::base { - file { $puppet::master::fileserverconfig: + file { $puppet::master::fileserver: source => [ "puppet:///modules/site_puppet/master/${::fqdn}/fileserver.conf", "puppet:///modules/site_puppet/master/fileserver.conf", "puppet:///modules/puppet/master/fileserver.conf" ], @@ -14,14 +14,14 @@ class puppet::master::base inherits puppet::base { if $puppet::master::mode == 'passenger' { include puppet::master::passenger - File[$puppet::master::fileserverconfig]{ + File[$puppet::master::fileserver]{ notify => Exec['notify_passenger_puppetmaster'], } File[puppet_config]{ notify => Exec['notify_passenger_puppetmaster'], } } else { - File[$puppet::master::fileserverconfig]{ + File[$puppet::master::fileserver]{ notify => Service[puppetmaster], } File[puppet_config]{ -- cgit v1.2.3 From 094a8faa46f842bc99adbdc207aace375517afba Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 10 Jun 2012 16:56:31 -0300 Subject: use another source for the master --- manifests/master/base.pp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manifests/master/base.pp b/manifests/master/base.pp index 6e8efe4..390d9b5 100644 --- a/manifests/master/base.pp +++ b/manifests/master/base.pp @@ -7,6 +7,12 @@ class puppet::master::base inherits puppet::base { owner => root, group => puppet, mode => 640; } + File['puppet_config']{ + source => [ "puppet:///modules/site_puppet/master/${::fqdn}/puppet.conf", + "puppet:///modules/site_puppet/master/puppet.conf", + "puppet:///modules/puppet/master/puppet.conf" ] + } + if $puppet::master::storeconfigs { include puppet::master::storeconfigs } -- cgit v1.2.3 From a088356e96de56839612363a0b52f3687733431a Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 10 Jun 2012 17:41:38 -0300 Subject: fix cron time --- manifests/master/checklastrun.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/master/checklastrun.pp b/manifests/master/checklastrun.pp index bde5a97..b80bb56 100644 --- a/manifests/master/checklastrun.pp +++ b/manifests/master/checklastrun.pp @@ -18,7 +18,7 @@ class puppet::master::checklastrun { 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", + content => "${puppet::master::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, } -- cgit v1.2.3 From a81d6c371eef25a505e16cb89cb6c7e5a124e7fc Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 10 Jun 2012 18:26:55 -0300 Subject: stop the puppet service by default on cron --- manifests/cron.pp | 1 + manifests/cron/base.pp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/cron.pp b/manifests/cron.pp index 5e3cc64..f8e9beb 100644 --- a/manifests/cron.pp +++ b/manifests/cron.pp @@ -1,5 +1,6 @@ class puppet::cron( $cron_time, + $stop_service = hiera('puppet_stop_service',true), $config = hiera('puppet_config','/etc/puppet/puppet.conf'), $http_compression = hiera('puppet_http_compression',false), $cleanup_clientbucket = hiera('puppet_cleanup_clientbucket',false), diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp index 42222d6..e12b5eb 100644 --- a/manifests/cron/base.pp +++ b/manifests/cron/base.pp @@ -25,7 +25,7 @@ class puppet::cron::base inherits puppet::base { enable => false, } - if $stop_service == true { + if $puppet::cron::stop_service == true { $puppet_majorversion = regsubst($::puppetversion,'^(\d+\.\d+).*$','\1') if $puppet_majorversion == '2.6' { Service['puppet']{ -- cgit v1.2.3 From aa345cb8f784ce5441367db7c4782000d80d365b Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 10 Jun 2012 19:38:29 -0300 Subject: we support now also 2.7 - 0.24 should not anymore be around --- manifests/cron/base.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp index e12b5eb..e012731 100644 --- a/manifests/cron/base.pp +++ b/manifests/cron/base.pp @@ -27,7 +27,7 @@ class puppet::cron::base inherits puppet::base { if $puppet::cron::stop_service == true { $puppet_majorversion = regsubst($::puppetversion,'^(\d+\.\d+).*$','\1') - if $puppet_majorversion == '2.6' { + if $puppet_majorversion != '0.25' { Service['puppet']{ ensure => stopped, } -- cgit v1.2.3 From e59aec0fadd435cff42dceeb147d4eb85fdc9484 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 13 Jun 2012 21:23:36 -0300 Subject: take hiera out of the params --- manifests/cron.pp | 30 +++++++++++++++++++----------- manifests/init.pp | 24 ++++++++++++++++-------- manifests/master.pp | 41 ++++++++++++++++++++++++----------------- manifests/master/hasdb.pp | 4 ++-- manifests/master/hasdb/mysql.pp | 2 +- 5 files changed, 62 insertions(+), 39 deletions(-) diff --git a/manifests/cron.pp b/manifests/cron.pp index f8e9beb..ffb8032 100644 --- a/manifests/cron.pp +++ b/manifests/cron.pp @@ -1,18 +1,26 @@ class puppet::cron( $cron_time, - $stop_service = hiera('puppet_stop_service',true), - $config = hiera('puppet_config','/etc/puppet/puppet.conf'), - $http_compression = hiera('puppet_http_compression',false), - $cleanup_clientbucket = hiera('puppet_cleanup_clientbucket',false), - $ensure_version = hiera('puppet_ensure_version', 'installed'), - $ensure_facter_version = hiera('puppet_ensure_facter_version', 'installed'), + $stop_service = true, + $config = '/etc/puppet/puppet.conf', + $http_compression = 'puppet_http_compression', + $cleanup_clientbucket = false, + $ensure_version = 'installed', + $ensure_facter_version = 'installed', + $manage_shorewall = false, + $puppetmaster = "puppet.${domain}", + $puppetmaster_port = '8140', + $puppetmaster_signport = '8141' ) { class{'puppet': - config => $config, - http_compression => $http_compression, - cleanup_clientbucket => $cleanup_clientbucket, - ensure_version => $ensure_version, - ensure_facter_version => $ensure_facter_version + config => $config, + http_compression => $http_compression, + cleanup_clientbucket => $cleanup_clientbucket, + ensure_version => $ensure_version, + ensure_facter_version => $ensure_facter_version, + manage_shorewall => $manage_shorewall, + puppetmaster => $puppetmaster, + puppetmaster_port => $puppetmaster_port, + puppetmaster_signport => $puppetmaster_signport, } case $::operatingsystem { debian: { include puppet::cron::debian } diff --git a/manifests/init.pp b/manifests/init.pp index d6f605c..407ace1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,12 +19,16 @@ # class puppet( - $config = hiera('puppet_config','/etc/puppet/puppet.conf'), - $http_compression = hiera('puppet_http_compression',false), - $cleanup_clientbucket = hiera('puppet_cleanup_clientbucket',false), - $ensure_version = hiera('puppet_ensure_version', 'installed'), - $ensure_facter_version = hiera('puppet_ensure_facter_version', 'installed'), -) { + $config = '/etc/puppet/puppet.conf', + $http_compression = false, + $cleanup_clientbucket = false, + $ensure_version = 'installed', + $ensure_facter_version = 'installed', + $manage_shorewall = false, + $puppetmaster = "puppet.${::domain}", + $puppetserver_port = 8140, + $puppetserver_signport = 8141 +){ case $::kernel { linux: { case $::operatingsystem { @@ -38,7 +42,11 @@ class puppet( default: { include puppet::base } } - if hiera('use_shorewall',false) { - include shorewall::rules::out::puppet + if $manage_shorewall { + class{'shorewall::rules::out::puppet': + puppetserver => $puppetserver, + puppetserver_port => $puppetserver_port, + puppetserver_signport => $puppetserver_signport, + } } } diff --git a/manifests/master.pp b/manifests/master.pp index 2e3029f..7209778 100644 --- a/manifests/master.pp +++ b/manifests/master.pp @@ -1,19 +1,20 @@ # manifests/puppetmaster.pp class puppet::master( - $config = hiera('puppet_config','/etc/puppet/puppet.conf'), - $fileserver = hiera('puppet_fileserver_config','/etc/puppet/fileserver.conf'), - $http_compression = hiera('puppet_http_compression',false), - $cleanup_clientbucket = hiera('puppet_cleanup_clientbucket',false), - $cron_time = hiera('puppet_cron_time',false), - $ensure_version = hiera('puppet_ensure_version', 'installed'), - $ensure_facter_version = hiera('puppet_ensure_facter_version', 'installed'), - $lastruncheck_cron = hiera('puppet_master_lastruncheck_cron','40 10 * * *'), - $lastruncheck_ignorehosts = hiera('puppet_master_lastruncheck_ignorehosts',''), - $lastruncheck_timeout = hiera('puppet_master_lastruncheck_timeout',''), - $lastruncheck_additionaloptions = hiera('puppet_master_lastruncheck_additionaloptions',''), - $mode = hiera('puppet_master_mode','webrick'), - $cleanup_reports = hiera('puppet_master_cleanup_reports','30'), - $reports_dir = hiera('puppet_master_reports_dir','/var/lib/puppet/reports'), + $config = '/etc/puppet/puppet.conf', + $fileserver = '/etc/puppet/fileserver.conf', + $http_compression = false, + $cleanup_clientbucket = false, + $cron_time = false, + $ensure_version = 'installed', + $ensure_facter_version = 'installed', + $lastruncheck_cron = '40 10 * * *', + $lastruncheck_ignorehosts = '', + $lastruncheck_timeout = '', + $lastruncheck_additionaloptions = '', + $mode = 'webrick', + $cleanup_reports = '30', + $reports_dir = '/var/lib/puppet/reports', + $manage_shorewall = false ) { if $cron_time { class{'puppet::cron': @@ -23,6 +24,7 @@ class puppet::master( cron_time => $cron_time, ensure_version => $ensure_version, ensure_facter_version => $ensure_facter_version, + manage_shorewall => $manage_shorewall, } } else { class{'puppet': @@ -31,6 +33,7 @@ class puppet::master( cleanup_clientbucket => $cleanup_clientbucket, ensure_version => $ensure_version, ensure_facter_version => $ensure_facter_version, + manage_shorewall => $manage_shorewall, } } case $::operatingsystem { @@ -64,11 +67,15 @@ class puppet::master( include puppet::master::cleanup_reports::disable } - if hiera('use_shorewall',false) { - include shorewall::rules::puppet::master + if $manage_shorewall { + class{'shorewall::rules::puppet::master': + puppetserver => $puppetserver, + puppetserver_port => $puppetserver_port, + puppetserver_signport => $puppetserver_signport, + } } - if hiera('use_munin',false) { + if $manage_munin { include puppet::master::munin } } diff --git a/manifests/master/hasdb.pp b/manifests/master/hasdb.pp index d3bf388..66aeb62 100644 --- a/manifests/master/hasdb.pp +++ b/manifests/master/hasdb.pp @@ -5,11 +5,11 @@ define puppet::master::hasdb ( # this is needed due to the collection of the databases $dbhostfqdn = $::fqdn, $dbuser = 'puppet', - $dbpwd = hiera('puppet_master_storeconfigs_password',false), + $dbpwd = false, $dbconnectinghost = 'locahost' ) { - if !$dbpwd { fail("No \$puppet_master_storeconfig_password is set, please set it in your hiera database") } + if !$dbpwd { fail('No $puppet_master_storeconfig_password is set, please pass it the master class') } 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 index bc15756..5f4985a 100644 --- a/manifests/master/hasdb/mysql.pp +++ b/manifests/master/hasdb/mysql.pp @@ -23,7 +23,7 @@ define puppet::master::hasdb::mysql ( tag => "mysql_${dbhostfqdn}", } - if hiera('use_munin',false) { + if $puppet::master::manage_munin { munin::plugin::deploy { 'puppetresources': source => "puppet/munin/puppetresources.mysql", config => "env.mysqlopts --user=$dbuser --password=$dbpwd -h $dbhost\nenv.puppetdb $dbname", -- cgit v1.2.3 From 7fc91e98d779795fdf4c1c167ab6fc56028a7009 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 17 Jun 2012 16:45:07 -0300 Subject: correct param naming --- manifests/cron.pp | 24 ++++++++++++------------ manifests/init.pp | 12 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/manifests/cron.pp b/manifests/cron.pp index ffb8032..c7bc782 100644 --- a/manifests/cron.pp +++ b/manifests/cron.pp @@ -7,20 +7,20 @@ class puppet::cron( $ensure_version = 'installed', $ensure_facter_version = 'installed', $manage_shorewall = false, - $puppetmaster = "puppet.${domain}", - $puppetmaster_port = '8140', - $puppetmaster_signport = '8141' + $shorewall_puppetmaster = "puppet.${domain}", + $shorewall_puppetmaster_port = '8140', + $shorewall_puppetmaster_signport = '8141' ) { class{'puppet': - config => $config, - http_compression => $http_compression, - cleanup_clientbucket => $cleanup_clientbucket, - ensure_version => $ensure_version, - ensure_facter_version => $ensure_facter_version, - manage_shorewall => $manage_shorewall, - puppetmaster => $puppetmaster, - puppetmaster_port => $puppetmaster_port, - puppetmaster_signport => $puppetmaster_signport, + config => $config, + http_compression => $http_compression, + cleanup_clientbucket => $cleanup_clientbucket, + ensure_version => $ensure_version, + ensure_facter_version => $ensure_facter_version, + manage_shorewall => $manage_shorewall, + shorewall_puppetmaster => $shorewall_puppetmaster, + shorewall_puppetmaster_port => $shorewall_puppetmaster_port, + shorewall_puppetmaster_signport => $shorewall_puppetmaster_signport, } case $::operatingsystem { debian: { include puppet::cron::debian } diff --git a/manifests/init.pp b/manifests/init.pp index 407ace1..ceb0c46 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -25,9 +25,9 @@ class puppet( $ensure_version = 'installed', $ensure_facter_version = 'installed', $manage_shorewall = false, - $puppetmaster = "puppet.${::domain}", - $puppetserver_port = 8140, - $puppetserver_signport = 8141 + $shorewall_puppetmaster = "puppet.${::domain}", + $shorewall_puppetmaster_port = 8140, + $shorewall_puppetmaster_signport = 8141 ){ case $::kernel { linux: { @@ -44,9 +44,9 @@ class puppet( if $manage_shorewall { class{'shorewall::rules::out::puppet': - puppetserver => $puppetserver, - puppetserver_port => $puppetserver_port, - puppetserver_signport => $puppetserver_signport, + puppetserver => $shorewall_puppetmaster, + puppetserver_port => $shorewall_puppetmaster_port, + puppetserver_signport => $shorewall_puppetmaster_signport, } } } -- cgit v1.2.3 From 1abec7ab73695e5c2e6a091f9355bcc04d25fa3b Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 17 Jun 2012 17:02:37 -0300 Subject: pass also these params --- manifests/master.pp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/manifests/master.pp b/manifests/master.pp index 7209778..1a463c7 100644 --- a/manifests/master.pp +++ b/manifests/master.pp @@ -14,7 +14,10 @@ class puppet::master( $mode = 'webrick', $cleanup_reports = '30', $reports_dir = '/var/lib/puppet/reports', - $manage_shorewall = false + $manage_shorewall = false, + $shorewall_puppetmaster = "domain.${::domain}", + $shorewall_puppetmaster_port = 8140, + $shorewall_puppetmaster_signport = 8141 ) { if $cron_time { class{'puppet::cron': @@ -25,6 +28,9 @@ class puppet::master( ensure_version => $ensure_version, ensure_facter_version => $ensure_facter_version, manage_shorewall => $manage_shorewall, + shorewall_puppetmaster => $shorewall_puppetmaster, + shorewall_puppetmaster_port => $shorewall_puppetmaster_port, + shorewall_puppetmaster_signport => $shorewall_puppetmaster_signport, } } else { class{'puppet': -- cgit v1.2.3 From 31f7bbcae199de9d35daaa7c2d47aac5d0567e65 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 18 Jun 2012 14:56:59 -0300 Subject: cleanup param mes --- manifests/cron.pp | 4 +--- manifests/init.pp | 5 ++--- manifests/master.pp | 14 ++++++-------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/manifests/cron.pp b/manifests/cron.pp index c7bc782..b4d9140 100644 --- a/manifests/cron.pp +++ b/manifests/cron.pp @@ -6,8 +6,7 @@ class puppet::cron( $cleanup_clientbucket = false, $ensure_version = 'installed', $ensure_facter_version = 'installed', - $manage_shorewall = false, - $shorewall_puppetmaster = "puppet.${domain}", + $shorewall_puppetmaster = false, $shorewall_puppetmaster_port = '8140', $shorewall_puppetmaster_signport = '8141' ) { @@ -17,7 +16,6 @@ class puppet::cron( cleanup_clientbucket => $cleanup_clientbucket, ensure_version => $ensure_version, ensure_facter_version => $ensure_facter_version, - manage_shorewall => $manage_shorewall, shorewall_puppetmaster => $shorewall_puppetmaster, shorewall_puppetmaster_port => $shorewall_puppetmaster_port, shorewall_puppetmaster_signport => $shorewall_puppetmaster_signport, diff --git a/manifests/init.pp b/manifests/init.pp index ceb0c46..3a71ed0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -24,8 +24,7 @@ class puppet( $cleanup_clientbucket = false, $ensure_version = 'installed', $ensure_facter_version = 'installed', - $manage_shorewall = false, - $shorewall_puppetmaster = "puppet.${::domain}", + $shorewall_puppetmaster = false, $shorewall_puppetmaster_port = 8140, $shorewall_puppetmaster_signport = 8141 ){ @@ -42,7 +41,7 @@ class puppet( default: { include puppet::base } } - if $manage_shorewall { + if $shorewall_puppetmaster { class{'shorewall::rules::out::puppet': puppetserver => $shorewall_puppetmaster, puppetserver_port => $shorewall_puppetmaster_port, diff --git a/manifests/master.pp b/manifests/master.pp index 1a463c7..55ab1e5 100644 --- a/manifests/master.pp +++ b/manifests/master.pp @@ -14,10 +14,10 @@ class puppet::master( $mode = 'webrick', $cleanup_reports = '30', $reports_dir = '/var/lib/puppet/reports', - $manage_shorewall = false, $shorewall_puppetmaster = "domain.${::domain}", $shorewall_puppetmaster_port = 8140, - $shorewall_puppetmaster_signport = 8141 + $shorewall_puppetmaster_signport = 8141, + $manage_munin = false ) { if $cron_time { class{'puppet::cron': @@ -27,7 +27,6 @@ class puppet::master( cron_time => $cron_time, ensure_version => $ensure_version, ensure_facter_version => $ensure_facter_version, - manage_shorewall => $manage_shorewall, shorewall_puppetmaster => $shorewall_puppetmaster, shorewall_puppetmaster_port => $shorewall_puppetmaster_port, shorewall_puppetmaster_signport => $shorewall_puppetmaster_signport, @@ -39,7 +38,6 @@ class puppet::master( cleanup_clientbucket => $cleanup_clientbucket, ensure_version => $ensure_version, ensure_facter_version => $ensure_facter_version, - manage_shorewall => $manage_shorewall, } } case $::operatingsystem { @@ -73,11 +71,11 @@ class puppet::master( include puppet::master::cleanup_reports::disable } - if $manage_shorewall { + if $shorewall_puppetmaster { class{'shorewall::rules::puppet::master': - puppetserver => $puppetserver, - puppetserver_port => $puppetserver_port, - puppetserver_signport => $puppetserver_signport, + puppetserver => $shorewall_puppetmaster, + puppetserver_port => $shorewall_puppetmaster_port, + puppetserver_signport => $shorewall_puppetmaster_signport, } } -- cgit v1.2.3 From 32d3fa901b91a7814397965fd2b2eb01d30ad99a Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 18 Jun 2012 15:23:57 -0300 Subject: this has no params --- manifests/master.pp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/manifests/master.pp b/manifests/master.pp index 55ab1e5..af7794b 100644 --- a/manifests/master.pp +++ b/manifests/master.pp @@ -72,11 +72,7 @@ class puppet::master( } if $shorewall_puppetmaster { - class{'shorewall::rules::puppet::master': - puppetserver => $shorewall_puppetmaster, - puppetserver_port => $shorewall_puppetmaster_port, - puppetserver_signport => $shorewall_puppetmaster_signport, - } + include shorewall::rules::puppet::master } if $manage_munin { -- cgit v1.2.3 From eec0fdc63fb938c10ff3ca74a3d78215577acf06 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 26 Aug 2012 19:30:16 +0200 Subject: improve testing for service --- manifests/openbsd.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/openbsd.pp b/manifests/openbsd.pp index 1df5a9e..7ef6d28 100644 --- a/manifests/openbsd.pp +++ b/manifests/openbsd.pp @@ -8,9 +8,9 @@ class puppet::openbsd inherits puppet::base { restart => '/bin/kill -HUP `/bin/cat /var/run/puppet/agent.pid`', stop => '/bin/kill `/bin/cat /var/run/puppet/agent.pid`', start => '/usr/local/bin/puppet agent', - hasstatus => false, + status => '/bin/test -f /var/run/puppet/agent.pid && /bin/ps aux -p `/bin/cat /var/run/puppet/agent.pid` > /dev/null', + hasstatus => true, hasrestart => false, - pattern => 'puppet agent', } openbsd::rc_local { 'puppetd': -- cgit v1.2.3 From bad29d3812a9e02a03df35f5b21feac7aa1360f6 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 6 Dec 2012 23:14:22 +0100 Subject: use correct location to get logs --- manifests/master/munin.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/master/munin.pp b/manifests/master/munin.pp index 8046162..89aa5f2 100644 --- a/manifests/master/munin.pp +++ b/manifests/master/munin.pp @@ -3,7 +3,8 @@ class puppet::master::munin { munin::plugin::deploy { [ 'puppetmaster_memory', 'puppet_clients' ]: source => "puppet/munin/puppet_", - config => "user root" + config => "user root +env.logfile /var/log/puppet/puppetmaster.log" } } -- cgit v1.2.3 From 26c67fe5ebf4c993f796d1b5de50015dfbb3bca8 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 7 Dec 2012 12:32:51 +0100 Subject: correct env var --- manifests/master/munin.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/master/munin.pp b/manifests/master/munin.pp index 89aa5f2..b455240 100644 --- a/manifests/master/munin.pp +++ b/manifests/master/munin.pp @@ -4,7 +4,7 @@ class puppet::master::munin { [ 'puppetmaster_memory', 'puppet_clients' ]: source => "puppet/munin/puppet_", config => "user root -env.logfile /var/log/puppet/puppetmaster.log" +env.puppet_logfile /var/log/puppet/puppetmaster.log" } } -- cgit v1.2.3 From 56c15eb79702694ecd0a413958c2e5498a794f0a Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 7 Dec 2012 12:56:28 +0100 Subject: improve puppet munin plugin --- files/munin/puppet_ | 175 ++++++++++++++++++++++++---------------------- manifests/master/munin.pp | 17 +++-- 2 files changed, 101 insertions(+), 91 deletions(-) diff --git a/files/munin/puppet_ b/files/munin/puppet_ index ed488be..279f5ab 100644 --- a/files/munin/puppet_ +++ b/files/munin/puppet_ @@ -2,100 +2,107 @@ # returns the mem usage of a given process def plist(psname) - counter = 0 - %x{ps h -o rss,size,vsize,pcpu -u puppet}.each do |ps| - rss,size,vsize,cpu = ps.split - counter += 1 - puts "puppetmasterd_#{counter}.value #{rss}" - - end - return + counter = 0 + %x{ps h -o rss,size,vsize,pcpu -u puppet}.each do |ps| + rss,size,vsize,cpu = ps.split + counter += 1 + puts "puppetmasterd_#{counter}.value #{rss}" + + end + return end # reports how many clients compiled in the last 5 minutes # repotrs how many unique clients compiled since the begining of the day # report the average compilation time for all clients in the last 5 minutes. -def phaselog - logfile = ENV['puppet_logfile'] || '/var/log/daemon.log' - count,avg,day_count_unique,day_count = 0 ,0 ,0, 0 - t = Time.now +def phaselog(logfile) + count,avg,day_count_unique,day_count = 0 ,0 ,0, 0 + t = Time.now today = t.strftime("^%b ") + " ?" + t.day.to_s - hour = today + t.strftime(" %H:") - m = t.min.to_i - last5m = "" - 6.times do |i| - last5m += hour - last5m += "0" if (m-i) < 10 - last5m += (m-i).to_s - last5m += "|" unless i==5 - end - hosts = Array.new - regexp = ".* for (.*) in (.*) seconds" + hour = today + t.strftime(" %H:") + m = t.min.to_i + last5m = "" + 6.times do |i| + last5m += hour + last5m += "0" if (m-i) < 10 + last5m += (m-i).to_s + last5m += "|" unless i==5 + end + hosts = Array.new + regexp = ".* for (.*) in (.*) seconds" - File.open(logfile).grep(/#{today}/).grep(/Compiled configuration|Compiled catalog/).each do |line| - case line - when /#{last5m}/ then - if line =~ /#{regexp}/ - avg += $2.to_f - count += 1 - unless hosts.include?($1) - hosts << $1 - end - end - when /#{regexp}/ then - day_count += 1 - unless hosts.include?($1) - hosts << $1 - day_count_unique += 1 - end - end - end - puts "avg_compile.value #{(avg / count).to_s[0..3]}" unless count == 0 - puts "last5m_count.value #{count}" - puts "last24h_unique_count.value #{day_count_unique}" + File.open(logfile).grep(/#{today}/).grep(/Compiled configuration|Compiled catalog/).each do |line| + case line + when /#{last5m}/ then + if line =~ /#{regexp}/ + avg += $2.to_f + count += 1 + unless hosts.include?($1) + hosts << $1 + end + end + when /#{regexp}/ then + day_count += 1 + unless hosts.include?($1) + hosts << $1 + day_count_unique += 1 + end + end + end + puts "avg_compile.value #{(avg / count).to_s[0..3]}" unless count == 0 + puts "last5m_count.value #{count}" + puts "last24h_unique_count.value #{day_count_unique}" end +sys_file = '/etc/default/puppetmaster' +sys_file = '/etc/sysconfig/puppetmaster' if !File.exists?(sys_file) && File.exists?('/etc/sysconfig/puppetmaster') +logfile = ENV['puppet_logfile'] || '/var/log/daemon.log' +facts_dir = ENV['facts_dir'] || '/var/lib/puppet/yaml/facts/' case ARGV[0] - when 'config' - case $0 - when /puppetmaster_memory/ - puts "graph_title puppetmaster memory usage" - puts "graph_vlabel memory" - # find out how many mongrel process we have - if any - File.open('/etc/default/puppetmaster') do |line| - @pm_process = line.grep(/PUPPETMASTERS/).to_s.split('=')[1].to_i - end - if @pm_process > 0 - @pm_process.times do |i| - puts "puppetmasterd_#{i+1}.label puppetmasterd #{i+1}" - end - else - puts "puppetmaster.label puppetmasterd" - end - when /puppet_clients/ - puts "graph_title puppet clients usage" - puts "graph_vlabel clients" - puts "known_clients.label Known Clients" - puts "avg_compile.label Average configuration compile" - puts "last5m_count.label Clients in the last 5 minutes" - puts "last24h_unique_count.label unique clients in the last 24 hours" - end - puts "graph_category puppet" - exit 0 - when 'autoconf' - case $0 - when /puppet_mem/,/puppet_clients/ - puts "yes" - else - puts "no" - exit 0 - end - else - plist("'ruby /usr/sbin/puppetmasterd'") if $0 =~ /puppet_mem$/ - if $0 =~ /puppet_clients$/ - puts "known_clients.value #{Dir.entries('/var/lib/puppet/yaml/facts/').size-2}" - phaselog - end + when 'config' + case $0 + when /puppetmaster_memory/ + puts "graph_title puppetmaster memory usage" + puts "graph_vlabel memory" + # find out how many mongrel process we have - if any + File.open(sys_files) do |line| + @pm_process = line.grep(/(PUPPETMASTERS|PUPPETMASTER_PORTS)/).to_s.split('=')[1].to_i + end + if @pm_process > 0 + @pm_process.times do |i| + puts "puppetmasterd_#{i+1}.label puppetmasterd #{i+1}" + end + else + puts "puppetmaster.label puppetmasterd" + end + when /puppet_clients/ + puts "graph_title puppet clients usage" + puts "graph_vlabel clients" + puts "known_clients.label Known Clients" + puts "avg_compile.label Average configuration compile" + puts "last5m_count.label Clients in the last 5 minutes" + puts "last24h_unique_count.label unique clients in the last 24 hours" + end + puts "graph_category puppet" + exit 0 + when 'autoconf' + case $0 + when /puppet_mem/,/puppet_clients/ + if File.exists?(sys_file) && File.exists?(logfile) && File.directory?(facts_dir) + puts "yes" + else + puts "no" + end + else + puts "no" + exit 0 + end + else + plist("'ruby /usr/sbin/puppetmasterd'") if $0 =~ /puppet_mem$/ + if $0 =~ /puppet_clients$/ + puts "known_clients.value #{Dir.entries(facts_dir).size-2}" + phaselog(logfile) + end end diff --git a/manifests/master/munin.pp b/manifests/master/munin.pp index b455240..ca6fddc 100644 --- a/manifests/master/munin.pp +++ b/manifests/master/munin.pp @@ -1,10 +1,13 @@ +# deploy puppet munin plugin class puppet::master::munin { - - munin::plugin::deploy { - [ 'puppetmaster_memory', 'puppet_clients' ]: - source => "puppet/munin/puppet_", - config => "user root -env.puppet_logfile /var/log/puppet/puppetmaster.log" + munin::plugin::deploy{'puppet_': + ensure => absent, + source => 'puppet/munin/puppet_'; + } + munin::plugin{ + ['puppet_clients','puppet_mem']: + ensure => 'puppet_', + require => Munin::Plugin::Deploy['puppet_'], + config => 'user root'; } - } -- cgit v1.2.3 From 6d79119d50d834b547f305cc3363f81f18d4ff15 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 7 Dec 2012 13:39:20 +0100 Subject: fix an issue if nothing got compiled --- files/munin/puppet_ | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/munin/puppet_ b/files/munin/puppet_ index 279f5ab..0fc8e52 100644 --- a/files/munin/puppet_ +++ b/files/munin/puppet_ @@ -49,7 +49,7 @@ def phaselog(logfile) end end end - puts "avg_compile.value #{(avg / count).to_s[0..3]}" unless count == 0 + puts "avg_compile.value #{count == 0 ? 0 : (avg / count).to_s[0..3]}" puts "last5m_count.value #{count}" puts "last24h_unique_count.value #{day_count_unique}" end -- cgit v1.2.3 From b36d79a7ae60660c4dc6ec5a176fc2a8abe70024 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 7 Apr 2013 23:20:16 +0200 Subject: also use new naming convention on linux --- manifests/cron/linux.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/cron/linux.pp b/manifests/cron/linux.pp index 5452cc7..b90464a 100644 --- a/manifests/cron/linux.pp +++ b/manifests/cron/linux.pp @@ -5,7 +5,7 @@ class puppet::cron::linux inherits puppet::linux { File['/etc/cron.d/puppetd.cron']{ source => undef, - content => "#run puppet\n$puppet::cron::base::crontime root output=\$(/usr/sbin/puppetd --onetime --no-daemonize --splay --config=/etc/puppet/puppet.conf --color false ${puppet::cron::base::http_compression_str}); ret=\$?; printf \"\\%s\" \"\$output\" | grep -E '(^err:|^alert:|^emerg:|^crit:)'; exit \$ret\n", + content => "#run puppet\n$puppet::cron::base::crontime root output=\$(/usr/sbin/puppet agent --onetime --no-daemonize --splay --config=/etc/puppet/puppet.conf --color false ${puppet::cron::base::http_compression_str}); ret=\$?; printf \"\\%s\" \"\$output\" | grep -E '(^err:|^alert:|^emerg:|^crit:)'; exit \$ret\n", before => Service['puppet'], } } -- cgit v1.2.3 From 679ddb1731b895021f6ee028910fe80a8cb88e66 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 8 Apr 2013 20:49:57 +0200 Subject: puppet is in bin not sbin --- manifests/cron/linux.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/cron/linux.pp b/manifests/cron/linux.pp index b90464a..9b69dc1 100644 --- a/manifests/cron/linux.pp +++ b/manifests/cron/linux.pp @@ -5,7 +5,7 @@ class puppet::cron::linux inherits puppet::linux { File['/etc/cron.d/puppetd.cron']{ source => undef, - content => "#run puppet\n$puppet::cron::base::crontime root output=\$(/usr/sbin/puppet agent --onetime --no-daemonize --splay --config=/etc/puppet/puppet.conf --color false ${puppet::cron::base::http_compression_str}); ret=\$?; printf \"\\%s\" \"\$output\" | grep -E '(^err:|^alert:|^emerg:|^crit:)'; exit \$ret\n", + content => "#run puppet\n$puppet::cron::base::crontime root output=\$(/usr/bin/puppet agent --onetime --no-daemonize --splay --config=/etc/puppet/puppet.conf --color false ${puppet::cron::base::http_compression_str}); ret=\$?; printf \"\\%s\" \"\$output\" | grep -E '(^err:|^alert:|^emerg:|^crit:)'; exit \$ret\n", before => Service['puppet'], } } -- cgit v1.2.3 From ee2d7ea220bed64304577aa3d926782d57c26f6d Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 20 May 2013 15:49:40 +0200 Subject: update to latest config.ru --- files/master/config.ru | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/files/master/config.ru b/files/master/config.ru index cec2a34..984017e 100644 --- a/files/master/config.ru +++ b/files/master/config.ru @@ -2,28 +2,35 @@ # SSL needs to be handled outside this, though. # if puppet is not in your RUBYLIB: -# $:.unshift('/opt/puppet/lib') +# $LOAD_PATH.unshift('/opt/puppet/lib') -$0 = "puppetmasterd" -require 'puppet' - -# logs to file instead of syslog -#Puppet::Util::Log.newdestination("/var/log/puppet/puppetmasterd.log") +$0 = "master" # if you want debugging: -#ARGV << "--debug" +# ARGV << "--debug" ARGV << "--rack" -# in some setups puppetmasterd doesn't seem to read the puppet.conf -# config at startup, then you need to pass these options: -ARGV << "--vardir" << "/var/lib/puppet" -ARGV << "--ssldir" << "/var/lib/puppet/ssl" - -# if you use puppet-dashboard: -#ARGV << "--reports" << "puppet_dashboard" - -require 'puppet/application/puppetmasterd' +# Rack applications typically don't start as root. Set --confdir and --vardir +# to prevent reading configuration from ~puppet/.puppet/puppet.conf and writing +# to ~puppet/.puppet +ARGV << "--confdir" << "/etc/puppet" +ARGV << "--vardir" << "/var/lib/puppet" + +# NOTE: it's unfortunate that we have to use the "CommandLine" class +# here to launch the app, but it contains some initialization logic +# (such as triggering the parsing of the config file) that is very +# important. We should do something less nasty here when we've +# gotten our API and settings initialization logic cleaned up. +# +# Also note that the "$0 = master" line up near the top here is +# the magic that allows the CommandLine class to know that it's +# supposed to be running master. +# +# --cprice 2012-05-22 + +require 'puppet/util/command_line' # we're usually running inside a Rack::Builder.new {} block, # therefore we need to call run *here*. -run Puppet::Application[:puppetmasterd].run +run Puppet::Util::CommandLine.new.execute + -- cgit v1.2.3 From 9eb6c4f0e5fec4d24b0480b186ce83f490d68b80 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 20 May 2013 16:00:05 +0200 Subject: fix inheriting --- manifests/master/passenger.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/master/passenger.pp b/manifests/master/passenger.pp index 03e1aa4..0aa489b 100644 --- a/manifests/master/passenger.pp +++ b/manifests/master/passenger.pp @@ -1,6 +1,6 @@ # class to use passenger for serving puppetmaster -class puppet::master::passenger inherits puppet::master::base { +class puppet::master::passenger inherits puppet::master { include ::passenger -- cgit v1.2.3 From 4fabfbd53cfb7c35cf7ad9ff03b6b38d4daed7b4 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 20 May 2013 16:04:07 +0200 Subject: if it runs with passenger there is no such service --- manifests/master/centos.pp | 19 ++++++++++++------- manifests/master/linux.pp | 6 +++--- manifests/master/package/base.pp | 6 ++++-- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/manifests/master/centos.pp b/manifests/master/centos.pp index 82a8436..b684174 100644 --- a/manifests/master/centos.pp +++ b/manifests/master/centos.pp @@ -1,12 +1,17 @@ # 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; + 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' ], + owner => root, + group => 0, + mode => '0644'; + } + if $puppet::master::mode != 'passenger' { + File['/etc/sysconfig/puppetmaster']{ + notify => Service[puppetmaster], + } } } diff --git a/manifests/master/linux.pp b/manifests/master/linux.pp index d2fb5b1..e52db63 100644 --- a/manifests/master/linux.pp +++ b/manifests/master/linux.pp @@ -11,8 +11,8 @@ class puppet::master::linux inherits puppet::linux { enable => true, require => [ Package[puppet] ], } - } - Service[puppet]{ - require +> Service[puppetmaster], + Service[puppet]{ + require +> Service[puppetmaster], + } } } diff --git a/manifests/master/package/base.pp b/manifests/master/package/base.pp index 0a1fa33..2851747 100644 --- a/manifests/master/package/base.pp +++ b/manifests/master/package/base.pp @@ -4,7 +4,9 @@ class puppet::master::package::base inherits puppet::master::package { ensure => $puppet::ensure_version, } - Service['puppetmaster']{ - require +> Package['puppetmaster'], + if $puppet::master::mode != 'passenger' { + Service['puppetmaster']{ + require +> Package['puppetmaster'], + } } } -- cgit v1.2.3 From d2852466f2961f9af46057f9410b5d96457337f8 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 20 May 2013 21:56:53 +0200 Subject: add a simple dashboard setup --- manifests/master/dashboard.pp | 47 +++++++++++++++ templates/master/dashboard/database.yml.erb | 8 +++ templates/master/dashboard/settings.yml.erb | 90 +++++++++++++++++++++++++++++ 3 files changed, 145 insertions(+) create mode 100644 manifests/master/dashboard.pp create mode 100644 templates/master/dashboard/database.yml.erb create mode 100644 templates/master/dashboard/settings.yml.erb diff --git a/manifests/master/dashboard.pp b/manifests/master/dashboard.pp new file mode 100644 index 0000000..16d796e --- /dev/null +++ b/manifests/master/dashboard.pp @@ -0,0 +1,47 @@ +class puppet::master::dashboard( + $settings = {}, + $service = true, + $mysql_password, +) { + + package{'puppet-dashboard': + ensure => installed, + } -> mysql::default_database{ + 'dashboard': + password => $mysql_password; + } -> file{ + '/usr/share/puppet-dashboard/config/database.yaml': + content => template('puppet/master/dashboard/database.yaml.erb'), + owner => 'puppet-dashboard', + group => 'puppet-dashboard', + mode => '0640'; + '/usr/share/puppet-dashboard/config/settings.yaml': + content => template('puppet/master/dashboard/settings.yaml.erb'), + owner => 'puppet-dashboard', + group => 'puppet-dashboard', + mode => '0640'; + } ~> exec{ + 'rake RAILS_ENV=production db:migrate': + cwd => '/usr/share/puppet-dashboard', + user => 'puppet-dashboard', + refreshonly => true; + } -> service{ + 'puppet-dashboard-workers': + ensure => running, + enable => true; + } + + service{'puppet-dashboard': } + if $service { + Service['puppet-dashboard']{ + ensure => running, + enable => true, + subscribe => File['/usr/share/puppet-dashboard/config/database.yaml','/usr/share/puppet-dashboard/config/settings.yaml'], + } + } else { + Service['puppet-dashboard']{ + ensure => stopped, + enable => false, + } + } +} diff --git a/templates/master/dashboard/database.yml.erb b/templates/master/dashboard/database.yml.erb new file mode 100644 index 0000000..df7a376 --- /dev/null +++ b/templates/master/dashboard/database.yml.erb @@ -0,0 +1,8 @@ +production: + adapter: mysql + database: 'dashboard', + host: 'localhost' + username: 'dashboard' + password: '<%= mysql_password %>' + encoding: utf8 + diff --git a/templates/master/dashboard/settings.yml.erb b/templates/master/dashboard/settings.yml.erb new file mode 100644 index 0000000..24f82a2 --- /dev/null +++ b/templates/master/dashboard/settings.yml.erb @@ -0,0 +1,90 @@ +#===[ Settings ]========================================================= +# +# This file is meant for storing setting information that is never +# published or committed to a revision control system. +# +# Do not modify this "config/settings.yml.example" file directly -- you +# should copy it to "config/settings.yml" and customize it there. +# +#---[ Values ]---------------------------------------------------------- + +# Node name to use when contacting the puppet master. This is the +# CN that is used in Dashboard's certificate. +cn_name: 'dashboard' + +ca_crl_path: 'certs/dashboard.ca_crl.pem' + +ca_certificate_path: 'certs/dashboard.ca_cert.pem' + +certificate_path: 'certs/dashboard.cert.pem' + +private_key_path: 'certs/dashboard.private_key.pem' + +public_key_path: 'certs/dashboard.public_key.pem' + +# Hostname of the certificate authority. +ca_server: 'puppet' + +# Port for the certificate authority. +ca_port: 8140 + +# Key length for SSL certificates +key_length: 1024 + +# The "inventory service" allows you to connect to a puppet master to retrieve and node facts +enable_inventory_service: false + +# Hostname of the inventory server. +inventory_server: 'puppet' + +# Port for the inventory server. +inventory_port: 8140 + +# Set this to true to allow Dashboard to display diffs on files that +# are archived in the file bucket. +use_file_bucket_diffs: false + +# Hostname of the file bucket server. +file_bucket_server: 'puppet' + +# Port for the file bucket server. +file_bucket_port: 8140 + +# Amount of time in seconds since last report before a node is considered no longer reporting +no_longer_reporting_cutoff: 3600 + +# How many days of history to display on the "Daily Run Status" graph +daily_run_history_length: 30 + +use_external_node_classification: true + +# Uncomment the following line to set a local time zone. Run +# "rake time:zones:local" for the name of your local time zone. +#time_zone: 'Pacific Time (US & Canada)' + +# Look at http://ruby-doc.org/core/classes/Time.html#M000298 for the strftime formatting +datetime_format: '%Y-%m-%d %H:%M %Z' +date_format: '%A, %B %e, %Y' + +# Set this to the URL of an image. The image will be scaled to the specified dimensions. +custom_logo_url: '/images/dashboard_logo.png' +custom_logo_width: 155px +custom_logo_height: 23px +custom_logo_alt_text: 'Puppet Dashboard' + +# We will be deprecating using "http://dashboard_servername/reports" as the puppet master's reporturl. +# Set this to 'true' once you have changed all your puppet masters to send reports to +# "http://dashboard_servername/reports/upload" +disable_legacy_report_upload_url: false + +# Disables the UI and controller actions for editing nodes, classes, groups and reports. Report submission is still allowed +enable_read_only_mode: <%= settings['enable_read_only_mode'] || false %> + +# Default number of items of each kind to display per page +nodes_per_page: 20 +classes_per_page: 50 +groups_per_page: 50 +reports_per_page: 20 + +#===[ fin ]============================================================= + -- cgit v1.2.3 From 7efe3fd46d97ad1a3be52e4b642f51bace5ac35e Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 20 May 2013 22:04:11 +0200 Subject: correct naming --- manifests/master/dashboard.pp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/manifests/master/dashboard.pp b/manifests/master/dashboard.pp index 16d796e..951ece2 100644 --- a/manifests/master/dashboard.pp +++ b/manifests/master/dashboard.pp @@ -10,14 +10,14 @@ class puppet::master::dashboard( 'dashboard': password => $mysql_password; } -> file{ - '/usr/share/puppet-dashboard/config/database.yaml': - content => template('puppet/master/dashboard/database.yaml.erb'), - owner => 'puppet-dashboard', + '/usr/share/puppet-dashboard/config/database.yml': + content => template('puppet/master/dashboard/database.yml.erb'), + owner => root, group => 'puppet-dashboard', mode => '0640'; - '/usr/share/puppet-dashboard/config/settings.yaml': - content => template('puppet/master/dashboard/settings.yaml.erb'), - owner => 'puppet-dashboard', + '/usr/share/puppet-dashboard/config/settings.yml': + content => template('puppet/master/dashboard/settings.yml.erb'), + owner => root, group => 'puppet-dashboard', mode => '0640'; } ~> exec{ @@ -36,7 +36,7 @@ class puppet::master::dashboard( Service['puppet-dashboard']{ ensure => running, enable => true, - subscribe => File['/usr/share/puppet-dashboard/config/database.yaml','/usr/share/puppet-dashboard/config/settings.yaml'], + subscribe => File['/usr/share/puppet-dashboard/config/database.yml','/usr/share/puppet-dashboard/config/settings.yml'], } } else { Service['puppet-dashboard']{ -- cgit v1.2.3 From e7268a8b4dc50898bbcc0701231bb0ca64644b6f Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 20 May 2013 22:19:35 +0200 Subject: fix template --- templates/master/dashboard/database.yml.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/master/dashboard/database.yml.erb b/templates/master/dashboard/database.yml.erb index df7a376..f501c33 100644 --- a/templates/master/dashboard/database.yml.erb +++ b/templates/master/dashboard/database.yml.erb @@ -1,6 +1,6 @@ production: adapter: mysql - database: 'dashboard', + database: 'dashboard' host: 'localhost' username: 'dashboard' password: '<%= mysql_password %>' -- cgit v1.2.3 From 475e2ea70e95cffad367865b90f684e14fd5f642 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 20 May 2013 22:20:30 +0200 Subject: so far this is only localhost --- manifests/master/dashboard.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/master/dashboard.pp b/manifests/master/dashboard.pp index 951ece2..400142e 100644 --- a/manifests/master/dashboard.pp +++ b/manifests/master/dashboard.pp @@ -8,7 +8,8 @@ class puppet::master::dashboard( ensure => installed, } -> mysql::default_database{ 'dashboard': - password => $mysql_password; + password => $mysql_password, + host => '127.0.0.1'; } -> file{ '/usr/share/puppet-dashboard/config/database.yml': content => template('puppet/master/dashboard/database.yml.erb'), -- cgit v1.2.3 From 98a7e0361ff7523fa86e460e7e2f03b37fd53956 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 20 May 2013 22:28:14 +0200 Subject: this should be passed as a mysql hash here --- manifests/master/dashboard.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/master/dashboard.pp b/manifests/master/dashboard.pp index 400142e..7c02247 100644 --- a/manifests/master/dashboard.pp +++ b/manifests/master/dashboard.pp @@ -8,7 +8,7 @@ class puppet::master::dashboard( ensure => installed, } -> mysql::default_database{ 'dashboard': - password => $mysql_password, + password => mysql_password($mysql_password), host => '127.0.0.1'; } -> file{ '/usr/share/puppet-dashboard/config/database.yml': -- cgit v1.2.3 From c2ae508d3ee3719c98767cc8a09e0bab52ff0f58 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 20 May 2013 22:31:38 +0200 Subject: use ip instead of hostname --- templates/master/dashboard/database.yml.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/master/dashboard/database.yml.erb b/templates/master/dashboard/database.yml.erb index f501c33..f871e72 100644 --- a/templates/master/dashboard/database.yml.erb +++ b/templates/master/dashboard/database.yml.erb @@ -1,7 +1,7 @@ production: adapter: mysql database: 'dashboard' - host: 'localhost' + host: '127.0.0.1' username: 'dashboard' password: '<%= mysql_password %>' encoding: utf8 -- cgit v1.2.3 From 21b0cc1f2633be37b11a78b255ae06983494a2a2 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 20 May 2013 22:33:05 +0200 Subject: enable a different setting to be set --- templates/master/dashboard/settings.yml.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/master/dashboard/settings.yml.erb b/templates/master/dashboard/settings.yml.erb index 24f82a2..27d2bd5 100644 --- a/templates/master/dashboard/settings.yml.erb +++ b/templates/master/dashboard/settings.yml.erb @@ -51,7 +51,7 @@ file_bucket_server: 'puppet' file_bucket_port: 8140 # Amount of time in seconds since last report before a node is considered no longer reporting -no_longer_reporting_cutoff: 3600 +no_longer_reporting_cutoff: <%= settings['no_longer_reporting_cutoff'] || 3600 %> # How many days of history to display on the "Daily Run Status" graph daily_run_history_length: 30 @@ -78,7 +78,7 @@ custom_logo_alt_text: 'Puppet Dashboard' disable_legacy_report_upload_url: false # Disables the UI and controller actions for editing nodes, classes, groups and reports. Report submission is still allowed -enable_read_only_mode: <%= settings['enable_read_only_mode'] || false %> +enable_read_only_mode: <%= settings['enable_read_only_mode'] || 'false' %> # Default number of items of each kind to display per page nodes_per_page: 20 -- cgit v1.2.3 From 98c84c83bdeec6ca245318497597be3c74633990 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 5 Aug 2013 12:29:36 +0200 Subject: silence the lastrun output on only successfull runs --- manifests/master/checklastrun.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/master/checklastrun.pp b/manifests/master/checklastrun.pp index b80bb56..5375cc0 100644 --- a/manifests/master/checklastrun.pp +++ b/manifests/master/checklastrun.pp @@ -18,7 +18,7 @@ class puppet::master::checklastrun { owner => root, group => 0, mode => 0700; '/etc/cron.d/puppetlast.cron': - content => "${puppet::master::lastruncheck_cron} root /usr/local/sbin/puppetlast ${puppet_lastruncheck_timeout_str} ${puppet_lastruncheck_ignorehosts_str} ${puppet::master::lastruncheck_additionaloptions}\n", + content => "${puppet::master::lastruncheck_cron} root /usr/local/sbin/puppetlast ${puppet_lastruncheck_timeout_str} ${puppet_lastruncheck_ignorehosts_str} ${puppet::master::lastruncheck_additionaloptions} | grep -Ev '^OK: '\n", require => File["/usr/local/sbin/puppetlast"], owner => root, group => 0, mode => 0644, } -- cgit v1.2.3 From e968708b7ad8420453baf085862edc2c92b52c9b Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 25 Aug 2013 16:07:34 +0200 Subject: add cleanup job --- manifests/master/dashboard.pp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/manifests/master/dashboard.pp b/manifests/master/dashboard.pp index 7c02247..df8bcf8 100644 --- a/manifests/master/dashboard.pp +++ b/manifests/master/dashboard.pp @@ -32,6 +32,18 @@ class puppet::master::dashboard( enable => true; } + file{'/etc/cron.daily/puppet-dashboard_cleanup': + content => "#/bin/bash +cd /usr/share/puppet-dashboard +RAILS_ENV=production /usr/bin/rake reports:prune upto=1 unit=mon >> /usr/share/puppet-dashboard/log/cron.log +RAILS_ENV=production /usr/bin/rake reports:prune:orphaned >> /usr/share/puppet-dashboard/log/cron.log +RAILS_ENV=production /usr/bin/rake db:raw:optimize >> /usr/share/puppet-dashboard/log/cron.log\n", + owner => 'puppet-dashboard', + group => 'puppet-dashboard', + mode => '0755', + require => Service['puppet-dashboard-workers']; + } + service{'puppet-dashboard': } if $service { Service['puppet-dashboard']{ -- cgit v1.2.3 From f7a31af7c4c44ec11ff1fc61c466c4476e9f093c Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 5 Dec 2013 09:53:51 +0100 Subject: make it possible to consume an external database --- manifests/master/dashboard.pp | 29 ++++++++++++++++++++--------- templates/master/dashboard/database.yml.erb | 4 ++-- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/manifests/master/dashboard.pp b/manifests/master/dashboard.pp index df8bcf8..e3d56b5 100644 --- a/manifests/master/dashboard.pp +++ b/manifests/master/dashboard.pp @@ -1,21 +1,32 @@ +# simple installation of a puppet dashboard class puppet::master::dashboard( $settings = {}, $service = true, + $mysql_host = '127.0.0.1', $mysql_password, ) { package{'puppet-dashboard': ensure => installed, - } -> mysql::default_database{ - 'dashboard': - password => mysql_password($mysql_password), - host => '127.0.0.1'; - } -> file{ + } + + if $mysql_host == '127.0.0.1' { + mysql::default_database{ + 'dashboard': + password => mysql_password($mysql_password), + host => '127.0.0.1', + require => Package['puppet-dashboard'], + before => File['/usr/share/puppet-dashboard/config/database.yml'], + } + } + + file{ '/usr/share/puppet-dashboard/config/database.yml': content => template('puppet/master/dashboard/database.yml.erb'), owner => root, group => 'puppet-dashboard', - mode => '0640'; + mode => '0640', + require => Package['puppet-dashboard']; '/usr/share/puppet-dashboard/config/settings.yml': content => template('puppet/master/dashboard/settings.yml.erb'), owner => root, @@ -33,7 +44,7 @@ class puppet::master::dashboard( } file{'/etc/cron.daily/puppet-dashboard_cleanup': - content => "#/bin/bash + content => "#/bin/bash cd /usr/share/puppet-dashboard RAILS_ENV=production /usr/bin/rake reports:prune upto=1 unit=mon >> /usr/share/puppet-dashboard/log/cron.log RAILS_ENV=production /usr/bin/rake reports:prune:orphaned >> /usr/share/puppet-dashboard/log/cron.log @@ -47,8 +58,8 @@ RAILS_ENV=production /usr/bin/rake db:raw:optimize >> /usr/share/puppet-dashboar service{'puppet-dashboard': } if $service { Service['puppet-dashboard']{ - ensure => running, - enable => true, + ensure => running, + enable => true, subscribe => File['/usr/share/puppet-dashboard/config/database.yml','/usr/share/puppet-dashboard/config/settings.yml'], } } else { diff --git a/templates/master/dashboard/database.yml.erb b/templates/master/dashboard/database.yml.erb index f871e72..5c39db5 100644 --- a/templates/master/dashboard/database.yml.erb +++ b/templates/master/dashboard/database.yml.erb @@ -1,8 +1,8 @@ production: adapter: mysql database: 'dashboard' - host: '127.0.0.1' + host: '<%= @mysql_host %>' username: 'dashboard' - password: '<%= mysql_password %>' + password: '<%= @mysql_password %>' encoding: utf8 -- cgit v1.2.3 From 8db4cf07c117d62c92b6ff2c46948e7fc4b74c2e Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 5 Dec 2013 11:49:56 +0100 Subject: make it possible to pass the content of the config from outside --- manifests/base.pp | 53 +++++++++++++++++++++++++++------------------ manifests/cron.pp | 21 ++++++++++-------- manifests/init.pp | 19 ++++++++-------- manifests/master.pp | 62 +++++++++++++++++++++++++++-------------------------- 4 files changed, 86 insertions(+), 69 deletions(-) diff --git a/manifests/base.pp b/manifests/base.pp index 9e597a8..5cb4c5d 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -1,3 +1,4 @@ +# configure general things of puppet class puppet::base { $puppet_majorversion = regsubst($::puppetversion,'^(\d+\.\d+).*$','\1') @@ -5,35 +6,45 @@ class puppet::base { # if not set, don't do anything '',undef,false: {} default: { - tidy { "/var/lib/puppet/clientbucket": - backup => false, + tidy { '/var/lib/puppet/clientbucket': + backup => false, recurse => true, - rmdirs => true, - type => mtime, - age => "$puppet::cleanup_clientbucket"; + rmdirs => true, + type => mtime, + age => $puppet::cleanup_clientbucket; } } } file { 'puppet_config': - path => $puppet::config, - source => [ "puppet:///modules/site_puppet/client/${::fqdn}/puppet.conf", - "puppet:///modules/site_puppet/client/puppet.conf.${::operatingsystem}", - "puppet:///modules/site_puppet/client/puppet.conf", - "puppet:///modules/puppet/client/${puppet_majorversion}/puppet.conf.${::operatingsystem}", - "puppet:///modules/puppet/client/${puppet_majorversion}/puppet.conf", - "puppet:///modules/puppet/client/puppet.conf.${::operatingsystem}", - "puppet:///modules/puppet/client/puppet.conf" ], - notify => Service[puppet], - # if puppetmasterd is deployed by apache2/passenger it needs to read puppet.conf - # therefore it must be readable by puppet - owner => puppet, group => 0, mode => 600; + path => $puppet::config, + notify => Service[puppet], + # if puppetmasterd is deployed by apache2/passenger it needs + # to read puppet.conf. therefore it must be readable by puppet + owner => puppet, + group => 0, + mode => '0600'; + } + if $puppet::config_content { + File['puppet_config'] { + content => $puppet::config_content + } + } else { + File['puppet_config'] { + source => [ "puppet:///modules/site_puppet/client/${::fqdn}/puppet.conf", + "puppet:///modules/site_puppet/client/puppet.conf.${::operatingsystem}", + 'puppet:///modules/site_puppet/client/puppet.conf', + "puppet:///modules/puppet/client/${puppet_majorversion}/puppet.conf.${::operatingsystem}", + "puppet:///modules/puppet/client/${puppet_majorversion}/puppet.conf", + "puppet:///modules/puppet/client/puppet.conf.${::operatingsystem}", + 'puppet:///modules/puppet/client/puppet.conf' ] + } } service { 'puppet': - ensure => running, - enable => true, - hasstatus => true, - hasrestart => true, + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, } } diff --git a/manifests/cron.pp b/manifests/cron.pp index b4d9140..2e54a66 100644 --- a/manifests/cron.pp +++ b/manifests/cron.pp @@ -1,17 +1,20 @@ +# run puppet agent as cron class puppet::cron( $cron_time, - $stop_service = true, - $config = '/etc/puppet/puppet.conf', - $http_compression = 'puppet_http_compression', - $cleanup_clientbucket = false, - $ensure_version = 'installed', - $ensure_facter_version = 'installed', - $shorewall_puppetmaster = false, - $shorewall_puppetmaster_port = '8140', - $shorewall_puppetmaster_signport = '8141' + $stop_service = true, + $config = '/etc/puppet/puppet.conf', + $config_content = false, + $http_compression = 'puppet_http_compression', + $cleanup_clientbucket = false, + $ensure_version = 'installed', + $ensure_facter_version = 'installed', + $shorewall_puppetmaster = false, + $shorewall_puppetmaster_port = '8140', + $shorewall_puppetmaster_signport = '8141' ) { class{'puppet': config => $config, + config_content => $config_content, http_compression => $http_compression, cleanup_clientbucket => $cleanup_clientbucket, ensure_version => $ensure_version, diff --git a/manifests/init.pp b/manifests/init.pp index 3a71ed0..e85447b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -17,16 +17,17 @@ # General Public License version 3 as published by # the Free Software Foundation. # - +# Manage the puppet client class puppet( - $config = '/etc/puppet/puppet.conf', - $http_compression = false, - $cleanup_clientbucket = false, - $ensure_version = 'installed', - $ensure_facter_version = 'installed', - $shorewall_puppetmaster = false, - $shorewall_puppetmaster_port = 8140, - $shorewall_puppetmaster_signport = 8141 + $config = '/etc/puppet/puppet.conf', + $config_content = false, + $http_compression = false, + $cleanup_clientbucket = false, + $ensure_version = 'installed', + $ensure_facter_version = 'installed', + $shorewall_puppetmaster = false, + $shorewall_puppetmaster_port = 8140, + $shorewall_puppetmaster_signport = 8141 ){ case $::kernel { linux: { diff --git a/manifests/master.pp b/manifests/master.pp index af7794b..efff8e9 100644 --- a/manifests/master.pp +++ b/manifests/master.pp @@ -1,42 +1,44 @@ # manifests/puppetmaster.pp class puppet::master( - $config = '/etc/puppet/puppet.conf', - $fileserver = '/etc/puppet/fileserver.conf', - $http_compression = false, - $cleanup_clientbucket = false, - $cron_time = false, - $ensure_version = 'installed', - $ensure_facter_version = 'installed', - $lastruncheck_cron = '40 10 * * *', - $lastruncheck_ignorehosts = '', - $lastruncheck_timeout = '', - $lastruncheck_additionaloptions = '', - $mode = 'webrick', - $cleanup_reports = '30', - $reports_dir = '/var/lib/puppet/reports', - $shorewall_puppetmaster = "domain.${::domain}", - $shorewall_puppetmaster_port = 8140, - $shorewall_puppetmaster_signport = 8141, - $manage_munin = false + $config = '/etc/puppet/puppet.conf', + $config_content = false, + $fileserver = '/etc/puppet/fileserver.conf', + $http_compression = false, + $cleanup_clientbucket = false, + $cron_time = false, + $ensure_version = 'installed', + $ensure_facter_version = 'installed', + $lastruncheck_cron = '40 10 * * *', + $lastruncheck_ignorehosts = '', + $lastruncheck_timeout = '', + $lastruncheck_additionaloptions = '', + $mode = 'webrick', + $cleanup_reports = '30', + $reports_dir = '/var/lib/puppet/reports', + $shorewall_puppetmaster = "domain.${::domain}", + $shorewall_puppetmaster_port = 8140, + $shorewall_puppetmaster_signport = 8141, + $manage_munin = false ) { if $cron_time { class{'puppet::cron': - config => $config, - http_compression => $http_compression, - cleanup_clientbucket => $cleanup_clientbucket, - cron_time => $cron_time, - ensure_version => $ensure_version, - ensure_facter_version => $ensure_facter_version, - shorewall_puppetmaster => $shorewall_puppetmaster, - shorewall_puppetmaster_port => $shorewall_puppetmaster_port, + config => $config, + config_content => $config_content, + http_compression => $http_compression, + cleanup_clientbucket => $cleanup_clientbucket, + cron_time => $cron_time, + ensure_version => $ensure_version, + ensure_facter_version => $ensure_facter_version, + shorewall_puppetmaster => $shorewall_puppetmaster, + shorewall_puppetmaster_port => $shorewall_puppetmaster_port, shorewall_puppetmaster_signport => $shorewall_puppetmaster_signport, } } else { class{'puppet': - config => $config, - http_compression => $http_compression, - cleanup_clientbucket => $cleanup_clientbucket, - ensure_version => $ensure_version, + config => $config, + http_compression => $http_compression, + cleanup_clientbucket => $cleanup_clientbucket, + ensure_version => $ensure_version, ensure_facter_version => $ensure_facter_version, } } -- cgit v1.2.3 From e5e2211dc0baf540d62eaf1df8775d6b05193da1 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 5 Dec 2013 12:11:35 +0100 Subject: fix source if we pass config_content --- manifests/master/base.pp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/manifests/master/base.pp b/manifests/master/base.pp index 390d9b5..38658ca 100644 --- a/manifests/master/base.pp +++ b/manifests/master/base.pp @@ -1,16 +1,19 @@ +# overwrite a few things for the master class puppet::master::base inherits puppet::base { file { $puppet::master::fileserver: source => [ "puppet:///modules/site_puppet/master/${::fqdn}/fileserver.conf", - "puppet:///modules/site_puppet/master/fileserver.conf", - "puppet:///modules/puppet/master/fileserver.conf" ], + 'puppet:///modules/site_puppet/master/fileserver.conf', + 'puppet:///modules/puppet/master/fileserver.conf' ], owner => root, group => puppet, mode => 640; } - File['puppet_config']{ - source => [ "puppet:///modules/site_puppet/master/${::fqdn}/puppet.conf", - "puppet:///modules/site_puppet/master/puppet.conf", - "puppet:///modules/puppet/master/puppet.conf" ] + if !$puppet::master::config_content { + File['puppet_config']{ + source => [ "puppet:///modules/site_puppet/master/${::fqdn}/puppet.conf", + 'puppet:///modules/site_puppet/master/puppet.conf', + 'puppet:///modules/puppet/master/puppet.conf' ] + } } if $puppet::master::storeconfigs { -- cgit v1.2.3 From cf73e775ea97cc53e2671efcc0ae03903a101bd3 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 5 Dec 2013 12:12:19 +0100 Subject: linting --- manifests/master/base.pp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/manifests/master/base.pp b/manifests/master/base.pp index 38658ca..4931264 100644 --- a/manifests/master/base.pp +++ b/manifests/master/base.pp @@ -2,10 +2,12 @@ class puppet::master::base inherits puppet::base { file { $puppet::master::fileserver: - source => [ "puppet:///modules/site_puppet/master/${::fqdn}/fileserver.conf", + 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; + owner => root, + group => puppet, + mode => '0640'; } if !$puppet::master::config_content { -- cgit v1.2.3 From 166efbbc871637517f4da6c3db4f2e38a15012d3 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 18 Apr 2014 11:08:48 +0200 Subject: address puppet 3.x deprecation warnings --- templates/master/dashboard/settings.yml.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/master/dashboard/settings.yml.erb b/templates/master/dashboard/settings.yml.erb index 27d2bd5..95b79c9 100644 --- a/templates/master/dashboard/settings.yml.erb +++ b/templates/master/dashboard/settings.yml.erb @@ -51,7 +51,7 @@ file_bucket_server: 'puppet' file_bucket_port: 8140 # Amount of time in seconds since last report before a node is considered no longer reporting -no_longer_reporting_cutoff: <%= settings['no_longer_reporting_cutoff'] || 3600 %> +no_longer_reporting_cutoff: <%= @settings['no_longer_reporting_cutoff'] || 3600 %> # How many days of history to display on the "Daily Run Status" graph daily_run_history_length: 30 @@ -78,7 +78,7 @@ custom_logo_alt_text: 'Puppet Dashboard' disable_legacy_report_upload_url: false # Disables the UI and controller actions for editing nodes, classes, groups and reports. Report submission is still allowed -enable_read_only_mode: <%= settings['enable_read_only_mode'] || 'false' %> +enable_read_only_mode: <%= @settings['enable_read_only_mode'] || 'false' %> # Default number of items of each kind to display per page nodes_per_page: 20 -- cgit v1.2.3 From bec5b0675a2b8fb0a5003b4155e235435df5b041 Mon Sep 17 00:00:00 2001 From: tr Date: Sat, 3 May 2014 19:16:39 +0200 Subject: change char to us-ascii --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index e85447b..0667ba6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -9,7 +9,7 @@ # # Copyright 2008, admin(at)immerda.ch # Copyright 2008, Puzzle ITC GmbH -# Marcel Härry haerry+puppet(at)puzzle.ch +# Marcel Haerry haerry+puppet(at)puzzle.ch # Simon Josi josi+puppet(at)puzzle.ch # # This program is free software; you can redistribute -- cgit v1.2.3 From da308e957c8713f440d22609983e8fb0dd078696 Mon Sep 17 00:00:00 2001 From: tr Date: Sat, 3 May 2014 20:47:47 +0200 Subject: update the puppetmaster puppet.conf to puppetversion > 3.5 --- files/master/puppet.conf | 107 ++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 72 deletions(-) diff --git a/files/master/puppet.conf b/files/master/puppet.conf index cf50317..893dfb6 100644 --- a/files/master/puppet.conf +++ b/files/master/puppet.conf @@ -1,73 +1,36 @@ [main] - confdir=/srv/puppet/etc - - # Where Puppet stores dynamic and growing data. - # The default value is '/var/puppet'. - vardir = /srv/puppet - - # The Puppet log directory. - # The default value is '$vardir/log'. - logdir = /var/log/puppet - - # Where Puppet PID files are kept. - # The default value is '$vardir/run'. - rundir = /var/run/puppet - - # Where SSL certificates are kept. - # The default value is '$confdir/ssl'. - ssldir = $vardir/ssl - - factpath = $vardir/lib/facter - plugindest = $vardir/lib/puppet - -[puppetd] - # The file in which puppetd stores a list of the classes - # associated with the retrieved configuratiion. Can be loaded in - # the separate ``puppet`` executable using the ``--loadclasses`` - # option. - # The default value is '$confdir/classes.txt'. - classfile = $vardir/classes.txt - - # Where puppetd caches the local configuration. An - # extension indicating the cache format is added automatically. - # The default value is '$confdir/localconfig'. - localconfig = $vardir/localconfig - - report=true - pluginsync = true - factsync=true - - logdest=/var/log/puppet/puppet.log - -[puppetmasterd] - reportdir = $logdir/reports - autoflush = true - storeconfigs=true - dbadapter=mysql - dbserver=localhost - dbuser=puppet - dbpassword=**************** - dbsocket=/var/lib/mysql/mysql.sock - - #usage for clusters - #ssl_client_header=HTTP_X_SSL_SUBJECT - - # apache2/passenger usage: http://github.com/reductivelabs/puppet/tree/master/ext/rack - ssl_client_header = SSL_CLIENT_S_DN - ssl_client_verify_header = SSL_CLIENT_VERIFY - - - # specify allowed environments - environments=production,development - - # configure environments - [development] - manifest=$vardir/development/etc/manifests/site.pp - modulepath=$vardir/development/modules/ - templatepath=$vardir/development/templates/ - - [production] - manifest=$vardir/production/etc/manifests/site.pp - modulepath=$vardir/production/modules/ - templatepath=$vardir/production/templates/ - + confdir = /etc/puppet + logdir = /var/log/puppet + vardir = /var/lib/puppet + ssldir = $vardir/ssl + rundir = /var/run/puppet + factpath = $vardir/lib/facter + templatedir = $confdir/templates + #certname = puppetmaster01.example.com + #server = puppet.example.com + #user = pe-puppet + #group = pe-puppet + #archive_files = true + #archive_file_server = puppet.example.com + +[master] + #certname = puppetmaster01.example.com + #dns_alt_names = puppetmaster01,puppetmaster01.example.com,puppet,puppet.example.com + #ca_name = 'Puppet CA generated on puppetmaster01.example.com at 2013-08-09 19:11:11 +0000' + reports = http,puppetdb + reporturl = https://localhost:443/reports/upload + #node_terminus = exec + #external_nodes = /etc/puppetlabs/puppet-dashboard/external_node + ssl_client_header = SSL_CLIENT_S_DN + ssl_client_verify_header = SSL_CLIENT_VERIFY + #storeconfigs_backend = puppetdb + #storeconfigs = true + #autosign = true + +[agent] + report = true + classfile = $vardir/classes.txt + localconfig = $vardir/localconfig + graph = true + pluginsync = true + environment = production -- cgit v1.2.3 From 9d2e1f795ed699151eab5920495e20c5a371bea1 Mon Sep 17 00:00:00 2001 From: tr Date: Sat, 3 May 2014 20:48:31 +0200 Subject: update the puppetclient puppet.conf to puppetversion > 3.5 --- files/client/puppet.conf | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/files/client/puppet.conf b/files/client/puppet.conf index 09b47b1..ab8c552 100644 --- a/files/client/puppet.conf +++ b/files/client/puppet.conf @@ -1,25 +1,22 @@ [main] - logdir=/var/log/puppet - vardir=/var/lib/puppet - rundir=/var/run/puppet - - ssldir=$vardir/ssl - - # Where 3rd party plugins and modules are installed - libdir = $vardir/lib - - templatedir=$vardir/templates - modulepath=/etc/puppet/modules - factpath = $libdir/facter + confdir = /etc/puppet + logdir = /var/log/puppet + vardir = /var/lib/puppet + ssldir = $vardir/ssl + rundir = /var/run/puppet + factpath = $vardir/lib/facter + templatedir = $confdir/templates + #certname = puppetmaster01.example.com + #server = puppet.example.com + #user = pe-puppet + #group = pe-puppet + #archive_files = true + #archive_file_server = puppet.example.com -[puppetd] - report=true - pluginsync=true - - # Default environment - environment = production - - # Development environment - [development] - modulepath = /etc/puppet/development/modules - manifest = /etc/puppet/development/manifests/site.pp +[agent] + report = true + classfile = $vardir/classes.txt + localconfig = $vardir/localconfig + graph = true + pluginsync = true + environment = production -- cgit v1.2.3 From 5d8c24d7df0b7078eaa6b4a6a697bd2c6d1301c9 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 28 Jun 2014 19:51:26 +0200 Subject: now all puppet version have a status --- manifests/debian.pp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/manifests/debian.pp b/manifests/debian.pp index 70f8161..67a90cc 100644 --- a/manifests/debian.pp +++ b/manifests/debian.pp @@ -9,19 +9,6 @@ class puppet::debian inherits puppet::linux { owner => root, group => 0, mode => 0644; } - case $::lsbdistcodename { - squeeze,sid: { - $puppet_hasstatus = true - } - default: { - $puppet_hasstatus = false - } - } - - Service[puppet]{ - hasstatus => $puppet_hasstatus, - } - package{ 'puppet-common': ensure => $puppet::ensure_version, } -- cgit v1.2.3 From 3e9785959978ac9a0beae4827aeae802865c9279 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 28 Jun 2014 19:52:22 +0200 Subject: linting --- manifests/debian.pp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/manifests/debian.pp b/manifests/debian.pp index 67a90cc..2ad54ed 100644 --- a/manifests/debian.pp +++ b/manifests/debian.pp @@ -1,12 +1,15 @@ +# debian specific things class puppet::debian inherits puppet::linux { file { '/etc/default/puppet': - source => [ "puppet:///modules/site_puppet/client/debian/${::fqdn}/puppet", + source => ["puppet:///modules/site_puppet/client/debian/${::fqdn}/puppet", "puppet:///modules/site_puppet/client/debian/${::domain}/puppet", - "puppet:///modules/site_puppet/client/debian/puppet", - "puppet:///modules/puppet/client/debian/puppet" ], - notify => Service[puppet], - owner => root, group => 0, mode => 0644; + 'puppet:///modules/site_puppet/client/debian/puppet', + 'puppet:///modules/puppet/client/debian/puppet' ], + notify => Service[puppet], + owner => root, + group => 0, + mode => '0644'; } package{ 'puppet-common': -- cgit v1.2.3 From 7bd09350025f19c4e2e79bafe6e91896b646a6b9 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 9 Jul 2014 23:21:09 +0200 Subject: get rid off lsb facts --- manifests/cron/base.pp | 3 +-- manifests/master/debian.pp | 19 +++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/manifests/cron/base.pp b/manifests/cron/base.pp index e012731..82483df 100644 --- a/manifests/cron/base.pp +++ b/manifests/cron/base.pp @@ -2,8 +2,7 @@ class puppet::cron::base inherits puppet::base { case $::operatingsystem { - debian: { if $::lsbdistcodename != 'lenny' { $stop_service = true } else { $stop_service = false } } - openbsd, ubuntu: { $stop_service = false } + openbsd: { $stop_service = false } default: { $stop_service = true } } diff --git a/manifests/master/debian.pp b/manifests/master/debian.pp index f51a319..5748683 100644 --- a/manifests/master/debian.pp +++ b/manifests/master/debian.pp @@ -1,19 +1,18 @@ +# debian master class puppet::master::debian inherits puppet::master::package { if $puppet::master::mode != 'passenger' { - case $::lsbdistcodename { - squeeze,sid: { - Service['puppetmaster'] { hasstatus => true, hasrestart => true } - } - } + Service['puppetmaster'] { hasstatus => true, hasrestart => true } } file { '/etc/default/puppetmaster': - source => [ "puppet:///modules/site_puppet/master/debian/${::fqdn}/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; + 'puppet:///modules/site_puppet/master/debian/puppetmaster', + 'puppet:///modules/puppet/master/debian/puppetmaster' ], + notify => Service[puppetmaster], + owner => root, + group => 0, + mode => '0644'; } } -- cgit v1.2.3 From c80c781fa05f94ac1c8631e068af98a6839b0a4a Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 30 Aug 2014 13:17:55 +0200 Subject: do privilege drop properly within cron --- manifests/master/dashboard.pp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/manifests/master/dashboard.pp b/manifests/master/dashboard.pp index e3d56b5..4cbee12 100644 --- a/manifests/master/dashboard.pp +++ b/manifests/master/dashboard.pp @@ -46,11 +46,11 @@ class puppet::master::dashboard( file{'/etc/cron.daily/puppet-dashboard_cleanup': content => "#/bin/bash cd /usr/share/puppet-dashboard -RAILS_ENV=production /usr/bin/rake reports:prune upto=1 unit=mon >> /usr/share/puppet-dashboard/log/cron.log -RAILS_ENV=production /usr/bin/rake reports:prune:orphaned >> /usr/share/puppet-dashboard/log/cron.log -RAILS_ENV=production /usr/bin/rake db:raw:optimize >> /usr/share/puppet-dashboard/log/cron.log\n", - owner => 'puppet-dashboard', - group => 'puppet-dashboard', +su - puppet-dashboard -s /bin/bash -c 'RAILS_ENV=production /usr/bin/rake reports:prune upto=1 unit=mon >> /usr/share/puppet-dashboard/log/cron.log' +su - puppet-dashboard -s /bin/bash -c 'RAILS_ENV=production /usr/bin/rake reports:prune:orphaned >> /usr/share/puppet-dashboard/log/cron.log' +su - puppet-dashboard -s /bin/bash -c 'RAILS_ENV=production /usr/bin/rake db:raw:optimize >> /usr/share/puppet-dashboard/log/cron.log'\n", + owner => 'root', + group => 0, mode => '0755', require => Service['puppet-dashboard-workers']; } @@ -60,7 +60,8 @@ RAILS_ENV=production /usr/bin/rake db:raw:optimize >> /usr/share/puppet-dashboar Service['puppet-dashboard']{ ensure => running, enable => true, - subscribe => File['/usr/share/puppet-dashboard/config/database.yml','/usr/share/puppet-dashboard/config/settings.yml'], + subscribe => File['/usr/share/puppet-dashboard/config/database.yml', + '/usr/share/puppet-dashboard/config/settings.yml'], } } else { Service['puppet-dashboard']{ -- cgit v1.2.3 From b8bd7e5c9208feb09019a395374a04437a8122a4 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 30 Aug 2014 13:24:04 +0200 Subject: fix cron name globally + linting --- manifests/cron.pp | 1 - manifests/cron/debian.pp | 7 ------- manifests/cron/linux.pp | 4 ++-- manifests/linux.pp | 11 +++++++---- manifests/master/checklastrun.pp | 16 ++++++++++------ manifests/master/checklastrun/disable.pp | 3 ++- 6 files changed, 21 insertions(+), 21 deletions(-) delete mode 100644 manifests/cron/debian.pp diff --git a/manifests/cron.pp b/manifests/cron.pp index 2e54a66..9a8e777 100644 --- a/manifests/cron.pp +++ b/manifests/cron.pp @@ -24,7 +24,6 @@ class puppet::cron( shorewall_puppetmaster_signport => $shorewall_puppetmaster_signport, } case $::operatingsystem { - debian: { include puppet::cron::debian } openbsd: { include puppet::cron::openbsd } default: { case $::kernel { diff --git a/manifests/cron/debian.pp b/manifests/cron/debian.pp deleted file mode 100644 index 0b4bd61..0000000 --- a/manifests/cron/debian.pp +++ /dev/null @@ -1,7 +0,0 @@ -class puppet::cron::debian inherits puppet::cron::linux { - - File['/etc/cron.d/puppetd.cron']{ - path => '/etc/cron.d/puppetd', - } - -} diff --git a/manifests/cron/linux.pp b/manifests/cron/linux.pp index 9b69dc1..3742d48 100644 --- a/manifests/cron/linux.pp +++ b/manifests/cron/linux.pp @@ -3,9 +3,9 @@ class puppet::cron::linux inherits puppet::linux { include puppet::cron::base - File['/etc/cron.d/puppetd.cron']{ + File['/etc/cron.d/puppetd']{ source => undef, - content => "#run puppet\n$puppet::cron::base::crontime root output=\$(/usr/bin/puppet agent --onetime --no-daemonize --splay --config=/etc/puppet/puppet.conf --color false ${puppet::cron::base::http_compression_str}); ret=\$?; printf \"\\%s\" \"\$output\" | grep -E '(^err:|^alert:|^emerg:|^crit:)'; exit \$ret\n", + content => "#run puppet\n${puppet::cron::base::crontime} root output=\$(/usr/bin/puppet agent --onetime --no-daemonize --splay --config=/etc/puppet/puppet.conf --color false ${puppet::cron::base::http_compression_str}); ret=\$?; printf \"\\%s\" \"\$output\" | grep -E '(^err:|^alert:|^emerg:|^crit:)'; exit \$ret\n", before => Service['puppet'], } } diff --git a/manifests/linux.pp b/manifests/linux.pp index 6fc17ba..7bf3331 100644 --- a/manifests/linux.pp +++ b/manifests/linux.pp @@ -1,3 +1,4 @@ +# puppet on linux class puppet::linux inherits puppet::base { package { 'puppet': @@ -12,10 +13,12 @@ class puppet::linux inherits puppet::base { require => Package[puppet], } - file { '/etc/cron.d/puppetd.cron': - source => [ "puppet:///modules/site_puppet/cron.d/puppetd", + file { '/etc/cron.d/puppetd': + source => ['puppet:///modules/site_puppet/cron.d/puppetd', "puppet:///modules/puppet/cron.d/puppetd.${::operatingsystem}", - "puppet:///modules/puppet/cron.d/puppetd" ], - owner => root, group => 0, mode => 0644, + 'puppet:///modules/puppet/cron.d/puppetd' ], + owner => root, + group => 0, + mode => '0644', } } diff --git a/manifests/master/checklastrun.pp b/manifests/master/checklastrun.pp index 5375cc0..2544acc 100644 --- a/manifests/master/checklastrun.pp +++ b/manifests/master/checklastrun.pp @@ -1,3 +1,4 @@ +# check for last run class puppet::master::checklastrun { $puppet_lastruncheck_ignorehosts_str = $puppet::master::lastruncheck_ignorehosts ? { @@ -14,12 +15,15 @@ class puppet::master::checklastrun { file{ '/usr/local/sbin/puppetlast': - source => [ "puppet:///modules/puppet/master/lastruncheck" ], - owner => root, group => 0, mode => 0700; - - '/etc/cron.d/puppetlast.cron': + source => 'puppet:///modules/puppet/master/lastruncheck', + owner => root, + group => 0, + mode => '0700'; + '/etc/cron.d/puppetlast': content => "${puppet::master::lastruncheck_cron} root /usr/local/sbin/puppetlast ${puppet_lastruncheck_timeout_str} ${puppet_lastruncheck_ignorehosts_str} ${puppet::master::lastruncheck_additionaloptions} | grep -Ev '^OK: '\n", - require => File["/usr/local/sbin/puppetlast"], - owner => root, group => 0, mode => 0644, + 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 index 655253d..e5a7198 100644 --- a/manifests/master/checklastrun/disable.pp +++ b/manifests/master/checklastrun/disable.pp @@ -1,3 +1,4 @@ +# disable the check class puppet::master::checklastrun::disable inherits puppet::master::checklastrun { File['/usr/local/sbin/puppetlast']{ @@ -5,7 +6,7 @@ class puppet::master::checklastrun::disable inherits puppet::master::checklastru ensure => absent, } - File['/etc/cron.d/puppetlast.cron']{ + File['/etc/cron.d/puppetlast']{ ensure => absent, } } -- cgit v1.2.3 From 4f8e144c52f919855a41d5203f9bec7788784372 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 5 Sep 2014 11:05:23 +0200 Subject: make tmp dir puppet writeable for cache invalidations --- manifests/master/passenger.pp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/manifests/master/passenger.pp b/manifests/master/passenger.pp index 0aa489b..9a961f9 100644 --- a/manifests/master/passenger.pp +++ b/manifests/master/passenger.pp @@ -1,20 +1,26 @@ # class to use passenger for serving puppetmaster - class puppet::master::passenger inherits puppet::master { 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', '/etc/puppet/rack/public' ]: + ensure => directory, + owner => root, + group => 0, + mode => '0755'; + '/etc/puppet/rack/tmp': + ensure => directory, + owner => puppet, + group => 0, + mode => '0750'; '/etc/puppet/rack/config.ru': - source => [ "puppet:///modules/site_puppet/master/config.ru", + source => ["puppet:///modules/site_puppet/master/config.ru", "puppet:///modules/puppet/master/config.ru" ], - owner => puppet, group => 0, mode => 0644; + owner => puppet, + group => 0, + mode => '0644'; } } -- cgit v1.2.3 From fe3115c8bee9bd1124fc615d91c17f2762c2a714 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 5 Sep 2014 11:05:49 +0200 Subject: linting --- manifests/master/passenger.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/master/passenger.pp b/manifests/master/passenger.pp index 9a961f9..cf90b1d 100644 --- a/manifests/master/passenger.pp +++ b/manifests/master/passenger.pp @@ -17,8 +17,8 @@ class puppet::master::passenger inherits puppet::master { group => 0, mode => '0750'; '/etc/puppet/rack/config.ru': - source => ["puppet:///modules/site_puppet/master/config.ru", - "puppet:///modules/puppet/master/config.ru" ], + source => ['puppet:///modules/site_puppet/master/config.ru', + 'puppet:///modules/puppet/master/config.ru' ], owner => puppet, group => 0, mode => '0644'; -- cgit v1.2.3 From 8584340c2aeac7d97a78b8303ab377b5049b80c2 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 17 Dec 2014 19:58:59 +0100 Subject: add hiera management file --- manifests/master/hiera.pp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 manifests/master/hiera.pp diff --git a/manifests/master/hiera.pp b/manifests/master/hiera.pp new file mode 100644 index 0000000..1fe5f24 --- /dev/null +++ b/manifests/master/hiera.pp @@ -0,0 +1,12 @@ +# manage hiera file +class puppet::master::hiera { + if versioncmp($::puppetversion,'3.0') < 0 { + require rubygems::hiera_puppet + } + file{"${settings::confdir}/hiera.yaml": + source => 'puppet:///modules/site_puppet/master/hiera.yaml', + owner => root, + group => puppet, + mode => '0640'; + } +} -- cgit v1.2.3