From 6aa2dcdd72d5617f40d29954496e53d235ddeb36 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 9 Sep 2014 13:40:16 +0200 Subject: [PATCH] Profile `icingaweb2_dev': outsource Icinga Web 2 config file provision into (new) `define's icingaweb2::config icingaweb2::config::monitoring refs #6842 --- .../icingaweb2/manifests/config/init.pp | 9 +++ .../icingaweb2/manifests/config/monitoring.pp | 6 ++ .../profiles/icingaweb2_dev/manifests/init.pp | 80 +++---------------- 3 files changed, 28 insertions(+), 67 deletions(-) create mode 100644 .vagrant-puppet/modules/icingaweb2/manifests/config/init.pp create mode 100644 .vagrant-puppet/modules/icingaweb2/manifests/config/monitoring.pp diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config/init.pp b/.vagrant-puppet/modules/icingaweb2/manifests/config/init.pp new file mode 100644 index 000000000..a1f364d06 --- /dev/null +++ b/.vagrant-puppet/modules/icingaweb2/manifests/config/init.pp @@ -0,0 +1,9 @@ +define icingaweb2::config ($source, $replace = true) { + $path = "/etc/icingaweb/${name}.ini" + file { $path: + source => "${source}${path}", + owner => 'apache', + group => 'apache', + replace => $replace, + } +} diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config/monitoring.pp b/.vagrant-puppet/modules/icingaweb2/manifests/config/monitoring.pp new file mode 100644 index 000000000..151252185 --- /dev/null +++ b/.vagrant-puppet/modules/icingaweb2/manifests/config/monitoring.pp @@ -0,0 +1,6 @@ +define icingaweb2::config::monitoring ($source, $replace = true) { + icingaweb2::config { "modules/monitoring/${name}": + source => $source, + replace => $replace, + } +} diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index e65e920b9..f3e93ca16 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -30,84 +30,30 @@ class icingaweb2_dev { notify => Service['apache'], } - file { '/etc/icingaweb': - ensure => 'directory', - owner => 'apache', - group => 'apache' - } - - file { '/etc/icingaweb/authentication.ini': - source => 'puppet:////vagrant/config/authentication.ini', - owner => 'apache', - group => 'apache', - require => File['/etc/icingaweb'], - } - file { '/etc/icingaweb/config.ini': ensure => file, owner => 'apache', group => 'apache', } - file { '/etc/icingaweb/menu.ini': - source => 'puppet:////vagrant/config/menu.ini', - owner => 'apache', - group => 'apache', - # replace => false, - } - - file { '/etc/icingaweb/resources.ini': - source => 'puppet:////vagrant/config/resources.ini', - owner => 'apache', - group => 'apache', - replace => false - } - - file { ['/etc/icingaweb/enabledModules', '/etc/icingaweb/modules', '/etc/icingaweb/modules/monitoring', '/etc/icingaweb/modules/doc']: + file { [ + '/etc/icingaweb', + '/etc/icingaweb/enabledModules', + '/etc/icingaweb/modules', + '/etc/icingaweb/modules/monitoring', + '/etc/icingaweb/modules/doc', + '/etc/icingaweb/dashboard' + ]: ensure => 'directory', owner => 'apache', group => 'apache', } - file { '/etc/icingaweb/modules/monitoring/backends.ini': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/backends.ini', - owner => 'apache', - group => 'apache', + icingaweb2::config { [ 'dashboard/dashboard', 'modules/doc/menu', 'authentication', 'menu' ]: } + + icingaweb2::config { 'resources': + replace => false, } - file { '/etc/icingaweb/modules/monitoring/config.ini': - source => 'puppet:////vagrant/config/modules/monitoring/config.ini', - owner => 'apache', - group => 'apache', - } - - file { '/etc/icingaweb/modules/monitoring/instances.ini': - source => 'puppet:////vagrant/config/modules/monitoring/instances.ini', - owner => 'apache', - group => 'apache', - } - - file { '/etc/icingaweb/modules/monitoring/menu.ini': - source => 'puppet:////vagrant/config/modules/monitoring/menu.ini', - owner => 'apache', - group => 'apache', - } - - file { '/etc/icingaweb/dashboard': - ensure => 'directory', - owner => 'apache', - group => 'apache', - } - - file { '/etc/icingaweb/dashboard/dashboard.ini': - source => 'puppet:////vagrant/config/dashboard/dashboard.ini', - owner => 'apache', - group => 'apache', - } - - file { '/etc/icingaweb/modules/doc/menu.ini': - source => 'puppet:////vagrant/config/modules/doc/menu.ini', - owner => 'apache', - group => 'apache', - } + icingaweb2::config::monitoring { [ 'backends', 'config', 'instances', 'menu' ]: } }