Skip to content

Commit

Permalink
Added nrpe init and configdir management
Browse files Browse the repository at this point in the history
  • Loading branch information
alvagante committed Mar 13, 2012
1 parent 377e231 commit 8759560
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
39 changes: 23 additions & 16 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
# A command to prefix to every Nrpe command. Default: ''
# Typically this value can be '/usr/bin/sudo' to launch commands via sudo
#
# [*config_file_init_content*]
# [*file_init_template*]
# The template to use to populate the init configuration file.
# Default is provided by the module.
#
Expand Down Expand Up @@ -254,6 +254,7 @@
$connection_timeout = params_lookup( 'connection_timeout' ),
$command_prefix = params_lookup( 'command_prefix' ),
$server_address = params_lookup( 'server_address' ),
$file_init_template = params_lookup( 'file_init_template' ),
$ntp = params_lookup( 'ntp' ),
$my_class = params_lookup( 'my_class' ),
$source = params_lookup( 'source' ),
Expand Down Expand Up @@ -370,11 +371,21 @@
default => $nrpe::source,
}

$manage_dir_source = $nrpe::source_dir ? {
'' => undef,
default => $nrpe::source_dir,
}

$manage_file_content = $nrpe::template ? {
'' => undef,
default => template($nrpe::template),
}

$manage_file_init_content = $nrpe::file_init_template ? {
'' => undef,
default => template($nrpe::file_init_template),
}

### Managed resources
package { 'nrpe':
ensure => $nrpe::manage_package,
Expand Down Expand Up @@ -412,27 +423,23 @@
group => $nrpe::config_file_group,
require => Package['nrpe'],
notify => $nrpe::manage_service_autorestart,
content => $nrpe::config_file_init_content,
content => $nrpe::manage_file_init_content,
replace => $nrpe::manage_file_replace,
audit => $nrpe::manage_audit,
}

# The whole nrpe configuration directory can be recursively overriden
if $nrpe::source_dir {
file { 'nrpe.dir':
ensure => directory,
path => $nrpe::config_dir,
require => Package['nrpe'],
notify => $nrpe::manage_service_autorestart,
source => $nrpe::source_dir,
recurse => true,
purge => $nrpe::source_dir_purge,
replace => $nrpe::manage_file_replace,
audit => $nrpe::manage_audit,
}
file { 'nrpe.d':
ensure => directory,
path => $nrpe::config_dir,
require => Package['nrpe'],
notify => $nrpe::manage_service_autorestart,
source => $nrpe::manage_dir_source,
recurse => true,
purge => $nrpe::source_dir_purge,
replace => $nrpe::manage_file_replace,
audit => $nrpe::manage_audit,
}


### Include custom class if $my_class is set
if $nrpe::my_class {
include $nrpe::my_class
Expand Down
4 changes: 2 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
$command_prefix = ''

# The template used to populate the config_file_init
$config_file_init_content = $::operatingsystem ? {
$file_init_template = $::operatingsystem ? {
/(?i:RedHat|Centos|Scientific|Fedora)/ => 'nrpe/nrpe-init-redhat.erb',
/(?i:Debian|Ubuntu|Mint)/ => 'nrpe/nrpe-init-debian.erb',
default => 'nrpe/nrpe-init-redhat.erb',
Expand Down Expand Up @@ -125,7 +125,7 @@
$my_class = ''
$source = ''
$source_dir = ''
$source_dir_purge = ''
$source_dir_purge = 'false'
$template = 'nrpe/nrpe.cfg.erb' # A default file with the checks we need
$options = ''
$service_autorestart = true
Expand Down

0 comments on commit 8759560

Please sign in to comment.