summaryrefslogtreecommitdiff
path: root/manifests/install.pp
diff options
context:
space:
mode:
authorKeith Burdis <keith@burdis.org>2013-02-08 14:24:09 +0000
committerKeith Burdis <keith@burdis.org>2013-02-08 14:24:09 +0000
commit8d8887c4ee333b620bdfb0a4c5888efb88f48493 (patch)
tree4e099d4f6933980ffd8e4c69cfd4ba60c2e9856a /manifests/install.pp
parente2dbf51aaae246e3b8e5d07c01cacac2ed4477ee (diff)
* Switched to using OMD rather than manually compiling check_mk
* Added support for host tags and creating host groups based on these tags * Allow local check_mk configuration to be specified in /etc/check_mk/main.mk.local that is appended to /etc/check_mk/main.mk as check_mk can do a lot more than is covered by this module
Diffstat (limited to 'manifests/install.pp')
-rw-r--r--manifests/install.pp105
1 files changed, 26 insertions, 79 deletions
diff --git a/manifests/install.pp b/manifests/install.pp
index 2762165..28c645f 100644
--- a/manifests/install.pp
+++ b/manifests/install.pp
@@ -1,85 +1,32 @@
class check_mk::install (
$filestore,
- $version,
+ $package,
$workspace,
) {
- package { 'nagios':
- ensure => present,
- notify => Exec['set-nagiosadmin-password', 'set-guest-password', 'add-apache-to-nagios-group'],
- }
- file { '/etc/nagios/passwd':
- ensure => present,
- owner => 'root',
- group => 'apache',
- mode => '0640',
- }
- exec { 'set-nagiosadmin-password':
- command => '/usr/bin/htpasswd -b /etc/nagios/passwd nagiosadmin letmein',
- refreshonly => true,
- require => File['/etc/nagios/passwd'],
- }
- exec { 'set-guest-password':
- command => '/usr/bin/htpasswd -b /etc/nagios/passwd guest guest',
- refreshonly => true,
- require => File['/etc/nagios/passwd'],
- }
- exec { 'add-apache-to-nagios-group':
- command => '/usr/sbin/usermod -a -G nagios apache',
- refreshonly => true,
- }
- package { 'nagios-plugins-all':
- ensure => present,
- require => Package['nagios'],
- }
- package { [ 'xinetd', 'mod_python', 'make', 'gcc-c++', 'tar', 'gzip' ]:
- ensure => present,
- }
- file { "${workspace}/check_mk-${version}.tar.gz":
- ensure => present,
- source => "${filestore}/check_mk-${version}.tar.gz",
- }
- exec { 'unpack-check_mk-tarball':
- command => "/bin/tar -zxf ${workspace}/check_mk-${version}.tar.gz",
- cwd => $workspace,
- creates => "${workspace}/check_mk-${version}",
- require => File["${workspace}/check_mk-${version}.tar.gz"],
- }
- exec { 'change-setup-config-location':
- command => "/usr/bin/perl -pi -e 's#^SETUPCONF=.*?$#SETUPCONF=${workspace}/check_mk_setup.conf#' ${workspace}/check_mk-${version}/setup.sh",
- unless => "/bin/egrep '^SETUPCONF=${workspace}/check_mk_setup.conf$' ${workspace}/check_mk-${version}/setup.sh",
- require => Exec['unpack-check_mk-tarball'],
- }
- # Avoid header like 'Written by setup of check_mk 1.2.0p3 at Thu Feb 7 12:26:17 GMT 2013'
- # that changes every time the setup script is run
- exec { 'remove-setup-header':
- command => "/usr/bin/perl -pi -e 's#^DIRINFO=.*?$#DIRINFO=#' ${workspace}/check_mk-${version}/setup.sh",
- unless => "/bin/egrep '^DIRINFO=$' ${workspace}/check_mk-${version}/setup.sh",
- require => Exec['unpack-check_mk-tarball'],
- }
- file { "${workspace}/check_mk_setup.conf":
- ensure => present,
- content => template('check_mk/setup.conf.erb'),
- notify => Exec['check_mk-setup'],
- }
- file { '/etc/nagios/check_mk':
- ensure => directory,
- owner => 'nagios',
- group => 'nagios',
- recurse => true,
- require => Package['nagios'],
- }
- exec { 'check_mk-setup':
- command => "${workspace}/check_mk-${version}/setup.sh --yes",
- cwd => "${workspace}/check_mk-${version}",
- refreshonly => true,
- require => [
- Exec['change-setup-config-location'],
- Exec['remove-setup-header'],
- Exec['unpack-check_mk-tarball'],
- File["${workspace}/check_mk_setup.conf"],
- File['/etc/nagios/check_mk'],
- Package['nagios'],
- ],
- notify => Class['check_mk::service'],
+ if $filestore {
+ if ! defined(File[$workspace]) {
+ file { $workspace:
+ ensure => directory,
+ }
+ }
+ file { "${workspace}/${package}":
+ ensure => present,
+ source => "${filestore}/${package}",
+ require => File[$workspace],
+ }
+ if $package =~ /^omd-(.*?)\.(rpm|deb)$/ {
+ $type = $1
+ package { 'omd':
+ ensure => installed,
+ provider => $type,
+ source => "${workspace}/${package_file}",
+ require => File["${workspace}/${package}"],
+ }
+ }
+ }
+ else {
+ package { $package:
+ ensure => installed,
+ }
}
}