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_user: icingaweb2
icingaweb2::db_pass: icingaweb2 icingaweb2::db_pass: icingaweb2
icingaweb2::db_name: icingaweb2 icingaweb2::db_name: icingaweb2
icingaweb2::group: icingaweb2

View File

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

View File

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

View File

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

View File

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