Merge branch 'feature/allow_purging_non-managed_objects' into develop

This commit is contained in:
Nick Chappell 2014-11-21 21:53:56 -08:00
commit 2739144336
4 changed files with 35 additions and 0 deletions

View file

@ -300,6 +300,22 @@ icinga2::checkplugin { 'check_diskstats':
This module includes several defined types that can be used to automatically generate Icinga 2 format object definitions. They function in a similar way to [the built-in Nagios types that are included in Puppet](http://docs.puppetlabs.com/guides/exported_resources.html#exported-resources-with-nagios).
####Default object file locations, owner, group and mode
The default file location for each object type is controlled by the `target_file_dir` parameter. For each object type, it defaults to a subdirectory under `/etc/icinga2/objects`.
The default locations are under `/etc/icinga2/objects` and not `/etc/icinga2/conf.d/` so that user-defined objects can be kept completely separate from the objects included with Icinga 2. However, you can change the `target_file_dir` parameter to `/etc/icinga2/conf.d` if needed.
The default file owner and group are controlled by the `target_file_owner` and `target_file_group` parameters. Both default to `root`.
The default file mode is controlled by the `target_file_mode` parameter. It defaults to `0644`.
####Purging unmanaged object files
The `purge_unmanaged_object_files` parameter of the `icinga2::server` class controls whether object files in `/etc/icinga2/objects` that are not managed by Puppet get purged. It defaults to `false`.
**Note:** This will purge unmanaged subdirectories as well as unmanaged files!
####Exported resources
Like the built-in Nagios types, the Icinga 2 objects in this module can be exported to PuppetDB as virtual resources and collected on your Icinga 2 server.

View file

@ -235,6 +235,9 @@ class icinga2::params {
#Fail if we're on any other OS:
default: { fail("${::operatingsystem} is not supported!") }
}
#Whether to purge object files or directories in /etc/icinga2/objects that aren't managed by Puppet
$purge_unmanaged_object_files = false
##################
# Icinga 2 server service settings

View file

@ -26,6 +26,7 @@ class icinga2::server (
$install_mail_utils_package = $icinga2::params::install_mail_utils_package,
$server_enabled_features = $icinga2::params::server_enabled_features,
$server_disabled_features = $icinga2::params::server_disabled_features,
$purge_unmanaged_object_files = $icinga2::params::purge_unmanaged_object_files
) inherits icinga2::params {
#Do some validation of parameters so we know we have the right data types:

View file

@ -15,6 +15,18 @@ class icinga2::server::config inherits icinga2::server {
include icinga2::params
if $purge_unmanaged_object_files == true {
$recurse_objects = true
$purge_objects = true
$force_purge = true
}
else {
$recurse_objects = false
$purge_objects = false
$force_purge = true
}
#Directory resource for /etc/icinga2/:
file { '/etc/icinga2/':
ensure => directory,
@ -99,6 +111,9 @@ class icinga2::server::config inherits icinga2::server {
owner => $etc_icinga2_obejcts_owner,
group => $etc_icinga2_obejcts_group,
mode => $etc_icinga2_obejcts_mode,
recurse => $recurse_objects,
purge => $purge_objects,
force => $force_purge
}
#Directory resource for /etc/icinga2/objects/hosts/: