puppet: Use hiera for defining the icinga web group

This commit is contained in:
Eric Lippmann 2015-01-19 11:43:13 +01:00
parent 64d4bb089c
commit ae4a9fe50c
5 changed files with 23 additions and 18 deletions

View File

@ -5,3 +5,4 @@ icingaweb2::web_path: icingaweb2
icingaweb2::db_user: icingaweb2
icingaweb2::db_pass: icingaweb2
icingaweb2::db_name: icingaweb2
icingaweb2::group: icingaweb2

View File

@ -1,14 +1,15 @@
class icingaweb2::config (
$config = hiera('icingaweb2::config')
$config = hiera('icingaweb2::config'),
$web_group = hiera('icingaweb2::group')
) {
group { 'icingaweb':
group { $web_group:
ensure => present,
}
file { [ "${config}", "${config}/enabledModules", "${config}/modules", "${config}/preferences" ]:
ensure => directory,
owner => 'root',
group => 'icingaweb',
group => $web_group,
mode => '2770',
}
}

View File

@ -1,14 +1,15 @@
define icingaweb2::config::general (
$source,
$config = hiera('icingaweb2::config'),
$replace = true
$config = hiera('icingaweb2::config'),
$web_group = hiera('icingaweb2::group'),
$replace = true
) {
include icingaweb2::config
file { "${config}/${name}.ini":
content => template("${source}/${name}.ini.erb"),
owner => 'root',
group => 'icingaweb',
group => $web_group,
mode => 0660,
replace => $replace,
}

View File

@ -1,8 +1,9 @@
define icingaweb2::config::module (
$module,
$source,
$config = hiera('icingaweb2::config'),
$replace = true
$config = hiera('icingaweb2::config'),
$web_group = hiera('icingaweb2::group'),
$replace = true
) {
include icingaweb2::config
@ -10,7 +11,7 @@ define icingaweb2::config::module (
file { "${config}/modules/${module}":
ensure => directory,
owner => 'root',
group => 'icingaweb',
group => $web_group,
mode => '2770',
}
}
@ -18,7 +19,7 @@ define icingaweb2::config::module (
file { "${config}/modules/${module}/${name}.ini":
source => "${source}/modules/${module}/${name}.ini",
owner => 'root',
group => 'icingaweb',
group => $web_group,
mode => 0660,
replace => $replace,
}

View File

@ -1,10 +1,11 @@
class icingaweb2_dev (
$config = hiera('icingaweb2::config'),
$log = hiera('icingaweb2::log'),
$web_path = hiera('icingaweb2::web_path'),
$db_user = hiera('icingaweb2::db_user'),
$db_pass = hiera('icingaweb2::db_pass'),
$db_name = hiera('icingaweb2::db_name'),
$config = hiera('icingaweb2::config'),
$log = hiera('icingaweb2::log'),
$web_path = hiera('icingaweb2::web_path'),
$db_user = hiera('icingaweb2::db_user'),
$db_pass = hiera('icingaweb2::db_pass'),
$db_name = hiera('icingaweb2::db_name'),
$web_group = hiera('icingaweb2::group'),
) {
include apache
include php
@ -28,7 +29,7 @@ class icingaweb2_dev (
Exec { path => '/usr/local/bin:/usr/bin:/bin' }
# TODO(el): Enabling/disabling modules should be a resource
User <| alias == apache |> { groups +> 'icingaweb' }
User <| alias == apache |> { groups +> $web_group }
-> exec { 'enable-monitoring-module':
command => 'icingacli module enable monitoring',
user => 'apache',
@ -50,7 +51,7 @@ class icingaweb2_dev (
file { $log_dir:
ensure => directory,
owner => 'root',
group => 'icingaweb',
group => $web_group,
mode => '2775'
}