diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-01-17 19:48:32 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-01-17 19:48:32 -0200 |
commit | f02b06b19f88ca10a6ee8d1e93d7128445f2501b (patch) | |
tree | ced2e18a130d9d69b7c897de6f4e8b7db821806b /manifests | |
parent | ae70891c89c9e6f0c9a77e75dd64905a25ebc221 (diff) | |
parent | 199551906b8eca94e23c16b5619c206488cc112a (diff) | |
download | puppet-ejabberd-master.tar.gz puppet-ejabberd-master.tar.bz2 |
Conflicts:
manifests/base.pp
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/base.pp | 22 | ||||
-rw-r--r-- | manifests/init.pp | 20 | ||||
-rw-r--r-- | manifests/munin.pp | 27 | ||||
-rw-r--r-- | manifests/nagios.pp | 21 |
4 files changed, 59 insertions, 31 deletions
diff --git a/manifests/base.pp b/manifests/base.pp index 1c805c3..b265547 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -1,15 +1,27 @@ +# manages the basic stuff for the service class ejabberd::base { package{'ejabberd': ensure => installed, } file{'/etc/ejabberd/ejabberd.cfg': - source => [ "puppet:///modules/site-ejabberd/${fqdn}/ejabberd.cfg", - "puppet:///modules/site-ejabberd/ejabberd.cfg", - "puppet:///modules/ejabberd/ejabberd.cfg" ], require => Package['ejabberd'], - notify => Service['ejabberd'], - owner => root, group => ejabberd, mode => 0640; + notify => Service['ejabberd'], + owner => 'root', + group => 'ejabberd', + mode => '0640'; + } + + if $ejabberd::config_content { + File['/etc/ejabberd/ejabberd.cfg']{ + content => $ejabberd::config_content + } + } else { + File['/etc/ejabberd/ejabberd.cfg']{ + source => [ "puppet:///modules/site_ejabberd/${::fqdn}/ejabberd.cfg", + 'puppet:///modules/site_ejabberd/ejabberd.cfg', + 'puppet:///modules/ejabberd/ejabberd.cfg' ] + } } service{'ejabberd': diff --git a/manifests/init.pp b/manifests/init.pp index d8b9d44..8c21344 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -2,19 +2,29 @@ # Copyright (C) 2007 admin@immerda.ch # GPLv3 -class ejabberd { - case $operatingsystem { +# Manage an ejabberd server +class ejabberd( + $domains = $::fqdn, + $config_content = false, + $nagios_domain = $::fqdn, + $nagios_user = 'nagios', + $nagios_pwd = '', + $manage_nagios = false, + $manage_munin = false, + $manage_shorewall = false +) { + case $::operatingsystem { default: { include ejabberd::base } } - if $use_nagios { + if $manage_nagios { include ejabberd::nagios } - if $use_munin { + if $manage_munin { include ejabberd::munin } - if $use_shorewall { + if $manage_shorewall { include shorewall::rules::jabberserver } } diff --git a/manifests/munin.pp b/manifests/munin.pp index 1357e98..33f15d4 100644 --- a/manifests/munin.pp +++ b/manifests/munin.pp @@ -1,14 +1,27 @@ +# install munin plugin and helpers class ejabberd::munin { - case $ejabberd_domains { - '': { $ejabberd_domains = $fqdn } - } - munin::plugin::deploy{'ejabberd_': - source => "ejabberd/munin/ejabberd_", + munin::plugin::deploy{'ejabberd_': ensure => absent, + source => 'ejabberd/munin/ejabberd_'; } + $domains = join($ejabberd::domains, ' ') munin::plugin{['ejabberd_users','ejabberd_connections','ejabberd_registrations']: + ensure => 'ejabberd_', require => Munin::Plugin::Deploy['ejabberd_'], - ensure => 'ejabberd_', - config => "env.vhosts ${ejabberd_domains}\ntimeout 20\nuser root\ngroup root" + config => "group munin\nenv.vhosts ${domains}"; + } + File { + owner => root, + group => 0, + mode => '0700', + } + file{ + '/etc/cron.daily/ejabberd_registrations': + require => Munin::Plugin['ejabberd_registrations'], + source => 'puppet:///modules/ejabberd/munin/ejabberd_registrations.cron'; + '/etc/cron.d/ejabberd_munin': + require => Munin::Plugin['ejabberd_users','ejabberd_connections'], + mode => '0600', + source => 'puppet:///modules/ejabberd/munin/ejabberd_munin.cron'; } } diff --git a/manifests/nagios.pp b/manifests/nagios.pp index 85a7b10..27df382 100644 --- a/manifests/nagios.pp +++ b/manifests/nagios.pp @@ -1,25 +1,18 @@ # manifests/nagios.pp class ejabberd::nagios { - case $jabber_nagios_domain { - '': { $jabber_nagios_domain = $fqdn } - } - nagios::service{ "jabber_${fqdn}": check_command => "check_jabber!${jabber_nagios_domain}" } + nagios::service{ "jabber_${::fqdn}": check_command => "check_jabber!${ejabberd::nagios_domain}" } @@nagios_command{ 'check_jabber_ssl': command_line => '$USER1$/check_jabber -S -p 5223 -H $ARG1$', } - nagios::service{ "jabber_ssl_${fqdn}": check_command => "check_jabber_ssl!${jabber_nagios_domain}" } + nagios::service{ "jabber_ssl_${::fqdn}": check_command => "check_jabber_ssl!${ejabberd::nagios_domain}" } @@nagios_command{ 'check_jabber_cert': command_line => '$USER1$/check_jabber -S -D 10 -p 5223 -H $ARG1$', } - nagios::service{ "jabber_cert_${fqdn}": check_command => "check_jabber_cert!${jabber_nagios_domain}" } - - case $jabber_nagios_user { - '': { $jabber_nagios_user = 'nagios' } - } + nagios::service{ "jabber_cert_${::fqdn}": check_command => "check_jabber_cert!${ejabberd::nagios_domain}" } @@nagios_command{ 'check_jabber_login': @@ -27,10 +20,10 @@ class ejabberd::nagios { require => Nagios::Plugin['check_jabber_login']; } - case $jabber_nagios_pwd { - '': { info("no \$jabber_nagios_pwd supplied for ${fqdn}! Can't test jabber login") } - default: { - nagios::service{ "jabber_login_${fqdn}": check_command => "check_jabber_login!${jabber_nagios_user}@${jabber_nagios_domain}!${jabber_nagios_pwd}" } + case $ejabberd::nagios_pwd { + '': { info("no \$ejabberd::nagios_pwd supplied for ${::fqdn}! Can't test jabber login") } + default: { + nagios::service{ "jabber_login_${::fqdn}": check_command => "check_jabber_login!${ejabberd::nagios_user}@${ejabberd::nagios_domain}!${ejabberd::nagios_pwd}" } } } } |