diff --git a/manifests/conf.pp b/manifests/conf.pp index 57ab3ab6..57012731 100644 --- a/manifests/conf.pp +++ b/manifests/conf.pp @@ -23,7 +23,7 @@ $template = undef, $options_hash = undef, $ensure = present, - $target_dir = "${::icinga2::params::etcprefix}/conf.d", + $target_dir = "${::icinga2::config_dir}/conf.d", $target_file_name = "${name}.conf", $target_file_owner = $::icinga2::config_owner, $target_file_group = $::icinga2::config_group, diff --git a/manifests/config.pp b/manifests/config.pp index 980eb9b8..adeff57e 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -14,10 +14,10 @@ # maintained directories file { [ - $::icinga2::params::etcprefix, - "${::icinga2::params::etcprefix}/pki", - "${::icinga2::params::etcprefix}/scripts", - "${::icinga2::params::etcprefix}/features-available", + $::icinga2::config_dir, + "${::icinga2::config_dir}/pki", + "${::icinga2::config_dir}/scripts", + "${::icinga2::config_dir}/features-available", ]: ensure => directory, } @@ -25,7 +25,7 @@ # TODO: temporary until we provide some default templates file { [ - "${::icinga2::params::etcprefix}/conf.d", + "${::icinga2::config_dir}/conf.d", ]: ensure => directory, purge => $::icinga2::purge_confd, @@ -35,9 +35,9 @@ file { [ - "${::icinga2::params::etcprefix}/features-enabled", - "${::icinga2::params::etcprefix}/objects", - "${::icinga2::params::etcprefix}/zones.d", + "${::icinga2::config_dir}/features-enabled", + "${::icinga2::config_dir}/objects", + "${::icinga2::config_dir}/zones.d", ]: ensure => directory, purge => $::icinga2::purge_configs, @@ -45,7 +45,7 @@ force => $::icinga2::purge_configs, } - file { "${::icinga2::params::etcprefix}/icinga2.conf": + file { "${::icinga2::config_dir}/icinga2.conf": ensure => file, content => template($::icinga2::config_template), } @@ -53,28 +53,28 @@ # maintained object directories file { [ - "${::icinga2::params::etcprefix}/objects/hosts", - "${::icinga2::params::etcprefix}/objects/hostgroups", - "${::icinga2::params::etcprefix}/objects/services", - "${::icinga2::params::etcprefix}/objects/servicegroups", - "${::icinga2::params::etcprefix}/objects/users", - "${::icinga2::params::etcprefix}/objects/usergroups", - "${::icinga2::params::etcprefix}/objects/checkcommands", - "${::icinga2::params::etcprefix}/objects/notificationcommands", - "${::icinga2::params::etcprefix}/objects/eventcommands", - "${::icinga2::params::etcprefix}/objects/notifications", - "${::icinga2::params::etcprefix}/objects/timeperiods", - "${::icinga2::params::etcprefix}/objects/scheduleddowntimes", - "${::icinga2::params::etcprefix}/objects/dependencies", - "${::icinga2::params::etcprefix}/objects/perfdatawriters", - "${::icinga2::params::etcprefix}/objects/graphitewriters", - "${::icinga2::params::etcprefix}/objects/idomysqlconnections", - "${::icinga2::params::etcprefix}/objects/idopgsqlconnections", - "${::icinga2::params::etcprefix}/objects/livestatuslisteners", - "${::icinga2::params::etcprefix}/objects/statusdatawriters", - "${::icinga2::params::etcprefix}/objects/applys", - "${::icinga2::params::etcprefix}/objects/templates", - "${::icinga2::params::etcprefix}/objects/constants", + "${::icinga2::config_dir}/objects/hosts", + "${::icinga2::config_dir}/objects/hostgroups", + "${::icinga2::config_dir}/objects/services", + "${::icinga2::config_dir}/objects/servicegroups", + "${::icinga2::config_dir}/objects/users", + "${::icinga2::config_dir}/objects/usergroups", + "${::icinga2::config_dir}/objects/checkcommands", + "${::icinga2::config_dir}/objects/notificationcommands", + "${::icinga2::config_dir}/objects/eventcommands", + "${::icinga2::config_dir}/objects/notifications", + "${::icinga2::config_dir}/objects/timeperiods", + "${::icinga2::config_dir}/objects/scheduleddowntimes", + "${::icinga2::config_dir}/objects/dependencies", + "${::icinga2::config_dir}/objects/perfdatawriters", + "${::icinga2::config_dir}/objects/graphitewriters", + "${::icinga2::config_dir}/objects/idomysqlconnections", + "${::icinga2::config_dir}/objects/idopgsqlconnections", + "${::icinga2::config_dir}/objects/livestatuslisteners", + "${::icinga2::config_dir}/objects/statusdatawriters", + "${::icinga2::config_dir}/objects/applys", + "${::icinga2::config_dir}/objects/templates", + "${::icinga2::config_dir}/objects/constants", ]: ensure => directory, purge => $::icinga2::purge_configs, @@ -82,7 +82,7 @@ force => $::icinga2::purge_configs, } - file { "${::icinga2::params::etcprefix}/zones.conf": + file { "${::icinga2::config_dir}/zones.conf": ensure => file, content => template('icinga2/zones.conf.erb'), } diff --git a/manifests/config/objectdir.pp b/manifests/config/objectdir.pp index 55003fa2..c25e29d6 100644 --- a/manifests/config/objectdir.pp +++ b/manifests/config/objectdir.pp @@ -17,7 +17,7 @@ Class['icinga2::config'] -> file { "icinga2 objectdir ${name}": ensure => directory, - path => "${::icinga2::params::etcprefix}/objects/${name}", + path => "${::icinga2::config_dir}/objects/${name}", owner => $::icinga2::config_owner, group => $::icinga2::config_group, mode => $::icinga2::config_mode, diff --git a/manifests/database.pp b/manifests/database.pp index dd2a9f17..a5460fed 100644 --- a/manifests/database.pp +++ b/manifests/database.pp @@ -26,8 +26,8 @@ exec { 'mysql_schema_load': user => 'root', path => $::path, - command => "mysql -h '${::icinga2::db_host}' -u '${::icinga2::db_user}' -p'${::icinga2::db_pass}' '${::icinga2::db_name}' < '${db_schema}' && touch ${::icinga2::params::etcprefix}/mysql_schema_loaded.txt", - creates => "${::icinga2::params::etcprefix}/mysql_schema_loaded.txt", + command => "mysql -h '${::icinga2::db_host}' -u '${::icinga2::db_user}' -p'${::icinga2::db_pass}' '${::icinga2::db_name}' < '${db_schema}' && touch ${::icinga2::config_dir}/mysql_schema_loaded.txt", + creates => "${::icinga2::config_dir}/mysql_schema_loaded.txt", } } elsif $::icinga2::db_type == 'pgsql' { @@ -47,8 +47,8 @@ environment => [ "PGPASSWORD=${::icinga2::db_pass}", ], - command => "psql -U '${::icinga2::db_user}' -h '${::icinga2::db_host}' ${port} -d '${::icinga2::db_name}' < '${db_schema}' && touch ${::icinga2::params::etcprefix}/postgres_schema_loaded.txt", - creates => "${::icinga2::params::etcprefix}/postgres_schema_loaded.txt", + command => "psql -U '${::icinga2::db_user}' -h '${::icinga2::db_host}' ${port} -d '${::icinga2::db_name}' < '${db_schema}' && touch ${::icinga2::config_dir}/postgres_schema_loaded.txt", + creates => "${::icinga2::config_dir}/postgres_schema_loaded.txt", } } diff --git a/manifests/feature.pp b/manifests/feature.pp index 1c4a8e96..f47524b2 100644 --- a/manifests/feature.pp +++ b/manifests/feature.pp @@ -33,7 +33,7 @@ Class['icinga2::config'] -> file { "icinga2 feature ${name}": ensure => file, - path => "${::icinga2::params::etcprefix}/features-available/${name}.conf", + path => "${::icinga2::config_dir}/features-available/${name}.conf", content => $content_rel, } -> File["icinga2 feature ${name} enabled"] @@ -42,8 +42,8 @@ file { "icinga2 feature ${name} enabled": ensure => link, - path => "${::icinga2::params::etcprefix}/features-enabled/${name}.conf", - target => "${::icinga2::params::etcprefix}/features-available/${name}.conf", + path => "${::icinga2::config_dir}/features-enabled/${name}.conf", + target => "${::icinga2::config_dir}/features-available/${name}.conf", } if $::icinga2::manage_service { diff --git a/manifests/feature/api.pp b/manifests/feature/api.pp index 32ecf0e0..905c1119 100644 --- a/manifests/feature/api.pp +++ b/manifests/feature/api.pp @@ -8,9 +8,9 @@ class icinga2::feature::api ( $accept_commands = false, $accept_config = false, - $ca_path = "${::icinga2::params::etcprefix}/pki/ca.crt", - $cert_path = "${::icinga2::params::etcprefix}/pki/${::fqdn}.crt", - $key_path = "${::icinga2::params::etcprefix}/pki/${::fqdn}.key", + $ca_path = "${::icinga2::config_dir}/pki/ca.crt", + $cert_path = "${::icinga2::config_dir}/pki/${::fqdn}.crt", + $key_path = "${::icinga2::config_dir}/pki/${::fqdn}.key", $crl_path = undef, $bind_host = undef, $bind_port = undef, diff --git a/manifests/feature/debuglog.pp b/manifests/feature/debuglog.pp index 81a3d779..bfe970c7 100644 --- a/manifests/feature/debuglog.pp +++ b/manifests/feature/debuglog.pp @@ -4,7 +4,7 @@ # class icinga2::feature::debuglog ( $severity = 'debug', - $path = "${::icinga2::params::varprefix}/log/icinga2/debug.log" + $path = "${::icinga2::var_dir}/log/icinga2/debug.log" ) { validate_string($severity) diff --git a/manifests/feature/graphite.pp b/manifests/feature/graphite.pp index 7bf150ac..73f75ece 100644 --- a/manifests/feature/graphite.pp +++ b/manifests/feature/graphite.pp @@ -21,7 +21,7 @@ enable_send_thresholds => $enable_send_thresholds, enable_send_metadata => $enable_send_metadata, enable_legacy_mode => $enable_legacy_mode, - target_dir => "${::icinga2::params::etcprefix}/features-available", + target_dir => "${::icinga2::config_dir}/features-available", } ::icinga2::feature { 'graphite': diff --git a/manifests/feature/ido_mysql.pp b/manifests/feature/ido_mysql.pp index d9d950a4..5b19192c 100644 --- a/manifests/feature/ido_mysql.pp +++ b/manifests/feature/ido_mysql.pp @@ -51,7 +51,7 @@ cleanup => $cleanup, categories => $categories, target_file_name => 'ido-mysql.conf', - target_dir => "${::icinga2::params::etcprefix}/features-available", + target_dir => "${::icinga2::config_dir}/features-available", } -> ::icinga2::feature { 'ido-mysql': diff --git a/manifests/feature/ido_pgsql.pp b/manifests/feature/ido_pgsql.pp index 0facefb1..e3c2a75c 100644 --- a/manifests/feature/ido_pgsql.pp +++ b/manifests/feature/ido_pgsql.pp @@ -51,7 +51,7 @@ cleanup => $cleanup, categories => $categories, target_file_name => 'ido-pgsql.conf', - target_dir => "${::icinga2::params::etcprefix}/features-available", + target_dir => "${::icinga2::config_dir}/features-available", } -> ::icinga2::feature { 'ido-pgsql': diff --git a/manifests/feature/mainlog.pp b/manifests/feature/mainlog.pp index d6cfef46..c188f2a2 100644 --- a/manifests/feature/mainlog.pp +++ b/manifests/feature/mainlog.pp @@ -4,7 +4,7 @@ # class icinga2::feature::mainlog ( $severity = 'information', - $path = "${::icinga2::params::varprefix}/log/icinga2/icinga2.log" + $path = "${::icinga2::var_dir}/log/icinga2/icinga2.log" ) { validate_string($severity) diff --git a/manifests/init.pp b/manifests/init.pp index 17be3f18..59ca8fa3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -38,10 +38,10 @@ $db_schema_pgsql = $::icinga2::params::db_schema_pgsql, $pid_file = $::icinga2::params::pid_file, $restart_cmd = $::icinga2::params::restart_cmd, - $dirprefix = false, - $etcprefix = false, - $shareprefix = false, - $varprefix = false, + $dirprefix = $::icinga2::params::dirprefix, + $config_dir = $::icinga2::params::config_dir, + $share_dir = $::icinga2::params::share_dir, + $var_dir = $::icinga2::params::var_dir, ) inherits ::icinga2::params { # TODO: temporary parameter until we provide some default templates validate_bool($purge_confd) diff --git a/manifests/object/apiuser.pp b/manifests/object/apiuser.pp index c64afbae..e69e412e 100644 --- a/manifests/object/apiuser.pp +++ b/manifests/object/apiuser.pp @@ -13,7 +13,7 @@ $password = undef, $client_cn = undef, $permissions = ['*'], - $target_dir = "${::icinga2::params::etcprefix}/objects/apiusers", + $target_dir = "${::icinga2::config_dir}/objects/apiusers", $file_name = "${name}.conf", ) { diff --git a/manifests/object/apply_dependency.pp b/manifests/object/apply_dependency.pp index 9b1a5cc8..03f90116 100644 --- a/manifests/object/apply_dependency.pp +++ b/manifests/object/apply_dependency.pp @@ -23,7 +23,7 @@ $states = [], $assign_where = undef, $ignore_where = undef, - $target_dir = "${::icinga2::params::etcprefix}/objects/applys", + $target_dir = "${::icinga2::config_dir}/objects/applys", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/apply_notification_to_host.pp b/manifests/object/apply_notification_to_host.pp index e7c229ee..f1bfaced 100644 --- a/manifests/object/apply_notification_to_host.pp +++ b/manifests/object/apply_notification_to_host.pp @@ -24,7 +24,7 @@ $period = undef, $types = [], $states = [], - $target_dir = "${::icinga2::params::etcprefix}/objects/applys", + $target_dir = "${::icinga2::config_dir}/objects/applys", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/apply_notification_to_service.pp b/manifests/object/apply_notification_to_service.pp index 7215a02a..e3b25317 100644 --- a/manifests/object/apply_notification_to_service.pp +++ b/manifests/object/apply_notification_to_service.pp @@ -25,7 +25,7 @@ $period = undef, $types = [], $states = [], - $target_dir = "${::icinga2::params::etcprefix}/objects/applys", + $target_dir = "${::icinga2::config_dir}/objects/applys", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/apply_scheduleddowntime.pp b/manifests/object/apply_scheduleddowntime.pp index 6acbfe0f..16485706 100644 --- a/manifests/object/apply_scheduleddowntime.pp +++ b/manifests/object/apply_scheduleddowntime.pp @@ -19,7 +19,7 @@ $ignore_where = undef, $fixed = undef, $duration = undef, - $target_dir = "${::icinga2::params::etcprefix}/objects/applys", + $target_dir = "${::icinga2::config_dir}/objects/applys", $file_name = "${name}.conf", ) { diff --git a/manifests/object/apply_service.pp b/manifests/object/apply_service.pp index 9b1c397c..76f07d58 100644 --- a/manifests/object/apply_service.pp +++ b/manifests/object/apply_service.pp @@ -40,7 +40,7 @@ $action_url = undef, $icon_image = undef, $icon_image_alt = undef, - $target_dir = "${::icinga2::params::etcprefix}/objects/applys", + $target_dir = "${::icinga2::config_dir}/objects/applys", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/checkcommand.pp b/manifests/object/checkcommand.pp index 7591fd29..27a54f26 100644 --- a/manifests/object/checkcommand.pp +++ b/manifests/object/checkcommand.pp @@ -22,7 +22,7 @@ $refresh_icinga2_service = true, $sudo = false, $sudo_cmd = '/usr/bin/sudo', - $target_dir = "${::icinga2::params::etcprefix}/objects/checkcommands", + $target_dir = "${::icinga2::config_dir}/objects/checkcommands", $target_file_ensure = file, $target_file_group = $::icinga2::config_group, $target_file_mode = $::icinga2::config_mode, diff --git a/manifests/object/checkresultreader.pp b/manifests/object/checkresultreader.pp index fc0ffe1d..959a0ba6 100644 --- a/manifests/object/checkresultreader.pp +++ b/manifests/object/checkresultreader.pp @@ -13,7 +13,7 @@ $ensure = 'file', $object_checkresultreadername = $name, $spool_dir = undef, - $target_dir = "${::icinga2::params::etcprefix}/objects/checkresultreaders", + $target_dir = "${::icinga2::config_dir}/objects/checkresultreaders", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/compatlogger.pp b/manifests/object/compatlogger.pp index a7010a65..570032fc 100644 --- a/manifests/object/compatlogger.pp +++ b/manifests/object/compatlogger.pp @@ -14,7 +14,7 @@ $object_compatloggername = $name, $log_dir = undef, $rotation_method = undef, - $target_dir = "${::icinga2::params::etcprefix}/objects/compatloggers", + $target_dir = "${::icinga2::config_dir}/objects/compatloggers", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/dependency.pp b/manifests/object/dependency.pp index 56951b47..d350cb02 100644 --- a/manifests/object/dependency.pp +++ b/manifests/object/dependency.pp @@ -20,7 +20,7 @@ $disable_notifications = undef, $period = undef, $states = [], - $target_dir = "${::icinga2::params::etcprefix}/objects/dependencies", + $target_dir = "${::icinga2::config_dir}/objects/dependencies", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/endpoint.pp b/manifests/object/endpoint.pp index 971ad399..fc970b28 100644 --- a/manifests/object/endpoint.pp +++ b/manifests/object/endpoint.pp @@ -13,7 +13,7 @@ $host = undef, $port = undef, $log_duration = undef, - $target_dir = "${::icinga2::params::etcprefix}/objects/endpoints", + $target_dir = "${::icinga2::config_dir}/objects/endpoints", $file_name = "${name}.conf", ) { diff --git a/manifests/object/eventcommand.pp b/manifests/object/eventcommand.pp index 5bd30378..2f572433 100644 --- a/manifests/object/eventcommand.pp +++ b/manifests/object/eventcommand.pp @@ -19,7 +19,7 @@ $env = {}, $vars = {}, $timeout = undef, - $target_dir = "${::icinga2::params::etcprefix}/objects/eventcommands", + $target_dir = "${::icinga2::config_dir}/objects/eventcommands", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/gelfwriter.pp b/manifests/object/gelfwriter.pp index 85fcf681..deb71376 100644 --- a/manifests/object/gelfwriter.pp +++ b/manifests/object/gelfwriter.pp @@ -15,7 +15,7 @@ $source = undef, # Put the object files this defined type generates in features-available # since the Gelf writer feature is one that has to be explicitly enabled. - $target_dir = "${::icinga2::params::etcprefix}/features-available", + $target_dir = "${::icinga2::config_dir}/features-available", $file_name = "${name}.conf", ) { # Do some validation diff --git a/manifests/object/graphitewriter.pp b/manifests/object/graphitewriter.pp index e0713ba4..b1620ef8 100644 --- a/manifests/object/graphitewriter.pp +++ b/manifests/object/graphitewriter.pp @@ -21,7 +21,7 @@ $enable_legacy_mode = undef, # Put the object files this defined type generates in features-available # since the Graphite writer feature is one that has to be explicitly enabled. - $target_dir = "${::icinga2::params::etcprefix}/objects/graphitewriters", + $target_dir = "${::icinga2::config_dir}/objects/graphitewriters", $file_name = "${name}.conf", ) { # Do some validation diff --git a/manifests/object/host.pp b/manifests/object/host.pp index 3999a37c..2be436f7 100644 --- a/manifests/object/host.pp +++ b/manifests/object/host.pp @@ -38,7 +38,7 @@ $action_url = undef, $icon_image = undef, $icon_image_alt = undef, - $target_dir = "${::icinga2::params::etcprefix}/objects/hosts", + $target_dir = "${::icinga2::config_dir}/objects/hosts", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/hostgroup.pp b/manifests/object/hostgroup.pp index b833eb9a..500ffbe7 100644 --- a/manifests/object/hostgroup.pp +++ b/manifests/object/hostgroup.pp @@ -14,7 +14,7 @@ $display_name = $name, $templates = [], $groups = [], - $target_dir = "${::icinga2::params::etcprefix}/objects/hostgroups", + $target_dir = "${::icinga2::config_dir}/objects/hostgroups", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/icingastatuswriter.pp b/manifests/object/icingastatuswriter.pp index 8b12ad78..9b57e555 100644 --- a/manifests/object/icingastatuswriter.pp +++ b/manifests/object/icingastatuswriter.pp @@ -14,7 +14,7 @@ $object_name = $name, $status_path = undef, $update_interval = undef, - $target_dir = "${::icinga2::params::etcprefix}/objects/icingastatuswriters", + $target_dir = "${::icinga2::config_dir}/objects/icingastatuswriters", $target_file_name = "${name}.conf", $target_file_owner = $::icinga2::config_owner, $target_file_group = $::icinga2::config_group, diff --git a/manifests/object/idomysqlconnection.pp b/manifests/object/idomysqlconnection.pp index 942660f3..1d97458e 100644 --- a/manifests/object/idomysqlconnection.pp +++ b/manifests/object/idomysqlconnection.pp @@ -32,7 +32,7 @@ }, $categories = [], $target_file_name = "${name}.conf", - $target_dir = "${::icinga2::params::etcprefix}/objects/idomysqlconnections", + $target_dir = "${::icinga2::config_dir}/objects/idomysqlconnections", $refresh_service = $::icinga2::manage_service, ) { diff --git a/manifests/object/idopgsqlconnection.pp b/manifests/object/idopgsqlconnection.pp index c4476433..2f835ae3 100644 --- a/manifests/object/idopgsqlconnection.pp +++ b/manifests/object/idopgsqlconnection.pp @@ -32,7 +32,7 @@ }, $categories = [], $target_file_name = "${name}.conf", - $target_dir = "${::icinga2::params::etcprefix}/objects/idopgsqlconnections", + $target_dir = "${::icinga2::config_dir}/objects/idopgsqlconnections", $refresh_service = $::icinga2::manage_service, ) { diff --git a/manifests/object/livestatuslistener.pp b/manifests/object/livestatuslistener.pp index bde6937e..15f0558a 100644 --- a/manifests/object/livestatuslistener.pp +++ b/manifests/object/livestatuslistener.pp @@ -16,7 +16,7 @@ $bind_port = undef, $socket_path = undef, $compat_log_path = undef, - $target_dir = "${::icinga2::params::etcprefix}/objects/livestatuslisteners", + $target_dir = "${::icinga2::config_dir}/objects/livestatuslisteners", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/notification.pp b/manifests/object/notification.pp index 48f88ad7..1904a8a1 100644 --- a/manifests/object/notification.pp +++ b/manifests/object/notification.pp @@ -24,7 +24,7 @@ $period = undef, $types = [], $states = [], - $target_dir = "${::icinga2::params::etcprefix}/objects/notifications", + $target_dir = "${::icinga2::config_dir}/objects/notifications", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/notificationcommand.pp b/manifests/object/notificationcommand.pp index 601e3942..670827a3 100644 --- a/manifests/object/notificationcommand.pp +++ b/manifests/object/notificationcommand.pp @@ -19,7 +19,7 @@ $env = {}, $vars = {}, $timeout = undef, - $target_dir = "${::icinga2::params::etcprefix}/objects/notificationcommands", + $target_dir = "${::icinga2::config_dir}/objects/notificationcommands", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/opentsdbwriter.pp b/manifests/object/opentsdbwriter.pp index 3c697cb2..ec738d89 100644 --- a/manifests/object/opentsdbwriter.pp +++ b/manifests/object/opentsdbwriter.pp @@ -14,7 +14,7 @@ $port = 4242, # Put the object files this defined type generates in features-available # since the Graphite writer feature is one that has to be explicitly enabled. - $target_dir = "${::icinga2::params::etcprefix}/features-available", + $target_dir = "${::icinga2::config_dir}/features-available", $file_name = "${name}.conf", ) { # Do some validation diff --git a/manifests/object/perfdatawriter.pp b/manifests/object/perfdatawriter.pp index 8c4e2fc9..57019bc2 100644 --- a/manifests/object/perfdatawriter.pp +++ b/manifests/object/perfdatawriter.pp @@ -19,7 +19,7 @@ $host_format_template = undef, $service_format_template = undef, $rotation_interval = undef, - $target_dir = "${::icinga2::params::etcprefix}/objects/perfdatawriters", + $target_dir = "${::icinga2::config_dir}/objects/perfdatawriters", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/scheduleddowntime.pp b/manifests/object/scheduleddowntime.pp index 7dc3b25d..f57372a8 100644 --- a/manifests/object/scheduleddowntime.pp +++ b/manifests/object/scheduleddowntime.pp @@ -18,7 +18,7 @@ $fixed = true, $duration = undef, $ranges = {}, - $target_dir = "${::icinga2::params::etcprefix}/objects/scheduleddowntimes", + $target_dir = "${::icinga2::config_dir}/objects/scheduleddowntimes", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/service.pp b/manifests/object/service.pp index f3e8f25b..b9b82ac2 100644 --- a/manifests/object/service.pp +++ b/manifests/object/service.pp @@ -37,7 +37,7 @@ $action_url = undef, $icon_image = undef, $icon_image_alt = undef, - $target_dir = "${::icinga2::params::etcprefix}/objects/services", + $target_dir = "${::icinga2::config_dir}/objects/services", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/servicegroup.pp b/manifests/object/servicegroup.pp index fbe94790..852116e5 100644 --- a/manifests/object/servicegroup.pp +++ b/manifests/object/servicegroup.pp @@ -14,7 +14,7 @@ $display_name = $name, $templates = [], $groups = [], - $target_dir = "${::icinga2::params::etcprefix}/objects/servicegroups", + $target_dir = "${::icinga2::config_dir}/objects/servicegroups", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/statusdatawriter.pp b/manifests/object/statusdatawriter.pp index b2b4c762..ae658aa1 100644 --- a/manifests/object/statusdatawriter.pp +++ b/manifests/object/statusdatawriter.pp @@ -14,7 +14,7 @@ $status_path = undef, $objects_path = undef, $update_interval = undef, - $target_dir = "${::icinga2::params::etcprefix}/objects/statusdatawriters", + $target_dir = "${::icinga2::config_dir}/objects/statusdatawriters", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/timeperiod.pp b/manifests/object/timeperiod.pp index 86faf6a0..d58eb3a6 100644 --- a/manifests/object/timeperiod.pp +++ b/manifests/object/timeperiod.pp @@ -15,7 +15,7 @@ $timeperiod_display_name = undef, $methods = undef, $ranges = {}, - $target_dir = "${::icinga2::params::etcprefix}/objects/timeperiods", + $target_dir = "${::icinga2::config_dir}/objects/timeperiods", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/user.pp b/manifests/object/user.pp index 8ce60a54..5f1fd023 100644 --- a/manifests/object/user.pp +++ b/manifests/object/user.pp @@ -22,7 +22,7 @@ $period = undef, $types = [], $states = [], - $target_dir = "${::icinga2::params::etcprefix}/objects/users", + $target_dir = "${::icinga2::config_dir}/objects/users", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/usergroup.pp b/manifests/object/usergroup.pp index 9bd7436e..7d08a730 100644 --- a/manifests/object/usergroup.pp +++ b/manifests/object/usergroup.pp @@ -14,7 +14,7 @@ $display_name = $name, $templates = [], $groups = [], - $target_dir = "${::icinga2::params::etcprefix}/objects/usergroups", + $target_dir = "${::icinga2::config_dir}/objects/usergroups", $target_file_name = "${name}.conf", $target_file_ensure = file, $target_file_owner = $::icinga2::config_owner, diff --git a/manifests/object/zone.pp b/manifests/object/zone.pp index 0f664bc5..1de11a85 100644 --- a/manifests/object/zone.pp +++ b/manifests/object/zone.pp @@ -12,7 +12,7 @@ $endpoints = undef, $global = false, $parent = undef, - $target_dir = "${::icinga2::params::etcprefix}/objects/zones", + $target_dir = "${::icinga2::config_dir}/objects/zones", $file_name = "${name}.conf", ) { diff --git a/manifests/params.pp b/manifests/params.pp index 7cfb4d34..72adf25a 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -27,47 +27,12 @@ $config_template = 'icinga2/icinga2.conf.erb' $manage_service = true - - if $::icinga2::etcprefix { - $etcprefix = $::icinga2::etcprefix - } - elsif $::icinga2::dirprefix { - $etcprefix = "${::icinga2::dirprefix}/etc" - } - else { - $etcprefix = '/etc/icinga2' - } - - if $::icinga2::shareprefix { - $shareprefix = $::icinga2::shareprefix - } - elsif $::icinga2::dirprefix { - $shareprefix = "${::icinga2::dirprefix}/share" - } - else { - $shareprefix = '/usr/share' - } - - if $::icinga2::varprefix { - $varprefix = $::icinga2::varprefix - } - elsif $::icinga2::dirprefix { - $varprefix = "${::icinga2::dirprefix}/var" - } - else { - $varprefix = '/var' - } - #Database paramters $db_type = 'pgsql' $db_name = 'icinga2_data' $db_user = 'icinga2' $db_pass = 'password' - # the schema is currently not OS specific - $db_schema_mysql = "${shareprefix}/icinga2-ido-mysql/schema/mysql.sql" - $db_schema_pgsql = "${shareprefix}/icinga2-ido-pgsql/schema/pgsql.sql" - $pid_file = '/run/icinga2/icinga2.pid' $restart_cmd = undef @@ -150,4 +115,39 @@ default: { fail("${::operatingsystem} is not supported!") } } + + if $::icinga2::config_dir { + $config_dir = $::icinga2::config_dir + } + elsif $::icinga2::dirprefix { + $config_dir = "${::icinga2::dirprefix}/etc" + } + else { + $config_dir = '/etc/icinga2' + } + + if $::icinga2::share_dir { + $share_dir = $::icinga2::share_dir + } + elsif $::icinga2::dirprefix { + $share_dir = "${::icinga2::dirprefix}/share" + } + else { + $share_dir = '/usr/share' + } + + if $::icinga2::var_dir { + $var_dir = $::icinga2::var_dir + } + elsif $::icinga2::dirprefix { + $var_dir = "${::icinga2::dirprefix}/var" + } + else { + $var_dir = '/var' + } + + # the schema is currently not OS specific + $db_schema_mysql = "${share_dir}/icinga2-ido-mysql/schema/mysql.sql" + $db_schema_pgsql = "${share_dir}/icinga2-ido-pgsql/schema/pgsql.sql" + } diff --git a/manifests/pki/icinga.pp b/manifests/pki/icinga.pp index 08e13f39..093b019b 100644 --- a/manifests/pki/icinga.pp +++ b/manifests/pki/icinga.pp @@ -22,7 +22,7 @@ $ticket_id = icinga2_ticket_id($::fqdn, $ticket_salt) - $pki_dir = "${::icinga2::params::etcprefix}/pki" + $pki_dir = "${::icinga2::config_dir}/pki" $ca = "${pki_dir}/ca.crt" $key = "${pki_dir}/${hostname}.key" $cert = "${pki_dir}/${hostname}.crt" diff --git a/manifests/pki/puppet.pp b/manifests/pki/puppet.pp index 84a85e66..b604a41e 100644 --- a/manifests/pki/puppet.pp +++ b/manifests/pki/puppet.pp @@ -3,13 +3,13 @@ # Provide PKI certificates for Icinga2 from the Puppet agent. # class icinga2::pki::puppet( - $ca_path = "${::icinga2::params::etcprefix}/pki/ca.crt", + $ca_path = "${::icinga2::config_dir}/pki/ca.crt", $ca_source = "${::settings::ssldir}/certs/ca.pem", - $cert_path = "${::icinga2::params::etcprefix}/pki/${::fqdn}.crt", + $cert_path = "${::icinga2::config_dir}/pki/${::fqdn}.crt", $cert_source = "${::settings::ssldir}/certs/${::fqdn}.pem", - $key_path = "${::icinga2::params::etcprefix}/pki/${::fqdn}.key", + $key_path = "${::icinga2::config_dir}/pki/${::fqdn}.key", $key_source = "${::settings::ssldir}/private_keys/${::fqdn}.pem", - $crl_path = "${::icinga2::params::etcprefix}/pki/crl.pem", + $crl_path = "${::icinga2::config_dir}/pki/crl.pem", $crl_source = "${::settings::ssldir}/crl.pem", ) {