summaryrefslogtreecommitdiff
path: root/puppet/modules/site_nagios/manifests/server/purge.pp
blob: 6815a703aefab78ef6fed49ab1cd061289760bc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class site_nagios::server::purge inherits nagios::base {
  # we don't want to get /etc/nagios3 and /etc/nagios3/conf.d
  # purged, cause the check-mk-config-nagios3 package
  # places its templates in /etc/nagios3/conf.d/check_mk,
  # and check_mk -O updated it's nagios config in /etc/nagios3/conf.d/check_mk
  File['nagios_cfgdir'] {
    purge => false
  }
  File['nagios_confd'] {
    purge => false
  }

  # only purge files in the /etc/nagios3/conf.d/ dir, not in any subdir
  exec {'purge_conf.d':
    command => '/usr/bin/find /etc/nagios3/conf.d/ -maxdepth 1 -type f -exec rm {} \;',
    onlyif  => '/usr/bin/find /etc/nagios3/conf.d/ -maxdepth 1 -type f | grep -q "/etc/nagios3/conf.d"',
    require => Package['nagios']
  }
}