diff --git a/.gitignore b/.gitignore index b5b7a00..968f9f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.*.swp +.*.swo pkg/ Gemfile.lock vendor/ @@ -5,3 +7,4 @@ spec/fixtures/ .vagrant/ .bundle/ coverage/ +.ruby-version diff --git a/.mailmap b/.mailmap index 2cb069d..247cdb9 100644 --- a/.mailmap +++ b/.mailmap @@ -3,3 +3,9 @@ Nick Chappell nickchappell Mélanie Gault melanie +Mélanie Gault Melanie Gault +Ricardo Cropalato de Melo ricardo@cropalato.com.br +Ricardo Cropalato de Melo Ricardo Melo +Olivier Fontannaud ofontannaud +Olivier Fontannaud Olivier FONTANNAUD +Matthew J. Brooks Matthew Brooks diff --git a/AUTHORS b/AUTHORS index 9741758..1460575 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,11 +1,18 @@ +Achim Ledermüller Adam Stephens +Alessandro Franceschi +Alexandre Beche +Devon Mizelle Gunnar Beutner +Josh Holland +Markus Frosch +Matthew J. Brooks Mélanie Gault Michael Friedrich Nick Chappell -Thomas Weißschuh +Nicolas Bigler +Olivier Fontannaud +Ricardo Cropalato de Melo Steven Bambling -Josh Holland -Ricardo Melo -Tom De Vylder -Devon Mizelle \ No newline at end of file +Thomas Weißschuh +Tom De Vylder diff --git a/CHANGELOG.md b/CHANGELOG.md index e864f43..eeb6ff2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,26 @@ #Changelog - - - +###v0.6.2 (January 29th, 2015) + +* Feature: [PR-58](https://github.com/Icinga/puppet-icinga2/pull/58) and [dev.icinga.org issue #8156](https://dev.icinga.org/issues/8156): Added the ability to use hashes directly in host `vars` parameters (instead of rendering hashes into a series of `vars.` lines in the rendered object file). +* Feature: [PR-63](https://github.com/Icinga/puppet-icinga2/pull/63) and [dev.icinga.org issue #7232](https://dev.icinga.org/issues/7232): Added an Endpoint object defined type. +* Feature: [PR-62](https://github.com/Icinga/puppet-icinga2/pull/62) and [dev.icinga.org issue #7230](https://dev.icinga.org/issues/7230): Added an IcingaStatusWriter object defined type. +* Feature: [PR-61](https://github.com/Icinga/puppet-icinga2/pull/61) and [dev.icinga.org issue #7229](https://dev.icinga.org/issues/7229): Added a FileLogger object defined type. +* Feature: [PR-70](https://github.com/Icinga/puppet-icinga2/pull/70) and [dev.icinga.org issue #8153](https://dev.icinga.org/issues/8153): Change validation of interval parameters. +* Feature: [PR-68](https://github.com/Icinga/puppet-icinga2/pull/68) and [dev.icinga.org issue #7346](https://dev.icinga.org/issues/7346): Added OS support for Red Hat. +* Feature: [dev.icinga.org issue #7231](https://dev.icinga.org/issues/7231): Added an `ApiListener` object defined type. +* Feature: [PR-76](https://github.com/Icinga/puppet-icinga2/pull/76) and [dev.icinga.org issue #8154](https://dev.icinga.org/issues/8154): Ensure ordering of hashes in ERB templates +* Bug: [PR-75](https://github.com/Icinga/puppet-icinga2/pull/75): Use `$ipaddress` as the default fact for IP addresses in `icinga2::object::host` definitions; `$ipaddress_eth0` won't work on systems with systemd that use consistent network device naming. +* Bug: [PR-74](https://github.com/Icinga/puppet-icinga2/pull/74): Remove the empty `icinga2` and `icinga2::obect` classes. +* Feature: [PR-77](https://github.com/Icinga/puppet-icinga2/pull/77/) and [dev.icinga.org issue #8239](https://dev.icinga.org/issues/8239): Added the ability to specify the contents of check plugins inline. +* Bug: [PR-81](https://github.com/Icinga/puppet-icinga2/pull/81): Fixed typo in the ERB template for `Notification` objects. +* Feature: [PR-83](https://github.com/Icinga/puppet-icinga2/pull/83): Added Red Hat support. +* Feature: [PR-60](https://github.com/Icinga/puppet-icinga2/pull/60) and [dev.icinga.org issue #7228](https://dev.icinga.org/issues/7228): Added a NotificationComponent object defined type. +* Feature: [PR-59](https://github.com/Icinga/puppet-icinga2/pull/59) and [dev.icinga.org issue #7227](https://dev.icinga.org/issues/7227): Added a CheckerComponent object defined type. +* Bug: [PR-88](https://github.com/Icinga/puppet-icinga2/pull/88): Fix unquoted string in the ERB template for apply objects that apply services to hosts. +* Feature: [PR-85](https://github.com/Icinga/puppet-icinga2/pull/85): Improve notifications of the NRPE daemon when config files or command definition files are changed. + ###v0.6.1 (December 2nd, 2014) * Feature: [PR-54](https://github.com/Icinga/puppet-icinga2/pull/54) and [dev.icinga.org issue #7225](https://dev.icinga.org/issues/7225): Added a CompatLogger object defined type. diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..182ffd4 --- /dev/null +++ b/Gemfile @@ -0,0 +1,14 @@ +source ENV['GEM_SOURCE'] || "https://rubygems.org" + +#Install the gems but don't run `require gemname` when bundler runs +#Source: http://stackoverflow.com/questions/4800721/bundler-what-does-require-false-in-a-gemfile-mean +#Source of the list of gems: https://github.com/puppetlabs/puppetlabs-ntp/blob/master/Gemfile +group :development, :unit_tests do + gem 'rake', :require => false + gem 'rspec-puppet', :require => false + gem 'puppetlabs_spec_helper', :require => false + gem 'puppet-lint', :require => false + gem 'simplecov', :require => false + gem 'puppet_facts', :require => false + gem 'json', :require => false +end \ No newline at end of file diff --git a/README.md b/README.md index 779a381..8b152c9 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,15 @@ For Ubuntu systems, this module requires the [Puppet Labs apt module](https://gi On EL-based systems (CentOS, Red Hat Enterprise Linux, Fedora, etc.), the [EPEL package repository](https://fedoraproject.org/wiki/EPEL) is required. You can also use the [icinga2::nrpe class](#nrpe-usage) to set up NRPE on CentOS 5. It is discouraged to set up Icinga2 Server on this old of a distribution. You are encouraged to use at least CentOS 6 or higher. +####Note for RedHat + +If you are using RedHat Satellite server, set +
+   $manage_repos = false
+
+ +in `icinga2::server` class and make sure, you have a channel set up with the contents of the icinga2 repository and the needed packages from EPEL. If you leave it at true, the EPEL repository will be used directly. + If you would like to use the `icinga2::object` defined types as [exported resources](https://docs.puppetlabs.com/guides/exported_resources.html), you'll need to have your Puppet master set up with PuppetDB. See the Puppet Labs documentation for more info: [Docs: PuppetDB](https://docs.puppetlabs.com/puppetdb/) ###Server requirements @@ -173,7 +182,7 @@ If you would like to use the [Debmon repository](http://debmon.org/packages) for class { 'icinga2::server': server_db_type => 'pgsql', # default to false - use_debmon => true, + use_debmon_repo => true, db_host => 'localhost' db_port => '5432' db_name => 'icinga2_data' @@ -211,7 +220,7 @@ If you would like to install packages to make a `mail` command binary available **Enabling and disabling Icinga 2 features** -To manage the features that are enabled or disabled on an Icinga 2 server, you can specify them with the `server_enabled_features` and `server_enabled_features` parameters. +To manage the features that are enabled or disabled on an Icinga 2 server, you can specify them with the `server_enabled_features` and `server_disabled_features` parameters. The parameters should be given as arrays of single-quoted strings. @@ -296,6 +305,23 @@ icinga2::checkplugin { 'check_diskstats': } ```` +Example 3: Distribute check plugin in a manifest +``` +icinga2::checkplugin { 'check_diskstats': + checkplugin_file_distribution_method => 'inline', + checkplugin_source_inline => 'command[check_disks]=/usr/lib64/nagios/plugins/check_disk -w 20 -c 10 -p /', +} +``` + +Example 4: Distribute check plugin stored in Hiera(-yaml) +``` +--- +icinga2::checkplugin: + check_diskstats: + checkplugin_file_distribution_method: 'inline' + checkplugin_source_inline: 'command[check_disks]=/usr/lib64/nagios/plugins/check_disk -w 20 -c 10 -p /' +``` + ###[Object type usage](id:object_type_usage) 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). @@ -392,21 +418,27 @@ icinga2::object::apply_dependency { 'usermail_dep_on_icinga2mail': Object types: +* [icinga2::object::apilistener](#icinga2objectapilistener) * [icinga2::object::applyservicetohost](#icinga2objectapplyservicetohost) * [icinga2::object::applynotificationtohost](#icinga2objectapplynotificationtohost) * [icinga2::object::applynotificationtoservice](#icinga2objectapplynotificationtoservice) * [icinga2::object::checkcommand](#icinga2objectcheckcommand) * [icinga2::object::compatlogger](#icinga2objectcompatlogger) +* [icinga2::object::checkercomponent](#icinga2objectcheckercomponent) * [icinga2::object::checkresultreader](#icinga2objectcheckresultreader) +* [icinga2::object::endpoint](#icinga2objectendpoint) * [icinga2::object::eventcommand](#icinga2objecteventcommand) * [icinga2::object::externalcommandlistener](#icinga2objectexternalcommandlistener) +* [icinga2::object::filelogger](#icinga2objectfilelogger) * [icinga2::object::host](#icinga2objecthost) * [icinga2::object::hostgroup](#icinga2objecthostgroup) +* [icinga2::object::icingastatuswriter](#icinga2objecticingastatuswriter) * [icinga2::object::idomysqlconnection](#icinga2objectidomysqlconnection) * [icinga2::object::idopgsqlconnection](#icinga2objectidopgsqlconnection) * [icinga2::object::livestatuslistener](#icinga2objectlivestatuslistener) * [icinga2::object::notification](#icinga2objectnotification) * [icinga2::object::notificationcommand](#icinga2objectnotificationcommand) +* [icinga2::object::notificationcomponent](#icinga2objectnotificationcomponent) * [icinga2::object::perfdatawriter](#icinga2objectperfdatawriter) * [icinga2::object::scheduleddowntime](#icinga2objectscheduleddowntime) * [icinga2::object::service](#icinga2objectservice) @@ -417,6 +449,22 @@ Object types: * [icinga2::object::user](#icinga2objectuser) * [icinga2::object::usergroup](#icinga2objectusergroup) +####[`icinga2::object::apilistener`](id:icinga2objectapilistener) + +The `apilistener` defined type can create `ApiLister` objects that set the bind address and port for Icinga 2's API listener, as well as the locations of the machine's Icinga 2 cert, key and Icinga 2 CA key: + +
+#Create an API listener object:
+icinga2::object::apilistener { 'master-api':
+  bind_host => $ipaddress_eth1,
+  accept_commands => true,
+}
+
+ +The `accept_config` and `accept_commands` parameters default to **false**. + +See the Icinga 2 documention for more info: [http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-apilistener](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-apilistener) + ####[`icinga2::object::apply_service_to_host`](id:object_apply_service_to_host) The `apply_service_to_host` defined type can create `apply` objects to apply services to hosts: @@ -553,6 +601,27 @@ icinga2::object::compatlogger { 'daily-log': Both patameters as optionals. The parameter `rotation_method` can one of `HOURLY`, `DAILY`, `WEEKLY` or `MONTHY`. See [CompatLogger](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-compatlogger) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for a full list of parameters. +####[`icinga2::object::checkercomponent`](id:object_checkercomponent) + +The `checkercomponent` defined type can create `checkercomponent` objects. + +Example: + +
+icinga2::object::checkercomponent {'checker':}
+
+ +This object support the following parameters: +* `ensure` - Optional parameter used to remove or create the file, Default value is 'file'. Use 'absent' to remove the file. +* `object_name` - Optional. Used to define file name. default value is 'checker' +* `target_dir` - Optional. Define where the conf fil will be created. Default value is '/etc/icinga2/conf.d' +* `target_file_name` - Optional. Define the file name. Default value is '${object_name}.conf'. +* `target_file_owner` - Optional. File Owner. Default value is 'root'. +* `target_file_group` - Optional. File Group. Default value is 'root'. +* `target_file_mode` - Optional. File Mode. Default value is '0644'. + +See [CheckerComponent](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-checkercomponent) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for more details about this object. + ####[`icinga2::object::checkresultreader`](id:object_checkresultreader) The `checkresultreader` defined type can create `checkresultreader` objects. @@ -567,6 +636,19 @@ icinga2::object::checkresultreader {'reader': See [CheckResultReader](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-checkresultreader) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for a full list of parameters. +####[`icinga2::object::endpoint`](id:object_endpoint) + +The `endpoint` defined type can create `endpoint` objects. + +
+icinga2::object::endpoint { 'icinga2b':
+  host => '192.168.5.46',
+  port => 5665
+}
+
+ +See [EndPoint](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-endpoint) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for a full list of parameters. + ####`icinga2::object::eventcommand` The `eventcommand` defined type can create `eventcommand` objects. @@ -593,6 +675,21 @@ icinga2::object::externalcommandlistener { 'external': See [ExternalCommandListener](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-externalcommandlistener) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for a full list of parameters. +####[`icinga2::object::filelogger`](id:object_filelogger) + +This defined type creates file logger objects. + +Example: + +
+icinga2::object::filelogger { 'debug-file':
+  severity => 'debug',
+  path     => '/var/log/icinga2/debug.log',
+}
+
+ +See [FileLogger](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-filelogger) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for a full list of parameters. + ####[`icinga2::object::host`](id:object_host) This defined type creates host objects. @@ -635,6 +732,20 @@ If you would like to use an IPv6 address, make sure to set the `ipv6_address` pa Coming soon... +####[`icinga2::object::icingastatuswriter`](id:object_icingastatuswriter) + +This defined type creates an **IcingaStatusWriter** objects. + +Example usage: +
+icinga2::object::icingastatuswriter { 'status':
+   status_path       => '/cache/icinga2/status.json',
+   update_interval   => '15s',
+}
+
+ +See [IcingaStatusWriter](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-icingastatuswriter) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for more details about the object. + ####[`icinga2::object::idomysqlconnection`](id:object_idomysqlconnection) This defined type creates an **IdoMySqlConnection** objects. @@ -785,6 +896,30 @@ icinga2::object::notificationcommand { 'mail-service-notification': This object use the same parameter defined to `checkcommand`. +####[`icinga2::object::notificationcomponent`](id:object_notificationcomponent) + +The `notificationcomponent` defined type can create `notificationcomponent` objects. + +Example: + +
 
+icinga2::object::notificationcomponent {'notification':} 
+
+ +This object support the following parameters: +* `ensure` - Optional parameter used to remove or create the file, Default value is 'file'. Use 'absent' to remove the file. +* `object_name` - Optional. Used to define file name. default value is 'checker' +* `enable_ha` - Optional. Enable the high availability functionality. Only valid in a cluster setup. Default value is true. +* `target_dir` - Optional. Define where the conf fil will be created. Default value is '/etc/icinga2/features-available' +* `target_file_name` - Optional. Define the file name. Default value is '${object_name}.conf'. +* `target_file_owner` - Optional. File Owner. Default value is 'root'. +* `target_file_group` - Optional. File Group. Default value is 'root'. +* `target_file_mode` - Optional. File Mode. Default value is '0644'. + +See [NotificationComponent](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-notificationcomponent) on [docs.icinga.org](http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc) for more details about this object. + +Should be enable/disable using `icinga2::server::features::enable` or `icinga2::server::features::disable`. + ####[`icinga2::object::perfdatawriter`](id:object_perfdatawriter) This defined type creates a **PerfdataWriter** object diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..fa92182 --- /dev/null +++ b/Rakefile @@ -0,0 +1,13 @@ +require 'puppet-lint/tasks/puppet-lint' + +task :unit_tests => [:lint] + +PuppetLint.configuration.fail_on_warnings +PuppetLint.configuration.send('relative') +PuppetLint.configuration.send('disable_80chars') +PuppetLint.configuration.send('disable_class_inherits_from_params_class') +PuppetLint.configuration.send('disable_documentation') +PuppetLint.configuration.send('disable_single_quote_string_with_variables') +PuppetLint.configuration.send('disable_variable_scope') +PuppetLint.configuration.send('disable_autoloader_layout') +PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] \ No newline at end of file diff --git a/manifests/checkplugin.pp b/manifests/checkplugin.pp index 968695b..1d8d477 100644 --- a/manifests/checkplugin.pp +++ b/manifests/checkplugin.pp @@ -13,6 +13,7 @@ define icinga2::checkplugin ( $checkplugin_template_module = 'icinga2', $checkplugin_template = undef, $checkplugin_source_file = undef, + $checkplugin_source_inline = undef, ) { #Do some validation of the class' parameters: @@ -29,7 +30,6 @@ define icinga2::checkplugin ( group => $checkplugin_target_file_group, mode => $checkplugin_target_file_mode, content => template("${checkplugin_template_module}/${checkplugin_template}"), - require => Package[$icinga2::params::icinga2_client_packages], } } elsif $checkplugin_file_distribution_method == 'source' { @@ -38,7 +38,14 @@ define icinga2::checkplugin ( group => $checkplugin_target_file_group, mode => $checkplugin_target_file_mode, source => $checkplugin_source_file, - require => Package[$icinga2::params::icinga2_client_packages], + } + } + elsif $checkplugin_file_distribution_method == 'inline' { + file { "${checkplugin_libdir}/${checkplugin_name}": + owner => $checkplugin_target_file_owner, + group => $checkplugin_target_file_group, + mode => $checkplugin_target_file_mode, + content => $checkplugin_source_inline, } } else { diff --git a/manifests/init.pp b/manifests/init.pp deleted file mode 100644 index b8b7f79..0000000 --- a/manifests/init.pp +++ /dev/null @@ -1,18 +0,0 @@ -# == Class: icinga2 -# -# This module installs the Icinga 2 monitoring system. -# -# === Parameters -# -# Coming soon... -# -# === Examples -# -# Coming soon... -# - -#Our base class. - -class icinga2 { - -} diff --git a/manifests/nrpe/install.pp b/manifests/nrpe/install.pp index 5af3db6..c3350ce 100644 --- a/manifests/nrpe/install.pp +++ b/manifests/nrpe/install.pp @@ -34,7 +34,7 @@ class icinga2::nrpe::install::packages inherits icinga2::nrpe { package {$icinga2::params::icinga2_client_packages: ensure => installed, provider => $icinga2::params::package_provider, - install_options => $client_plugin_package_install_options, + install_options => $icinga2::params::client_plugin_package_install_options, } } diff --git a/manifests/object.pp b/manifests/object.pp deleted file mode 100644 index b5abc92..0000000 --- a/manifests/object.pp +++ /dev/null @@ -1,13 +0,0 @@ -# == Class: icinga2::params -# -# This class is intentionally empty. It just serves as a container class for other -# icinga2::object:: classes to make the module's file layout cleaner (all object defined types -# can be put into an objects/ subdirectory) -# -# === Parameters -# -# None. See inline comments for parameters on the individual object type manifests for -# more details. -# - -class icinga2::objects { } diff --git a/manifests/object/apilistener.pp b/manifests/object/apilistener.pp new file mode 100644 index 0000000..d7e85c4 --- /dev/null +++ b/manifests/object/apilistener.pp @@ -0,0 +1,74 @@ +# == Defined type: icinga2::object::apilistener +# +# This is a defined type for Icinga 2 apply objects that create apilistener objects. +# See the following Icinga 2 doc page for more info: +# http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-apilistener +# +# === Parameters +# +# See the inline comments. +# + +define icinga2::object::apilistener ( + $ensure = 'file', + $object_name = $name, + $cert_path = 'SysconfDir + "/icinga2/pki/" + NodeName + ".crt"', + $key_path = 'SysconfDir + "/icinga2/pki/" + NodeName + ".key"', + $ca_path = 'SysconfDir + "/icinga2/pki/ca.crt"', + $crl_path = undef, + $bind_host = '0.0.0.0', + $bind_port = 5665, + $accept_config = false, + $accept_commands = false, + $target_dir = '/etc/icinga2/objects/apilisteners', + $target_file_name = "${name}.conf", + $target_file_ensure = file, + $target_file_owner = 'root', + $target_file_group = 'root', + $target_file_mode = '0644', + $refresh_icinga2_service = true, +) { + + validate_string($cert_path) + validate_string($key_path) + validate_string($ca_path) + if $crl_path { validate_string($crl_path) } + if $bind_host { validate_string($bind_host) } + if $bind_port { validate_re($bind_port, '^\d{1,5}$') } + if $accept_config { validate_bool($accept_config) } + if $accept_commands { validate_bool($accept_commands) } + validate_string($target_dir) + validate_string($target_file_name) + validate_string($target_file_owner) + validate_string($target_file_group) + validate_re($target_file_mode, '^\d{4}$') + validate_bool($refresh_icinga2_service) + + #If the refresh_icinga2_service parameter is set to true... + if $refresh_icinga2_service == true { + + file { "${target_dir}/${target_file_name}": + ensure => $target_file_ensure, + owner => $target_file_owner, + group => $target_file_group, + mode => $target_file_mode, + content => template('icinga2/object_apilistener.conf.erb'), + #...notify the Icinga 2 daemon so it can restart and pick up changes made to this config file... + notify => Service['icinga2'], + } + + } + #...otherwise, use the same file resource but without a notify => parameter: + else { + + file { "${target_dir}/${target_file_name}": + ensure => $target_file_ensure, + owner => $target_file_owner, + group => $target_file_group, + mode => $target_file_mode, + content => template('icinga2/object_apilistener.conf.erb'), + } + + } + +} diff --git a/manifests/object/apply_notification_to_host.pp b/manifests/object/apply_notification_to_host.pp index 56dc001..8cdb17d 100644 --- a/manifests/object/apply_notification_to_host.pp +++ b/manifests/object/apply_notification_to_host.pp @@ -42,7 +42,7 @@ define icinga2::object::apply_notification_to_host ( validate_array($user_groups) validate_hash($times) if $interval { - validate_re($interval, '^\d$') + validate_string($interval) } if $period { validate_string($period) diff --git a/manifests/object/apply_notification_to_service.pp b/manifests/object/apply_notification_to_service.pp index bda9a16..b265c9f 100644 --- a/manifests/object/apply_notification_to_service.pp +++ b/manifests/object/apply_notification_to_service.pp @@ -44,7 +44,7 @@ define icinga2::object::apply_notification_to_service ( validate_array($user_groups) validate_hash($times) if $interval { - validate_re($interval, '^\d$') + validate_string($interval) } if $period { validate_string($period) diff --git a/manifests/object/checkcommand.pp b/manifests/object/checkcommand.pp index bf5ea50..510dbbc 100644 --- a/manifests/object/checkcommand.pp +++ b/manifests/object/checkcommand.pp @@ -12,7 +12,7 @@ define icinga2::object::checkcommand ( $object_checkcommandname = $name, $template_to_import = 'plugin-check-command', -/* $methods = undef, */ /* Need to get more details about this attribute */ + #$methods = undef, Need to get more details about this attribute $command = undef, $cmd_path = 'PluginDir', $arguments = {}, diff --git a/manifests/object/checkercomponent.pp b/manifests/object/checkercomponent.pp new file mode 100644 index 0000000..7534b77 --- /dev/null +++ b/manifests/object/checkercomponent.pp @@ -0,0 +1,36 @@ +# == Defined type: icinga2::object::checkercomponent +# +# This is a defined type for Icinga 2 apply objects that create Checker Component +# See the following Icinga 2 doc page for more info: +# http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-checkercomponent +# +# === Parameters +# +# See the inline comments. +# + +define icinga2::object::checkercomponent ( + $ensure = 'file', + $object_name = $name, + $target_dir = '/etc/icinga2/features-available', + $target_file_name = "${name}.conf", + $target_file_owner = 'root', + $target_file_group = 'root', + $target_file_mode = '0644' +) { + + validate_string($target_dir) + validate_string($target_file_name) + validate_string($target_file_owner) + validate_string($target_file_group) + validate_re($target_file_mode, '^\d{4}$') + + file {"${target_dir}/${target_file_name}": + ensure => $ensure, + owner => $target_file_owner, + group => $target_file_group, + mode => $target_file_mode, + content => template('icinga2/object_checkercomponent.conf.erb'), +# notify => Service['icinga2'], # Dont need to reload/restart the service only enable/disable the feature. Should we force enable/disable the feature (icinga2 feature enable checker) or should the user define it? + } +} diff --git a/manifests/object/endpoint.pp b/manifests/object/endpoint.pp new file mode 100644 index 0000000..3ea419f --- /dev/null +++ b/manifests/object/endpoint.pp @@ -0,0 +1,46 @@ +# == Defined type: icinga2::object::endpoint +# +# This is a defined type for Icinga 2 apply objects that create EndPoint +# See the following Icinga 2 doc page for more info: +# http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-endpoint +# +# === Parameters +# +# See the inline comments. +# + +define icinga2::object::endpoint ( + $ensure = 'file', + $object_name = $name, + $host = undef, + $port = undef, + $log_duration = undef, + $target_dir = '/etc/icinga2/objects/endpoints', + $target_file_name = "${name}.conf", + $target_file_owner = 'root', + $target_file_group = 'root', + $target_file_mode = '0644' +) { + + validate_string($host) + if $port { + validate_re($port, '^\d{1,5}$') + } + if $log_duration { + validate_string($log_duration) + } + validate_string($target_dir) + validate_string($target_file_name) + validate_string($target_file_owner) + validate_string($target_file_group) + validate_re($target_file_mode, '^\d{4}$') + + file {"${target_dir}/${target_file_name}": + ensure => $ensure, + owner => $target_file_owner, + group => $target_file_group, + mode => $target_file_mode, + content => template('icinga2/object_endpoint.conf.erb'), + notify => Service['icinga2'], + } +} diff --git a/manifests/object/eventcommand.pp b/manifests/object/eventcommand.pp index 96dd3f0..e0a3095 100644 --- a/manifests/object/eventcommand.pp +++ b/manifests/object/eventcommand.pp @@ -12,7 +12,7 @@ define icinga2::object::eventcommand ( $object_eventcommandname = $name, $template_to_import = 'plugin-event-command', -/* $methods = undef, */ /* Need to get more details about this attribute */ + #$methods = undef Need to get more details about this attribute $command = undef, $cmd_path = 'PluginDir', $arguments = {}, diff --git a/manifests/object/filelogger.pp b/manifests/object/filelogger.pp new file mode 100644 index 0000000..1f7c98c --- /dev/null +++ b/manifests/object/filelogger.pp @@ -0,0 +1,45 @@ +# == Defined type: icinga2::object::filelogger +# +# This is a defined type for Icinga 2 apply objects that create File Logger +# See the following Icinga 2 doc page for more info: +# http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-filelogger +# +# === Parameters +# +# See the inline comments. +# + +define icinga2::object::filelogger ( + $ensure = 'file', + $object_name = $name, + $path = undef, + $severity = undef, + $target_dir = '/etc/icinga2/conf.d', + $target_file_name = "${name}.conf", + $target_file_owner = 'root', + $target_file_group = 'root', + $target_file_mode = '0644' +) { + + if $object_name { + validate_string($object_name) + } + validate_string($path) + if $severity { + validate_string($severity) + } + validate_string($target_dir) + validate_string($target_file_name) + validate_string($target_file_owner) + validate_string($target_file_group) + validate_re($target_file_mode, '^\d{4}$') + + file {"${target_dir}/${target_file_name}": + ensure => $ensure, + owner => $target_file_owner, + group => $target_file_group, + mode => $target_file_mode, + content => template('icinga2/object_filelogger.conf.erb'), + notify => Service['icinga2'] + } +} diff --git a/manifests/object/host.pp b/manifests/object/host.pp index 9937582..3492d35 100644 --- a/manifests/object/host.pp +++ b/manifests/object/host.pp @@ -12,7 +12,7 @@ define icinga2::object::host ( $object_hostname = $name, $display_name = $fqdn, - $ipv4_address = $ipaddress_eth0, + $ipv4_address = $ipaddress, $ipv6_address = undef, $template_to_import = 'generic-host', $groups = [], diff --git a/manifests/object/icingastatuswriter.pp b/manifests/object/icingastatuswriter.pp new file mode 100644 index 0000000..9dcd87f --- /dev/null +++ b/manifests/object/icingastatuswriter.pp @@ -0,0 +1,44 @@ +# == Defined type: icinga2::object::icingastatuswriter +# +# This is a defined type for Icinga 2 apply objects that create IcingaStatusWriter +# See the following Icinga 2 doc page for more info: +# http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-checkercomponent +# +# === Parameters +# +# See the inline comments. +# + +define icinga2::object::icingastatuswriter ( + $ensure = 'file', + $object_name = $name, + $status_path = undef, + $update_interval = undef, + $target_dir = '/etc/icinga2/objects/icingastatuswriters', + $target_file_name = "${name}.conf", + $target_file_owner = 'root', + $target_file_group = 'root', + $target_file_mode = '0644' +) { + + if $status_path { + validate_string($status_path) + } + if $update_interval { + validate_string($update_interval) + } + validate_string($target_dir) + validate_string($target_file_name) + validate_string($target_file_owner) + validate_string($target_file_group) + validate_re($target_file_mode, '^\d{4}$') + + file {"${target_dir}/${target_file_name}": + ensure => $ensure, + owner => $target_file_owner, + group => $target_file_group, + mode => $target_file_mode, + content => template('icinga2/object_icingastatuswriter.conf.erb'), + notify => Service['icinga2'], + } +} diff --git a/manifests/object/notification.pp b/manifests/object/notification.pp index e8d5b4e..fb294f7 100644 --- a/manifests/object/notification.pp +++ b/manifests/object/notification.pp @@ -51,17 +51,15 @@ define icinga2::object::notification ( validate_string($period) } validate_array($types) -/** Array concatenation not available, - if $types - ['DowntimeStart','DowntimeEnd','DowntimeRemoved','Custom','Acknowledgement','Problem','Recovery','FlappingStart','FlappingEnd'] != [] { - fail ('You are using unavailable notification type filter.') - } -*/ + #Array concatenation not available, + #if $types - ['DowntimeStart','DowntimeEnd','DowntimeRemoved','Custom','Acknowledgement','Problem','Recovery','FlappingStart','FlappingEnd'] != [] { + # fail ('You are using unavailable notification type filter.') + #} validate_array($states) -/** Array concatenation not available, - if $states - ['OK','Warning','Critical','Unknown','Up','Down'] != [] { - fail ('You are using unavailable state type filter.') - } -*/ + #Array concatenation not available, + #if $states - ['OK','Warning','Critical','Unknown','Up','Down'] != [] { + # fail ('You are using unavailable state type filter.') + #} validate_string($target_dir) validate_string($target_file_name) validate_string($target_file_owner) diff --git a/manifests/object/notificationcommand.pp b/manifests/object/notificationcommand.pp index d909c47..4419614 100644 --- a/manifests/object/notificationcommand.pp +++ b/manifests/object/notificationcommand.pp @@ -12,7 +12,7 @@ define icinga2::object::notificationcommand ( $object_notificationcommandname = $name, $template_to_import = 'plugin-notification-command', -/* $methods = undef, */ /* Need to get more details about this attribute */ + #$methods = undef, Need to get more details about this attribute $command = undef, $cmd_path = 'PluginDir', $arguments = {}, diff --git a/manifests/object/notificationcomponent.pp b/manifests/object/notificationcomponent.pp new file mode 100644 index 0000000..01a5a11 --- /dev/null +++ b/manifests/object/notificationcomponent.pp @@ -0,0 +1,40 @@ +# == Defined type: icinga2::object::notificationcomponent +# +# This is a defined type for Icinga 2 apply objects that create Notification Component +# See the following Icinga 2 doc page for more info: +# http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#objecttype-notificationcomponent +# +# === Parameters +# +# See the inline comments. +# + +define icinga2::object::notificationcomponent ( + $ensure = 'file', + $object_name = $name, + $enable_ha = undef, + $target_dir = '/etc/icinga2/features-available', + $target_file_name = "${name}.conf", + $target_file_owner = 'root', + $target_file_group = 'root', + $target_file_mode = '0644' +) { + + if $enable_ha { + validate_bool($enable_ha) + } + validate_string($target_dir) + validate_string($target_file_name) + validate_string($target_file_owner) + validate_string($target_file_group) + validate_re($target_file_mode, '^\d{4}$') + + file {"${target_dir}/${target_file_name}": + ensure => $ensure, + owner => $target_file_owner, + group => $target_file_group, + mode => $target_file_mode, + content => template('icinga2/object_notificationcomponent.conf.erb'), +# notify => Service['icinga2'], # Dont need to reload/restart the service only enable/disable the feature. Should we force enable/disable the feature (icinga2 feature enable notification) or should the user define it? + } +} diff --git a/manifests/object/servicegroup.pp b/manifests/object/servicegroup.pp index 2650fed..4afe648 100644 --- a/manifests/object/servicegroup.pp +++ b/manifests/object/servicegroup.pp @@ -16,7 +16,7 @@ define icinga2::object::servicegroup ( $groups = [], $target_dir = '/etc/icinga2/objects', $target_file_name = "${name}.conf", - $target_file_ensure = file, + $target_file_ensure = file, $target_file_owner = 'root', $target_file_group = 'root', $target_file_mode = '0644', diff --git a/manifests/object/user.pp b/manifests/object/user.pp index 21ea6d7..36338ca 100644 --- a/manifests/object/user.pp +++ b/manifests/object/user.pp @@ -22,7 +22,7 @@ define icinga2::object::user ( $states = [], $target_dir = '/etc/icinga2/objects', $target_file_name = "${name}.conf", - $target_file_ensure = file, + $target_file_ensure = file, $target_file_owner = 'root', $target_file_group = 'root', $target_file_mode = '0644', diff --git a/manifests/params.pp b/manifests/params.pp index 0871254..862a2ba 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -18,14 +18,20 @@ class icinga2::params { ################## # Icinga 2 common package parameters case $::operatingsystem { - #CentOS systems: - 'CentOS': { + #CentOS or RedHat systems: + 'CentOS', 'RedHat': { + #Pick the right package provider: + $package_provider = 'yum' + } + + #RedHat systems: + 'RedHat': { #Pick the right package provider: $package_provider = 'yum' } - #Ubuntu systems: - 'Ubuntu': { + #Ubuntu systems: + 'Ubuntu': { #Pick the right package provider: $package_provider = 'apt' } @@ -70,7 +76,7 @@ class icinga2::params { #Pick the right package parameters based on the OS: case $::operatingsystem { #CentOS systems: - 'CentOS': { + 'CentOS', 'RedHat': { case $::operatingsystemmajrelease { '5': { #Icinga 2 server package @@ -95,9 +101,9 @@ class icinga2::params { } } - #Ubuntu systems: - 'Ubuntu': { - case $::operatingsystemrelease { + #Ubuntu systems: + 'Ubuntu': { + case $::operatingsystemrelease { #Ubuntu 12.04 doesn't have nagios-plugins-common or nagios-plugins-contrib packages available... '12.04': { $icinga2_server_package = 'icinga2' @@ -143,8 +149,8 @@ class icinga2::params { # Icinga 2 server config parameters case $::operatingsystem { - #CentOS systems: - 'CentOS': { + #CentOS or RedHat systems: + 'CentOS', 'RedHat': { #Settings for /etc/icinga2/: $etc_icinga2_owner = 'icinga' $etc_icinga2_group = 'icinga' @@ -244,7 +250,7 @@ class icinga2::params { case $::operatingsystem { #Icinga 2 server daemon names for Red Had/CentOS systems: - 'CentOS': { + 'CentOS', 'RedHat': { case $::operatingsystemmajrelease { '5': { $icinga2_server_service_name = 'icinga2' @@ -314,7 +320,7 @@ class icinga2::params { case $::operatingsystem { #File and template variable names for Red Had/CentOS systems: - 'CentOS': { + 'CentOS', 'RedHat': { $nrpe_config_basedir = '/etc/nagios' $nrpe_plugin_libdir = '/usr/lib64/nagios/plugins' $checkplugin_libdir = '/usr/lib64/nagios/plugins' @@ -322,6 +328,7 @@ class icinga2::params { $nrpe_user = 'nrpe' $nrpe_group = 'nrpe' } + #File and template variable names for Ubuntu systems: 'Ubuntu': { $nrpe_config_basedir = '/etc/nagios' @@ -331,6 +338,7 @@ class icinga2::params { $nrpe_user = 'nagios' $nrpe_group = 'nagios' } + #File and template variable names for Ubuntu systems: 'Debian': { $nrpe_config_basedir = '/etc/nagios' @@ -340,15 +348,16 @@ class icinga2::params { $nrpe_user = 'nagios' $nrpe_group = 'nagios' } - #Fail if we're on any other OS: + + #Fail if we're on any other OS: default: { fail("${::operatingsystem} is not supported!") } } ################## # Icinga 2 client package parameters case $::operatingsystem { - #CentOS systems: - 'CentOS': { + #CentOS or RedHat systems: + 'CentOS', 'RedHat': { case $::operatingsystemmajrelease { '5': { #Pick the right list of client packages: @@ -409,7 +418,7 @@ class icinga2::params { # Icinga 2 client service parameters case $::operatingsystem { #Daemon names for Red Had/CentOS systems: - 'CentOS': { + 'CentOS', 'RedHat': { $nrpe_daemon_name = 'nrpe' } diff --git a/manifests/server.pp b/manifests/server.pp index 32d9932..b441e4b 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -44,7 +44,7 @@ class icinga2::server ( #Pick set the right path where we can find the DB schema based on the OS... case $::operatingsystem { - 'CentOS': { + 'CentOS','RedHat': { #...and database that the user picks case $server_db_type { 'mysql': { $server_db_schema_path = '/usr/share/icinga2-ido-mysql/schema/mysql.sql' } diff --git a/manifests/server/config.pp b/manifests/server/config.pp index ee46770..2176341 100644 --- a/manifests/server/config.pp +++ b/manifests/server/config.pp @@ -29,18 +29,18 @@ class icinga2::server::config inherits icinga2::server { #Directory resource for /etc/icinga2/: file { '/etc/icinga2/': - ensure => directory, - path => '/etc/icinga2/', - owner => $etc_icinga2_owner, - group => $etc_icinga2_group, - mode => $etc_icinga2_mode, + ensure => directory, + path => '/etc/icinga2/', + owner => $etc_icinga2_owner, + group => $etc_icinga2_group, + mode => $etc_icinga2_mode, #require => Package[$icinga2::params::icinga2_server_packages], } #File resource for /etc/icinga2/icinga2.conf: file { '/etc/icinga2/icinga2.conf': ensure => file, - path => '/etc/icinga2/icinga2.conf', + path => '/etc/icinga2/icinga2.conf', owner => $etc_icinga2_icinga2_conf_owner, group => $etc_icinga2_icinga2_conf_group, mode => $etc_icinga2_icinga2_conf_mode, @@ -49,56 +49,56 @@ class icinga2::server::config inherits icinga2::server { #Directory resource for /etc/icinga2/conf.d/: file { '/etc/icinga2/conf.d/': - ensure => directory, - path => '/etc/icinga2/conf.d/', - owner => $etc_icinga2_confd_owner, - group => $etc_icinga2_confd_group, - mode => $etc_icinga2_confd_mode, + ensure => directory, + path => '/etc/icinga2/conf.d/', + owner => $etc_icinga2_confd_owner, + group => $etc_icinga2_confd_group, + mode => $etc_icinga2_confd_mode, } #Directory resource for /etc/icinga2/features-available/: file { '/etc/icinga2/features-available/': - ensure => directory, - path => '/etc/icinga2/features-available/', - owner => $etc_icinga2_features_available_owner, - group => $etc_icinga2_features_available_group, - mode => $etc_icinga2_features_available_mode, + ensure => directory, + path => '/etc/icinga2/features-available/', + owner => $etc_icinga2_features_available_owner, + group => $etc_icinga2_features_available_group, + mode => $etc_icinga2_features_available_mode, } #Directory resource for /etc/icinga2/features-enabled/: file { '/etc/icinga2/features-enabled/': - ensure => directory, - path => '/etc/icinga2/features-enabled/', - owner => $etc_icinga2_features_enabled_owner, - group => $etc_icinga2_features_enabled_group, - mode => $etc_icinga2_features_enabled_mode, + ensure => directory, + path => '/etc/icinga2/features-enabled/', + owner => $etc_icinga2_features_enabled_owner, + group => $etc_icinga2_features_enabled_group, + mode => $etc_icinga2_features_enabled_mode, } #Directory resource for /etc/icinga2/pki/: file { '/etc/icinga2/pki/': - ensure => directory, - path => '/etc/icinga2/pki/', - owner => $etc_icinga2_pki_owner, - group => $etc_icinga2_pki_group, - mode => $etc_icinga2_pki_mode, + ensure => directory, + path => '/etc/icinga2/pki/', + owner => $etc_icinga2_pki_owner, + group => $etc_icinga2_pki_group, + mode => $etc_icinga2_pki_mode, } #Directory resource for /etc/icinga2/scripts/: file { '/etc/icinga2/scripts/': - ensure => directory, - path => '/etc/icinga2/scripts/', - owner => $etc_icinga2_scripts_owner, - group => $etc_icinga2_scripts_group, - mode => $etc_icinga2_scripts_mode, + ensure => directory, + path => '/etc/icinga2/scripts/', + owner => $etc_icinga2_scripts_owner, + group => $etc_icinga2_scripts_group, + mode => $etc_icinga2_scripts_mode, } #Directory resource for /etc/icinga2/zones.d/: file { '/etc/icinga2/zones.d/': - ensure => directory, - path => '/etc/icinga2/zones.d/', - owner => $etc_icinga2_zonesd_owner, - group => $etc_icinga2_zonesd_group, - mode => $etc_icinga2_zonesd_mode, + ensure => directory, + path => '/etc/icinga2/zones.d/', + owner => $etc_icinga2_zonesd_owner, + group => $etc_icinga2_zonesd_group, + mode => $etc_icinga2_zonesd_mode, } #File and directory resources for the object directories that can be used to hold different @@ -118,272 +118,272 @@ class icinga2::server::config inherits icinga2::server { #Directory resource for /etc/icinga2/objects/hosts/: file { '/etc/icinga2/objects/hosts/': - ensure => directory, - path => '/etc/icinga2/objects/hosts/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/hosts/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/hostgroups/: file { '/etc/icinga2/objects/hostgroups/': - ensure => directory, - path => '/etc/icinga2/objects/hostgroups/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/hostgroups/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/services/: file { '/etc/icinga2/objects/services/': - ensure => directory, - path => '/etc/icinga2/objects/services/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/services/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/servicegroups/: file { '/etc/icinga2/objects/servicegroups/': - ensure => directory, - path => '/etc/icinga2/objects/servicegroups/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/servicegroups/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/users/: file { '/etc/icinga2/objects/users/': - ensure => directory, - path => '/etc/icinga2/objects/users/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/users/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/usergroups/: file { '/etc/icinga2/objects/usergroups/': - ensure => directory, - path => '/etc/icinga2/objects/usergroups/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/usergroups/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/checkcommands/: file { '/etc/icinga2/objects/checkcommands/': - ensure => directory, - path => '/etc/icinga2/objects/checkcommands/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/checkcommands/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/notificationcommands/: file { '/etc/icinga2/objects/notificationcommands/': - ensure => directory, - path => '/etc/icinga2/objects/notificationcommands/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/notificationcommands/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/eventcommands/: file { '/etc/icinga2/objects/eventcommands/': - ensure => directory, - path => '/etc/icinga2/objects/eventcommands/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/eventcommands/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/notifications/: file { '/etc/icinga2/objects/notifications/': - ensure => directory, - path => '/etc/icinga2/objects/notifications/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/notifications/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/timeperiods/: file { '/etc/icinga2/objects/timeperiods/': - ensure => directory, - path => '/etc/icinga2/objects/timeperiods/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/timeperiods/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/scheduleddowntimes/: file { '/etc/icinga2/objects/scheduleddowntimes/': - ensure => directory, - path => '/etc/icinga2/objects/scheduleddowntimes/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/scheduleddowntimes/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/dependencies/: file { '/etc/icinga2/objects/dependencies/': - ensure => directory, - path => '/etc/icinga2/objects/dependencies/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/dependencies/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/perfdatawriters/: file { '/etc/icinga2/objects/perfdatawriters/': - ensure => directory, - path => '/etc/icinga2/objects/perfdatawriters/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/perfdatawriters/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/graphitewriters/: file { '/etc/icinga2/objects/graphitewriters/': - ensure => directory, - path => '/etc/icinga2/objects/graphitewriters/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/graphitewriters/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/idomysqlconnections/: file { '/etc/icinga2/objects/idomysqlconnections/': - ensure => directory, - path => '/etc/icinga2/objects/idomysqlconnections/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/idomysqlconnections/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/idopgsqlconnections/: file { '/etc/icinga2/objects/idopgsqlconnections/': - ensure => directory, - path => '/etc/icinga2/objects/idopgsqlconnections/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/idopgsqlconnections/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/livestatuslisteners/: file { '/etc/icinga2/objects/livestatuslisteners/': - ensure => directory, - path => '/etc/icinga2/objects/livestatuslisteners/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/livestatuslisteners/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/statusdatawriters/: file { '/etc/icinga2/objects/statusdatawriters/': - ensure => directory, - path => '/etc/icinga2/objects/statusdatawriters/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/statusdatawriters/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/externalcommandlisteners/: file { '/etc/icinga2/objects/externalcommandlisteners/': - ensure => directory, - path => '/etc/icinga2/objects/externalcommandlisteners/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/externalcommandlisteners/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/compatloggers/: file { '/etc/icinga2/objects/compatloggers/': - ensure => directory, - path => '/etc/icinga2/objects/compatloggers/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/compatloggers/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/checkresultreaders/: file { '/etc/icinga2/objects/checkresultreaders/': - ensure => directory, - path => '/etc/icinga2/objects/checkresultreaders/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/checkresultreaders/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/checkercomponents/: file { '/etc/icinga2/objects/checkercomponents/': - ensure => directory, - path => '/etc/icinga2/objects/checkercomponents/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/checkercomponents/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/notificationcomponents/: file { '/etc/icinga2/objects/notificationcomponents/': - ensure => directory, - path => '/etc/icinga2/objects/notificationcomponents/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/notificationcomponents/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/fileloggers/: file { '/etc/icinga2/objects/fileloggers/': - ensure => directory, - path => '/etc/icinga2/objects/fileloggers/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/fileloggers/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/syslogloggers/: file { '/etc/icinga2/objects/syslogloggers/': - ensure => directory, - path => '/etc/icinga2/objects/syslogloggers/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/syslogloggers/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/icingastatuswriters/: file { '/etc/icinga2/objects/icingastatuswriters/': - ensure => directory, - path => '/etc/icinga2/objects/icingastatuswriters/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/icingastatuswriters/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/apilisteners/: file { '/etc/icinga2/objects/apilisteners/': - ensure => directory, - path => '/etc/icinga2/objects/apilisteners/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/apilisteners/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/endpoints/: file { '/etc/icinga2/objects/endpoints/': - ensure => directory, - path => '/etc/icinga2/objects/endpoints/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/endpoints/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/zones/: file { '/etc/icinga2/objects/zones/': - ensure => directory, - path => '/etc/icinga2/objects/zones/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/zones/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/applys/ @@ -392,30 +392,30 @@ class icinga2::server::config inherits icinga2::server { #See the following link for more info: # http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#apply file { '/etc/icinga2/objects/applys/': - ensure => directory, - path => '/etc/icinga2/objects/applys/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/applys/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/templates/: file { '/etc/icinga2/objects/templates/': - ensure => directory, - path => '/etc/icinga2/objects/templates/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/templates/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } #Directory resource for /etc/icinga2/objects/constants/: file { '/etc/icinga2/objects/constants/': - ensure => directory, - path => '/etc/icinga2/objects/constants/', - owner => $etc_icinga2_obejcts_sub_dir_owner, - group => $etc_icinga2_obejcts_sub_dir_group, - mode => $etc_icinga2_obejcts_sub_dir_mode, + ensure => directory, + path => '/etc/icinga2/objects/constants/', + owner => $etc_icinga2_obejcts_sub_dir_owner, + group => $etc_icinga2_obejcts_sub_dir_group, + mode => $etc_icinga2_obejcts_sub_dir_mode, } } diff --git a/manifests/server/install.pp b/manifests/server/install.pp index 9db78be..507d6e3 100644 --- a/manifests/server/install.pp +++ b/manifests/server/install.pp @@ -32,9 +32,8 @@ class icinga2::server::install::repos inherits icinga2::server { if $manage_repos == true { case $::operatingsystem { - #CentOS systems: - 'CentOS': { - + #CentOS or RedHat systems: + 'CentOS', 'RedHat': { #Add the official Icinga Yum repository: http://packages.icinga.org/epel/ yumrepo { 'icinga2_yum_repo': baseurl => "http://packages.icinga.org/epel/${::operatingsystemmajrelease}/release/", @@ -45,8 +44,8 @@ class icinga2::server::install::repos inherits icinga2::server { } } - #Ubuntu systems: - 'Ubuntu': { + #Ubuntu systems: + 'Ubuntu': { #Include the apt module's base class so we can... include apt #...use the apt module to add the Icinga 2 PPA from launchpad.net: @@ -96,8 +95,8 @@ class icinga2::server::install::packages inherits icinga2::server { if $server_install_nagios_plugins == true { #Install the Nagios plugins packages: package {$icinga2_server_plugin_packages: - ensure => installed, - provider => $package_provider, + ensure => installed, + provider => $package_provider, install_options => $server_plugin_package_install_options, } } @@ -105,8 +104,8 @@ class icinga2::server::install::packages inherits icinga2::server { if $install_mail_utils_package == true { #Install the package that has the 'mail' binary in it so we can send notifications: package {$icinga2_server_mail_package: - ensure => installed, - provider => $package_provider, + ensure => installed, + provider => $package_provider, install_options => $server_plugin_package_install_options, } } diff --git a/metadata.json b/metadata.json index 117edba..871534d 100644 --- a/metadata.json +++ b/metadata.json @@ -1,12 +1,12 @@ { "name": "puppet-icinga2", - "version": "0.5.0", + "version": "0.6.1", "author": "Icinga Development Team", "summary": "Icinga 2 Puppet module", "license": "GPLv2", "source": "git://github.com/icinga/puppet-icinga2", "project_page": "https://github.com/icinga/puppet-icinga2", - "issues_url": "https://dev.icinga.org/projects/icinga-tools", + "issues_url": "https://dev.icinga.org/projects/puppet-icinga2", "operatingsystem_support": [ { "operatingsystem": "CentOS", @@ -16,12 +16,28 @@ "7" ] }, + { + "operatingsystem": "RedHat", + "operatingsystemmajrelease": [ + "5", + "6", + "7" + ] + }, { "operatingsystem": "Debian", "operatingsystemmajrelease": [ "7" ] }, + { + "operatingsystem": "RedHat", + "operatingsystemmajrelease": [ + "5", + "6", + "7" + ] + }, { "operatingsystem": "Ubuntu", "operatingsystemmajrelease": [ diff --git a/templates/object_apilistener.conf.erb b/templates/object_apilistener.conf.erb new file mode 100644 index 0000000..fcfafee --- /dev/null +++ b/templates/object_apilistener.conf.erb @@ -0,0 +1,38 @@ +/** +* WARNING: This ApiListener object definition is automatically generated by Puppet. +* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN! +*/ + +/** +* An ApiListener definition. You can create your own configuration files +* in the conf.d directory (e.g. one per commnand). By default all *.conf +* files in this directory are included. +* +*/ + +object ApiListener "<%= @object_name %>" { + <%- if @cert_path -%> + cert_path = <%= @cert_path %> + <%- end -%> + <%- if @key_path -%> + key_path = <%= @key_path %> + <%- end -%> + <%- if @ca_path -%> + ca_path = <%= @ca_path %> + <%- end -%> + <%- if @crl_path -%> + crl_path = <%= @crl_path %> + <%- end -%> + <%- if @bind_host -%> + bind_host = "<%= @bind_host %>" + <%- end -%> + <%- if @bind_port -%> + bind_port = <%= @bind_port %> + <%- end -%> + <%- if @accept_config -%> + accept_config = <%= @accept_config %> + <%- end -%> + <%- if @accept_commands -%> + accept_commands = <%= @accept_commands %> + <%- end -%> +} \ No newline at end of file diff --git a/templates/object_apply_notification_to_host.conf.erb b/templates/object_apply_notification_to_host.conf.erb index 6fe996f..31a30c2 100644 --- a/templates/object_apply_notification_to_host.conf.erb +++ b/templates/object_apply_notification_to_host.conf.erb @@ -26,10 +26,10 @@ apply Notification "<%= @object_notificationname %>" to Host { command = "<%= @command %>" <%- end -%> <%- if @vars.empty? != true -%> - <%- @vars.each_pair do |key,value| -%> + <%- @vars.sort_by {|key, value| key}.each do |key, value| -%> <%= key %> = <% if value.class == String %><%= value %> <%- else -%>{ - <%- value.each_pair do |k,v| -%> + <%- value.sort_by {|k, v| k}.each do |k, v| -%> <%= k %> = <%= v %> <%- end -%> } @@ -44,13 +44,13 @@ apply Notification "<%= @object_notificationname %>" to Host { <%- end -%> <%- if @times.empty? != true -%> times = { - <%- @times.each_pair do |key,value| -%> + <%- @times.sort_by {|key, value| key}.each do |key, value| -%> <%= key %> = "<%= value %>" <%- end -%> } <%- end -%> <%- if @interval -%> - interval = "<%= @inteval -%>" + interval = "<%= @interval -%>" <%- end -%> <%- if @period -%> period = "<%= @period -%>" diff --git a/templates/object_apply_notification_to_service.conf.erb b/templates/object_apply_notification_to_service.conf.erb index 3549d07..446f9ff 100644 --- a/templates/object_apply_notification_to_service.conf.erb +++ b/templates/object_apply_notification_to_service.conf.erb @@ -29,10 +29,10 @@ apply Notification "<%= @object_notificationname %>" to Service { command = "<%= @command %>" <%- end -%> <%- if @vars.empty? != true -%> - <%- @vars.each_pair do |key,value| -%> + <%- @vars.sort_by {|key, value| key}.each do |key, value| -%> <%= key %> = <% if value.class == String %><%= value %> <%- else -%>{ - <%- value.each_pair do |k,v| -%> + <%- value.sort_by {|k, v| k}.each do |k, v| -%> <%= k %> = <%= v %> <%- end -%> } @@ -47,13 +47,13 @@ apply Notification "<%= @object_notificationname %>" to Service { <%- end -%> <%- if @times.empty? != true -%> times = { - <%- @times.each_pair do |key,value| -%> + <%- @times.sort_by {|key, value| key}.each do |key, value| -%> <%= key %> = "<%= value %>" <%- end -%> } <%- end -%> <%- if @interval -%> - interval = "<%= @inteval -%>" + interval = "<%= @interval -%>" <%- end -%> <%- if @period -%> period = "<%= @period -%>" diff --git a/templates/object_apply_service_to_host.conf.erb b/templates/object_apply_service_to_host.conf.erb index 867798c..4de9f85 100644 --- a/templates/object_apply_service_to_host.conf.erb +++ b/templates/object_apply_service_to_host.conf.erb @@ -35,7 +35,7 @@ apply Service "<%= @object_servicename %>" to Host { check_command = "<%= @check_command -%>" <%- end -%> <%- if @vars.empty? != true -%> - <%- @vars.each_pair do |key, value| -%> + <%- @vars.sort_by {|key, value| key}.each do |key, value| -%> vars.<%= key %> = "<%= value %>" <%- end -%> <%- end -%> @@ -43,7 +43,7 @@ apply Service "<%= @object_servicename %>" to Host { max_check_attempts = <%= @max_check_attempts %> <%- end -%> <%- if @check_period -%> - check_period = <%= @check_period %> + check_period = "<%= @check_period %>" <%- end -%> <%- if @check_interval -%> check_interval = <%= @check_interval %> diff --git a/templates/object_checkcommand.conf.erb b/templates/object_checkcommand.conf.erb index 666d3bb..e05a563 100644 --- a/templates/object_checkcommand.conf.erb +++ b/templates/object_checkcommand.conf.erb @@ -27,7 +27,7 @@ object CheckCommand "<%= @object_checkcommandname %>" { <%- @arguments.each_with_index do |(key,value), i| -%> <%= key %> = <% if value.class == String %><%= value %> <%- else -%>{ - <%- value.each_pair do |k,v| -%> + <%- value.sort_by {|k, v| k}.each do |k, v| -%> <%= k %> = <%= v %> <%- end -%> } @@ -37,10 +37,10 @@ object CheckCommand "<%= @object_checkcommandname %>" { <%- end -%> <%- if @vars -%> - <%- @vars.each_pair do |key,value| -%> + <%- @vars.sort_by {|key, value| key}.each do |key, value| -%> <%= key %> = <% if value.class == String %><%= value %> <%- else -%>{ - <%- value.each_pair do |k,v| -%> + <%- value.sort_by {|k, v| k}.each do |k, v| -%> <%= k %> = <%= v %> <%- end -%> } @@ -54,7 +54,7 @@ object CheckCommand "<%= @object_checkcommandname %>" { <%- if @env -%> env = { - <%- @vars.each_pair do |key,value| -%> + <%- @vars.sort_by {|key, value| key}.each do |key, value| -%> <%= key %> = <%= value %> <%- end -%> } diff --git a/templates/object_checkercomponent.conf.erb b/templates/object_checkercomponent.conf.erb new file mode 100644 index 0000000..af40bf4 --- /dev/null +++ b/templates/object_checkercomponent.conf.erb @@ -0,0 +1,15 @@ +/** +* WARNING: This CheckerComponent is automatically generated by Puppet. +* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN! +*/ + +/** +* A CheckerComponent definition. You can create your own configuration files +* in the conf.d directory (e.g. one per commnand). By default all *.conf +* files in this directory are included. +* +*/ + +library "checker" + +object CheckerComponent "<%= @object_name %>" { } diff --git a/templates/object_endpoint.conf.erb b/templates/object_endpoint.conf.erb new file mode 100644 index 0000000..d367e15 --- /dev/null +++ b/templates/object_endpoint.conf.erb @@ -0,0 +1,21 @@ +/** +* WARNING: This EndPoint is automatically generated by Puppet. +* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN! +*/ + +/** +* A EndPoint definition. You can create your own configuration files +* in the conf.d directory (e.g. one per commnand). By default all *.conf +* files in this directory are included. +* +*/ + +object Endpoint "<%= @object_name %>" { + host = "<%= @host -%>" + <%- if @port -%> + port = <%= @port -%> + <%- end -%> + <%- if @log_duration -%> + log_duration = <%= @log_duration -%> + <%- end -%> +} diff --git a/templates/object_eventcommand.conf.erb b/templates/object_eventcommand.conf.erb index 79459a8..72763c6 100644 --- a/templates/object_eventcommand.conf.erb +++ b/templates/object_eventcommand.conf.erb @@ -27,7 +27,7 @@ object EventCommand "<%= @object_eventcommandname %>" { <%- @arguments.each_with_index do |(key,value), i| -%> <%= key %> = <% if value.class == String %><%= value %> <%- else -%>{ - <%- value.each_pair do |k,v| -%> + <%- value.sort_by {|k, v| k}.each do |k, v| -%> <%= k %> = <%= v %> <%- end -%> } @@ -37,10 +37,10 @@ object EventCommand "<%= @object_eventcommandname %>" { <%- end -%> <%- if @vars.empty? -%> - <%- @vars.each_pair do |key,value| -%> + <%- @vars.sort_by {|key, value| key}.each do |key, value| -%> <%= key %> = <% if value.class == String %><%= value %> <%- else -%>{ - <%- value.each_pair do |k,v| -%> + <%- value.sort_by {|k, v| k}.each do |k, v| -%> <%= k %> = <%= v %> <%- end -%> } @@ -54,7 +54,7 @@ object EventCommand "<%= @object_eventcommandname %>" { <%- if @env.empty? != true -%> env = { - <%- @env.each_pair do |key,value| -%> + <%- @env.sort_by {|key, value| key}.each do |key, value| -%> <%= key %> = <%= value %> <%- end -%> } diff --git a/templates/object_filelogger.conf.erb b/templates/object_filelogger.conf.erb new file mode 100644 index 0000000..5d6d0b3 --- /dev/null +++ b/templates/object_filelogger.conf.erb @@ -0,0 +1,18 @@ +/** +* WARNING: This FileLogger is automatically generated by Puppet. +* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN! +*/ + +/** +* A FileLogger definition. You can create your own configuration files +* in the conf.d directory (e.g. one per commnand). By default all *.conf +* files in this directory are included. +* +*/ + +object FileLogger "<%= @object_name %>" { + <%- if @severity -%> + severity = "<%= @severity -%>" + <%- end -%> + path = "<%= @path -%>" +} diff --git a/templates/object_host.conf.erb b/templates/object_host.conf.erb index cc5c1ab..c4223fc 100644 --- a/templates/object_host.conf.erb +++ b/templates/object_host.conf.erb @@ -29,10 +29,18 @@ object Host "<%= @object_hostname %>" { groups = [ <%- @groups.each do |group| -%> "<%= group %>", <%- end -%>] <%- end -%> <%- if @vars.empty? != true -%> - <%- @vars.each_pair do |key, value| -%> + <%- @vars.sort_by {|key, value| key}.each do |key, value| -%> + <%- if value.is_a?(Hash) -%> + vars.<%= key %> = { + <%- value.sort_by {|subkey,subvalue| subkey}.each do |subkey,subvalue| -%> + <%= subkey %> = <%= subvalue %> + <%- end -%> + } + <%- else -%> vars.<%= key %> = "<%= value %>" <%- end -%> <%- end -%> + <%- end -%> <%- if @check_command -%> check_command = "<%= @check_command -%>" <%- end -%> diff --git a/templates/object_icingastatuswriter.conf.erb b/templates/object_icingastatuswriter.conf.erb new file mode 100644 index 0000000..6dad90f --- /dev/null +++ b/templates/object_icingastatuswriter.conf.erb @@ -0,0 +1,20 @@ +/** +* WARNING: This IcingaStatusWriter is automatically generated by Puppet. +* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN! +*/ + +/** +* A IcingaStatusWriter definition. You can create your own configuration files +* in the conf.d directory (e.g. one per commnand). By default all *.conf +* files in this directory are included. +* +*/ + +object IcingaStatusWriter "<%= @object_name %>" { +<%- if @status_path -%> + status_path = LocalStateDir + "<%= @status_path -%>" +<%- end -%> +<%- if @update_interval -%> + update_interval = <%= @update_interval -%> +<%- end -%> +} diff --git a/templates/object_idomysqlconnection.conf.erb b/templates/object_idomysqlconnection.conf.erb index cb83b87..c59feb0 100644 --- a/templates/object_idomysqlconnection.conf.erb +++ b/templates/object_idomysqlconnection.conf.erb @@ -45,7 +45,7 @@ object IdoMysqlConnection "mysql-ido" { <%- if @cleanup.empty? != true -%> cleanup = { - <%- @cleanup.each_pair do |key, value| -%> + <%- @cleanup.sort_by {|key, value| key}.each do |key, value| -%> <%= key %> = <%= value %> <%- end -%> } @@ -54,4 +54,4 @@ object IdoMysqlConnection "mysql-ido" { <%- if @categories.length != 0 -%> categories = <%= @categories.map {|category| "#{category}"}.join(' | ') %> <%- end -%> -} \ No newline at end of file +} diff --git a/templates/object_idopgsqlconnection.conf.erb b/templates/object_idopgsqlconnection.conf.erb index ae91842..6f4c8fc 100644 --- a/templates/object_idopgsqlconnection.conf.erb +++ b/templates/object_idopgsqlconnection.conf.erb @@ -45,7 +45,7 @@ object IdoPgsqlConnection "pgsql-ido" { <%- if @cleanup.empty? != true -%> cleanup = { - <%- @cleanup.each_pair do |key, value| -%> + <%- @cleanup.sort_by {|key, value| key}.each do |key, value| -%> <%= key %> = <%= value %> <%- end -%> } @@ -54,4 +54,4 @@ object IdoPgsqlConnection "pgsql-ido" { <%- if @categories.length != 0 -%> categories = <%= @categories.map {|category| "#{category}"}.join(' | ') %> <%- end -%> -} \ No newline at end of file +} diff --git a/templates/object_notification.conf.erb b/templates/object_notification.conf.erb index ee78d2f..61393e0 100644 --- a/templates/object_notification.conf.erb +++ b/templates/object_notification.conf.erb @@ -26,10 +26,10 @@ object Notification "<%= @object_notificationname %>" { <%- end -%> <%- if @vars.empty? != true -%> - <%- @vars.each_pair do |key,value| -%> + <%- @vars.sort_by {|key, value| key}.each do |key, value| -%> <%= key %> = <% if value.class == String %><%= value %> <%- else -%>{ - <%- value.each_pair do |k,v| -%> + <%- value.sort_by {|k, v| k}.each do |k, v| -%> <%= k %> = <%= v %> <%- end -%> } @@ -47,14 +47,14 @@ object Notification "<%= @object_notificationname %>" { <%- if @times.empty? != true -%> times = { - <%- @times.each_pair do |key,value| -%> + <%- @times.sort_by {|key, value| key}.each do |key, value| -%> <%= key %> = <%= value %> <%- end -%> } <%- end -%> <%- if @interval -%> - interval = <%= @inteval %> + interval = <%= @interval %> <%- end -%> <%- if @period -%> diff --git a/templates/object_notificationcommand.conf.erb b/templates/object_notificationcommand.conf.erb index 73fc8af..3c8e969 100644 --- a/templates/object_notificationcommand.conf.erb +++ b/templates/object_notificationcommand.conf.erb @@ -27,7 +27,7 @@ object NotificationCommand "<%= @object_notificationcommandname %>" { <%- @arguments.each_with_index do |(key,value), i| -%> <%= key %> = <% if value.class == String %><%= value %> <%- else -%>{ - <%- value.each_pair do |k,v| -%> + <%- value.sort_by {|k, v| k}.each do |k, v| -%> <%= k %> = <%= v %> <%- end -%> } @@ -37,10 +37,10 @@ object NotificationCommand "<%= @object_notificationcommandname %>" { <%- end -%> <%- if @vars.empty? != true -%> - <%- @vars.each_pair do |key,value| -%> + <%- @vars.sort_by {|key, value| key}.each do |key, value| -%> <%= key %> = <% if value.class == String %><%= value %> <%- else -%>{ - <%- value.each_pair do |k,v| -%> + <%- value.sort_by {|k, v| k}.each do |k, v| -%> <%= k %> = <%= v %> <%- end -%> } @@ -54,7 +54,7 @@ object NotificationCommand "<%= @object_notificationcommandname %>" { <%- if @env.empty? != true -%> env = { - <%- @env.each_pair do |key,value| -%> + <%- @env.sort_by {|key, value| key}.each do |key, value| -%> <%= key %> = <%= value %> <%- end -%> } diff --git a/templates/object_notificationcomponent.conf.erb b/templates/object_notificationcomponent.conf.erb new file mode 100644 index 0000000..c288e7e --- /dev/null +++ b/templates/object_notificationcomponent.conf.erb @@ -0,0 +1,19 @@ +/** +* WARNING: This NotificationComponent is automatically generated by Puppet. +* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN! +*/ + +/** +* A NotificationComponent definition. You can create your own configuration files +* in the conf.d directory (e.g. one per commnand). By default all *.conf +* files in this directory are included. +* +*/ + +library "notification" + +object NotificationComponent "<%= @object_name %>" { + <%- if @enable_ha != true -%> + enable_ha = false + <%- end -%> +} diff --git a/templates/object_scheduleddowntime.conf.erb b/templates/object_scheduleddowntime.conf.erb index 88e2875..1c0df36 100644 --- a/templates/object_scheduleddowntime.conf.erb +++ b/templates/object_scheduleddowntime.conf.erb @@ -30,7 +30,7 @@ object ScheduledDowntime "<%= @object_scheduleddowntimename %>" { <%- if @ranges.empty? != true -%> ranges = { - <%- @ranges.each_pair do |key, value| -%> + <%- @ranges.sort_by {|key, value| key}.each do |key, value| -%> "<%= key %>" = "<%= value %>" <%- end -%> } diff --git a/templates/object_service.conf.erb b/templates/object_service.conf.erb index 5c5f3b3..95d29b0 100644 --- a/templates/object_service.conf.erb +++ b/templates/object_service.conf.erb @@ -26,7 +26,7 @@ object Service "<%= @object_servicename %>" { groups = [ <%- @groups.each do |group| -%> "<%= group %>", <%- end -%>] <%- end -%> <%- if @vars.empty? != true -%> - <%- @vars.each_pair do |key, value| -%> + <%- @vars.sort_by {|key, value| key}.each do |key, value| -%> vars.<%= key %> = "<%= value %>" <%- end -%> <%- end -%> diff --git a/templates/object_timeperiod.conf.erb b/templates/object_timeperiod.conf.erb index 4c6e899..7b983b6 100644 --- a/templates/object_timeperiod.conf.erb +++ b/templates/object_timeperiod.conf.erb @@ -23,7 +23,7 @@ object TimePeriod "<%= @object_name %>" { <%- end -%> <%- if @ranges.empty? != true -%> ranges = { - <%- @ranges.each_pair do |key,value| -%> + <%- @ranges.sort_by {|key, value| key}.each do |key, value| -%> "<%= key %>" = "<%= value %>" <%- end -%> } diff --git a/templates/object_user.conf.erb b/templates/object_user.conf.erb index 0965295..d271160 100644 --- a/templates/object_user.conf.erb +++ b/templates/object_user.conf.erb @@ -29,7 +29,7 @@ object User "<%= @object_username %>" { enable_notifications = <%= @enable_notifications %> <%- end %> <%- if @vars.empty? != true -%> - <%- @vars.each_pair do |key, value| -%> + <%- @vars.sort_by {|key, value| key}.each do |key, value| -%> vars.<%= key %> = "<%= value %>" <%- end -%> <%- end -%> @@ -45,4 +45,4 @@ object User "<%= @object_username %>" { <%- if @states.length != 0 -%> states = [ <%- @states.each do |state| -%> <%= state %>, <%- end -%>] <%- end -%> -} \ No newline at end of file +}