From 562a93ea455993d04191d31cebd0684d76b4a32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20M=E4kinen?= Date: Tue, 22 Sep 2009 20:32:45 +0300 Subject: [PATCH] Initial version of puppet::server. --- puppet/manifests/init.pp | 78 +++++++++++++++++++++++++++++++++++----- 1 file changed, 70 insertions(+), 8 deletions(-) diff --git a/puppet/manifests/init.pp b/puppet/manifests/init.pp index 84f7fa9..22d2657 100644 --- a/puppet/manifests/init.pp +++ b/puppet/manifests/init.pp @@ -1,3 +1,4 @@ + # Install and configure Puppet client. # class puppet::client { @@ -33,19 +34,19 @@ class puppet::client { default => root }, require => Package["puppet"], - notify => Service["puppet"], } case $operatingsystem { openbsd: { service { "puppet": - ensure => running, - enable => true, - binary => "/usr/local/bin/puppetd", - start => "/usr/local/bin/puppetd", - restart => "/usr/bin/pkill -HUP -f /usr/local/bin/puppetd", - pattern => puppetd, - require => Package["puppet"], + ensure => running, + enable => true, + binary => "/usr/local/bin/puppetd", + start => "/usr/local/bin/puppetd", + restart => "/usr/bin/pkill -HUP -f /usr/local/bin/puppetd", + pattern => puppetd, + require => Package["puppet"], + subscribe => File["/etc/puppet/puppet.conf"], } } default: { @@ -54,8 +55,69 @@ class puppet::client { enable => true, hasrestart => true, require => Package["puppet"], + subscribe => File["/etc/puppet/puppet.conf"], } } } } + + +# Install and configure Puppet server +# +# === Global variables +# +# $puppet_listenports: +# Array containing ports that puppetmaster should listen to. Defaults to +# [ "18140", "18141", "18142", "18143", ]. +# +class puppet::server inherits puppet::client { + + if ! $puppet_listenports { + $puppet_listenports = [ "18140", "18141", "18142", "18143", ] + } + + package { "puppet-server": + ensure => installed, + } + + package { [ "rubygem-mongrel", + "rubygem-rails", + "rubygem-sqlite3-ruby", + "ruby-RRDtool", + "ruby-ldap", ]: + ensure => installed, + } + + service { "puppetmaster": + ensure => running, + enable => true, + hasstatus => true, + require => Package["puppet-server"], + subscribe => File["/etc/puppet/puppet.conf"], + } + + File["/etc/puppet/puppet.conf"] { + content => template("puppet/puppet.conf.erb", "puppet/puppetmaster.conf.erb"), + } + + file { "/etc/puppet/tagmail.conf": + ensure => present, + source => [ "puppet:///files/puppet/tagmail.conf.${fqdn}", + "puppet:///files/puppet/tagmail.conf", + "puppet:///puppet/tagmail.conf", ], + mode => 0644, + owner => root, + group => root, + } + + file { "/etc/sysconfig/puppetmaster": + ensure => present, + content => template("puppet/puppetmaster.sysconfig.erb"), + mode => 0644, + owner => root, + group => root, + notify => Service["puppetmaster"], + } + +}