diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/base.pp | 156 |
1 files changed, 100 insertions, 56 deletions
diff --git a/manifests/base.pp b/manifests/base.pp index 4c4f344..50a302c 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -14,10 +14,11 @@ class nagios::base { require => Package['nagios'], } + $cfg_dir = $nagios::defaults::vars::int_cfgdir # this file should contain all the nagios_puppet-paths: file{ 'nagios_main_cfg': - path => "${nagios::defaults::vars::int_cfgdir}/nagios.cfg", + path => "${cfg_dir}/nagios.cfg", source => ["puppet:///modules/site_nagios/configs/${::fqdn}/nagios.cfg", "puppet:///modules/site_nagios/configs/${::operatingsystem}/nagios.cfg", 'puppet:///modules/site_nagios/configs/nagios.cfg', @@ -28,7 +29,7 @@ class nagios::base { group => root, mode => '0644'; 'nagios_cgi_cfg': - path => "${nagios::defaults::vars::int_cfgdir}/cgi.cfg", + path => "${cfg_dir}/cgi.cfg", source => [ "puppet:///modules/site_nagios/configs/${::fqdn}/cgi.cfg", "puppet:///modules/site_nagios/configs/${::operatingsystem}/cgi.cfg", 'puppet:///modules/site_nagios/configs/cgi.cfg', @@ -39,7 +40,7 @@ class nagios::base { group => 0, mode => '0644'; 'nagios_htpasswd': - path => "${nagios::defaults::vars::int_cfgdir}/htpasswd.users", + path => "${cfg_dir}/htpasswd.users", source => ['puppet:///modules/site_nagios/htpasswd.users', 'puppet:///modules/nagios/htpasswd.users' ], owner => root, @@ -47,7 +48,7 @@ class nagios::base { mode => '0640'; 'nagios_private': ensure => directory, - path => "${nagios::defaults::vars::int_cfgdir}/private/", + path => "${cfg_dir}/private", purge => true, recurse => true, notify => Service['nagios'], @@ -55,7 +56,7 @@ class nagios::base { group => nagios, mode => '0750'; 'nagios_private_resource_cfg': - path => "${nagios::defaults::vars::int_cfgdir}/private/resource.cfg", + path => "${cfg_dir}/private/resource.cfg", source => [ "puppet:///modules/site_nagios/configs/${::operatingsystem}/private/resource.cfg.${::architecture}", "puppet:///modules/nagios/configs/${::operatingsystem}/private/resource.cfg.${::architecture}" ], notify => Service['nagios'], @@ -64,7 +65,7 @@ class nagios::base { mode => '0640'; 'nagios_confd': ensure => directory, - path => "${nagios::defaults::vars::int_cfgdir}/conf.d/", + path => "${cfg_dir}/conf.d", purge => true, recurse => true, notify => Service['nagios'], @@ -88,108 +89,151 @@ class nagios::base { Nagios_timeperiod <<||>> Nagios_command <||> { - target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_command.cfg", + target => "${cfg_dir}/conf.d/nagios_command.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_contact <||> { - target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contact.cfg", + target => "${cfg_dir}/conf.d/nagios_contact.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_contactgroup <||> { - target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contactgroup.cfg", + target => "${cfg_dir}/conf.d/nagios_contactgroup.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_host <||> { - target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_host.cfg", + target => "${cfg_dir}/conf.d/nagios_host.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_hostdependency <||> { - target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostdependency.cfg", + target => "${cfg_dir}/conf.d/nagios_hostdependency.cfg", notify => Service['nagios'], } Nagios_hostescalation <||> { - target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostescalation.cfg", + target => "${cfg_dir}/conf.d/nagios_hostescalation.cfg", notify => Service['nagios'], } Nagios_hostextinfo <||> { - target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostextinfo.cfg", + target => "${cfg_dir}/conf.d/nagios_hostextinfo.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_hostgroup <||> { - target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostgroup.cfg", + target => "${cfg_dir}/conf.d/nagios_hostgroup.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_service <||> { - target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_service.cfg", + target => "${cfg_dir}/conf.d/nagios_service.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_servicegroup <||> { - target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicegroup.cfg", + target => "${cfg_dir}/conf.d/nagios_servicegroup.cfg", notify => Service['nagios'], } Nagios_servicedependency <||> { - target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicedependency.cfg", + target => "${cfg_dir}/conf.d/nagios_servicedependency.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_serviceescalation <||> { - target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceescalation.cfg", + target => "${cfg_dir}/conf.d/nagios_serviceescalation.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_serviceextinfo <||> { - target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceextinfo.cfg", + target => "${cfg_dir}/conf.d/nagios_serviceextinfo.cfg", require => File['nagios_confd'], notify => Service['nagios'], } Nagios_timeperiod <||> { - target => "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_timeperiod.cfg", + target => "${cfg_dir}/conf.d/nagios_timeperiod.cfg", require => File['nagios_confd'], notify => Service['nagios'], } - file{[ - "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_command.cfg", - "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contact.cfg", - "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_contactgroup.cfg", - "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_host.cfg", - "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostdependency.cfg", - "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostescalation.cfg", - "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostextinfo.cfg", - "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostgroup.cfg", - "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_hostgroupescalation.cfg", - "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_service.cfg", - "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicedependency.cfg", - "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceescalation.cfg", - "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_serviceextinfo.cfg", - "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_servicegroup.cfg", - "${nagios::defaults::vars::int_cfgdir}/conf.d/nagios_timeperiod.cfg" ]: - ensure => file, - replace => false, - notify => Service['nagios'], - owner => root, - group => 0, - mode => '0644'; - } - - # manage nagios cfg files - # must be defined after exported resource overrides and cfg file defs - file { 'nagios_cfgdir': - ensure => directory, - path => "${nagios::defaults::vars::int_cfgdir}/", - recurse => true, - purge => true, - force => true, - notify => Service['nagios'], - owner => root, - group => root, - mode => '0755'; + file{ + # manage nagios cfg files + # must be defined after exported resource overrides and cfg file defs + 'nagios_cfgdir': + ensure => directory, + path => $cfg_dir, + recurse => true, + purge => true, + force => true, + notify => Service['nagios'], + owner => root, + group => root, + mode => '0755'; + ["${cfg_dir}/conf.d/nagios_command.cfg", + "${cfg_dir}/conf.d/nagios_contact.cfg", + "${cfg_dir}/conf.d/nagios_contactgroup.cfg", + "${cfg_dir}/conf.d/nagios_host.cfg", + "${cfg_dir}/conf.d/nagios_hostdependency.cfg", + "${cfg_dir}/conf.d/nagios_hostescalation.cfg", + "${cfg_dir}/conf.d/nagios_hostextinfo.cfg", + "${cfg_dir}/conf.d/nagios_hostgroup.cfg", + "${cfg_dir}/conf.d/nagios_hostgroupescalation.cfg", + "${cfg_dir}/conf.d/nagios_service.cfg", + "${cfg_dir}/conf.d/nagios_servicedependency.cfg", + "${cfg_dir}/conf.d/nagios_serviceescalation.cfg", + "${cfg_dir}/conf.d/nagios_serviceextinfo.cfg", + "${cfg_dir}/conf.d/nagios_servicegroup.cfg", + "${cfg_dir}/conf.d/nagios_timeperiod.cfg" ]: + ensure => file, + replace => false, + notify => Service['nagios'], + owner => root, + group => 0, + mode => '0644'; + "${cfg_dir}/nagios_command.cfg": + ensure => link, + target => "${cfg_dir}/conf.d/nagios_command.cfg"; + "${cfg_dir}/nagios_contact.cfg": + ensure => link, + target => "${cfg_dir}/conf.d/nagios_contact.cfg"; + "${cfg_dir}/nagios_contactgroup.cfg": + ensure => link, + target => "${cfg_dir}/conf.d/nagios_contactgroup.cfg"; + "${cfg_dir}/nagios_host.cfg": + ensure => link, + target => "${cfg_dir}/conf.d/nagios_host.cfg"; + "${cfg_dir}/nagios_hostdependency.cfg": + ensure => link, + target => "${cfg_dir}/conf.d/nagios_hostdependency.cfg"; + "${cfg_dir}/nagios_hostescalation.cfg": + ensure => link, + target => "${cfg_dir}/conf.d/nagios_hostescalation.cfg"; + "${cfg_dir}/nagios_hostextinfo.cfg": + ensure => link, + target => "${cfg_dir}/conf.d/nagios_hostextinfo.cfg"; + "${cfg_dir}/nagios_hostgroup.cfg": + ensure => link, + target => "${cfg_dir}/conf.d/nagios_hostgroup.cfg"; + "${cfg_dir}/nagios_hostgroupescalation.cfg": + ensure => link, + target => "${cfg_dir}/conf.d/nagios_hostgroupescalation.cfg"; + "${cfg_dir}/nagios_service.cfg": + ensure => link, + target => "${cfg_dir}/conf.d/nagios_service.cfg"; + "${cfg_dir}/nagios_servicedependency.cfg": + ensure => link, + target => "${cfg_dir}/conf.d/nagios_servicedependency.cfg"; + "${cfg_dir}/nagios_serviceescalation.cfg": + ensure => link, + target => "${cfg_dir}/conf.d/nagios_serviceescalation.cfg"; + "${cfg_dir}/nagios_serviceextinfo.cfg": + ensure => link, + target => "${cfg_dir}/conf.d/nagios_serviceextinfo.cfg"; + "${cfg_dir}/nagios_servicegroup.cfg": + ensure => link, + target => "${cfg_dir}/conf.d/nagios_servicegroup.cfg"; + "${cfg_dir}/nagios_timeperiod.cfg": + ensure => link, + target => "${cfg_dir}/conf.d/nagios_timeperiod.cfg"; } } |