From 88065832896cddf0efb3c0d0aa1fd5c8c21ae7bc Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 4 Aug 2014 13:40:11 +0200 Subject: [PATCH 001/238] Outsource Icinga (2) database creation into mysql::database refs #6842 --- .vagrant-puppet/manifests/default.pp | 16 ++----------- .../modules/mysql/manifests/database.pp | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 .vagrant-puppet/modules/mysql/manifests/database.pp diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 68affd347..c75917725 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -8,21 +8,9 @@ Exec { path => '/bin:/usr/bin:/sbin' } $icingaVersion = '1.11.2' $icinga2Version = '2.0.0' -exec { 'create-mysql-icinga-db': - unless => 'mysql -uicinga -picinga icinga', - command => 'mysql -uroot -e "CREATE DATABASE icinga; \ - GRANT SELECT,INSERT,UPDATE,DELETE ON icinga.* TO icinga@localhost \ - IDENTIFIED BY \'icinga\';"', - require => Service['mysqld'] -} +mysql::database { 'icinga': } -exec { 'create-mysql-icinga2-db': - unless => 'mysql -uicinga2 -picinga2 icinga2', - command => 'mysql -uroot -e "CREATE DATABASE icinga2; \ - GRANT SELECT,INSERT,UPDATE,DELETE ON icinga2.* to icinga2@localhost \ - IDENTIFIED BY \'icinga2\';"', - require => Service['mysqld'] -} +mysql::database { 'icinga2': } exec{ 'create-pgsql-icinga-db': unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icinga\'" | grep -q 1', diff --git a/.vagrant-puppet/modules/mysql/manifests/database.pp b/.vagrant-puppet/modules/mysql/manifests/database.pp new file mode 100644 index 000000000..1c1a97dee --- /dev/null +++ b/.vagrant-puppet/modules/mysql/manifests/database.pp @@ -0,0 +1,23 @@ +define mysql::database ( + $username = 'UNDEF', + $password = 'UNDEF' +) { + include mysql + + $user = $username ? { + /UNDEF/ => $name, + default => $username, + } + $pass = $password ? { + /UNDEF/ => $user, + default => $password, + } + + exec { "create-mysql-${name}-db": + unless => "mysql -u${user} -p${pass} ${name}", + command => "mysql -uroot -e \"CREATE DATABASE ${name}; \ +GRANT SELECT,INSERT,UPDATE,DELETE ON ${name}.* TO ${user}@localhost \ +IDENTIFIED BY '${pass}';\"", + require => Service['mysqld'] + } +} From 261a5dd43d5715df5738604d427497c5fc3ec2f6 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 5 Aug 2014 11:17:17 +0200 Subject: [PATCH 002/238] Don't declare the variable $icinga_packages because it's used only once --- .vagrant-puppet/manifests/default.pp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index c75917725..ee5620aaa 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -20,11 +20,13 @@ exec{ 'create-pgsql-icinga-db': require => Service['postgresql'] } -$icinga_packages = [ 'gcc', 'glibc', 'glibc-common', 'gd', 'gd-devel', +package { [ + 'gcc', 'glibc', 'glibc-common', 'gd', 'gd-devel', 'libpng', 'libpng-devel', 'net-snmp', 'net-snmp-devel', 'net-snmp-utils', 'libdbi', 'libdbi-devel', 'libdbi-drivers', - 'libdbi-dbd-mysql', 'libdbi-dbd-pgsql' ] -package { $icinga_packages: ensure => installed } + 'libdbi-dbd-mysql', 'libdbi-dbd-pgsql' ]: + ensure => installed +} php::extension { ['php-mysql', 'php-pgsql', 'php-ldap']: require => [ Class['mysql'], Class['pgsql'], Class['openldap'] ] From 8f23f61e005a710f58940d58c6a8273158853681 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 5 Aug 2014 11:48:25 +0200 Subject: [PATCH 003/238] Don't use `UNDEF' default values --- .vagrant-puppet/manifests/default.pp | 10 ++++++++-- .../modules/mysql/manifests/database.pp | 20 ++++--------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index ee5620aaa..3e8549329 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -8,9 +8,15 @@ Exec { path => '/bin:/usr/bin:/sbin' } $icingaVersion = '1.11.2' $icinga2Version = '2.0.0' -mysql::database { 'icinga': } +mysql::database { 'icinga': + username => 'icinga', + password => 'icinga', +} -mysql::database { 'icinga2': } +mysql::database { 'icinga2': + username => 'icinga2', + password => 'icinga2', +} exec{ 'create-pgsql-icinga-db': unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icinga\'" | grep -q 1', diff --git a/.vagrant-puppet/modules/mysql/manifests/database.pp b/.vagrant-puppet/modules/mysql/manifests/database.pp index 1c1a97dee..7e3127cfc 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database.pp @@ -1,23 +1,11 @@ -define mysql::database ( - $username = 'UNDEF', - $password = 'UNDEF' -) { +define mysql::database ($username, $password) { include mysql - $user = $username ? { - /UNDEF/ => $name, - default => $username, - } - $pass = $password ? { - /UNDEF/ => $user, - default => $password, - } - exec { "create-mysql-${name}-db": - unless => "mysql -u${user} -p${pass} ${name}", + unless => "mysql -u${username} -p${password} ${name}", command => "mysql -uroot -e \"CREATE DATABASE ${name}; \ -GRANT SELECT,INSERT,UPDATE,DELETE ON ${name}.* TO ${user}@localhost \ -IDENTIFIED BY '${pass}';\"", +GRANT SELECT,INSERT,UPDATE,DELETE ON ${name}.* TO ${username}@localhost \ +IDENTIFIED BY '${password}';\"", require => Service['mysqld'] } } From 82fa6e690f1b37a1512c322d4016830a1ff6a0d4 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 5 Aug 2014 13:09:33 +0200 Subject: [PATCH 004/238] Outsource Icinga (2) database population into mysql::database --- .vagrant-puppet/manifests/default.pp | 16 ++++------------ .../modules/mysql/manifests/database.pp | 8 +++++++- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 3e8549329..390b31b7b 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -11,11 +11,15 @@ $icinga2Version = '2.0.0' mysql::database { 'icinga': username => 'icinga', password => 'icinga', + schemafile => "/usr/local/src/icinga-mysql/icinga-${icingaVersion}/module/idoutils/db/mysql/mysql.sql", + requirement => Cmmi['icinga-mysql'], } mysql::database { 'icinga2': username => 'icinga2', password => 'icinga2', + schemafile => "/usr/share/doc/icinga2-ido-mysql-${icinga2Version}/schema/mysql.sql", + requirement => Package['icinga2-ido-mysql'], } exec{ 'create-pgsql-icinga-db': @@ -111,12 +115,6 @@ file { '/etc/init.d/ido2db-pgsql': require => Cmmi['icinga-pgsql'] } -exec { 'populate-icinga-mysql-db': - unless => 'mysql -uicinga -picinga icinga -e "SELECT * FROM icinga_dbversion;" &> /dev/null', - command => "mysql -uroot icinga < /usr/local/src/icinga-mysql/icinga-${icingaVersion}/module/idoutils/db/mysql/mysql.sql", - require => [ Cmmi['icinga-mysql'], Exec['create-mysql-icinga-db'] ] -} - exec { 'populate-icinga-pgsql-db': unless => 'psql -U icinga -d icinga -c "SELECT * FROM icinga_dbversion;" &> /dev/null', command => "sudo -u postgres psql -U icinga -d icinga < /usr/local/src/icinga-pgsql/icinga-${icingaVersion}/module/idoutils/db/pgsql/pgsql.sql", @@ -415,12 +413,6 @@ package { 'icinga2-ido-mysql': alias => 'icinga2-ido-mysql' } -exec { 'populate-icinga2-mysql-db': - unless => 'mysql -uicinga2 -picinga2 icinga2 -e "SELECT * FROM icinga_dbversion;" &> /dev/null', - command => "mysql -uroot icinga2 < /usr/share/doc/icinga2-ido-mysql-$icinga2Version/schema/mysql.sql", - require => [ Exec['create-mysql-icinga2-db'], Package['icinga2-ido-mysql'] ] -} - file { '/etc/icinga2/features-available/ido-mysql.conf': source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf', diff --git a/.vagrant-puppet/modules/mysql/manifests/database.pp b/.vagrant-puppet/modules/mysql/manifests/database.pp index 7e3127cfc..e0f990c1b 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database.pp @@ -1,4 +1,4 @@ -define mysql::database ($username, $password) { +define mysql::database ($username, $password, $schemafile, $requirement) { include mysql exec { "create-mysql-${name}-db": @@ -8,4 +8,10 @@ GRANT SELECT,INSERT,UPDATE,DELETE ON ${name}.* TO ${username}@localhost \ IDENTIFIED BY '${password}';\"", require => Service['mysqld'] } + + exec { "populate-${name}-mysql-db": + unless => "mysql -u${username} -p${password} ${name} -e \"SELECT * FROM icinga_dbversion;\" &> /dev/null", + command => "mysql -uroot ${name} < ${schemafile}", + require => [ $requirement, Exec["create-mysql-${name}-db"] ] + } } From fe11ca4744bbb8b866b12457f525a6fa0e75ff76 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 5 Aug 2014 13:50:23 +0200 Subject: [PATCH 005/238] Merge branch 'master' into feature/deduplicate-puppet-code-6842 --- .vagrant-puppet/manifests/default.pp | 24 +++++----- .../controllers/AuthenticationController.php | 4 +- .../views/scripts/authentication/logout.phtml | 41 ++++------------- .../Backend/AutoLoginBackend.php | 1 + library/Icinga/Authentication/Manager.php | 44 +++---------------- library/Icinga/User.php | 43 ++++++++++++++++++ .../Web/Controller/ActionController.php | 2 + .../application/clicommands/ListCommand.php | 4 +- .../library/Monitoring/Plugin/Perfdata.php | 11 ++++- .../Monitoring/Plugin/PerfdataTest.php | 8 ++++ 10 files changed, 98 insertions(+), 84 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 390b31b7b..ede5c5c36 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -5,8 +5,12 @@ include openldap Exec { path => '/bin:/usr/bin:/sbin' } -$icingaVersion = '1.11.2' -$icinga2Version = '2.0.0' +$icingaVersion = '1.11.5' +$icinga2Version = '2.0.1' +$pluginVersion = '2.0' +$livestatusVersion = '1.2.4p5' +$phantomjsVersion = '1.9.1' +$casperjsVersion = '1.0.2' mysql::database { 'icinga': username => 'icinga', @@ -201,8 +205,8 @@ exec { 'icinga-htpasswd': } cmmi { 'icinga-plugins': - url => 'https://www.monitoring-plugins.org/download/nagios-plugins-1.5.tar.gz', - output => 'nagios-plugins-1.5.tar.gz', + url => "https://www.monitoring-plugins.org/download/monitoring-plugins-${pluginVersion}.tar.gz", + output => "monitoring-plugins-${pluginVersion}.tar.gz", flags => '--prefix=/usr/lib64/nagios/plugins \ --with-nagios-user=icinga --with-nagios-group=icinga \ --with-cgiurl=/icinga-mysql/cgi-bin', @@ -212,8 +216,8 @@ cmmi { 'icinga-plugins': } cmmi { 'mk-livestatus': - url => 'http://mathias-kettner.de/download/mk-livestatus-1.2.2p1.tar.gz', - output => 'mk-livestatus-1.2.2p1.tar.gz', + url => "http://mathias-kettner.de/download/mk-livestatus-${livestatusVersion}.tar.gz", + output => "mk-livestatus-${livestatusVersion}.tar.gz", flags => '--prefix=/usr/local/icinga-mysql --exec-prefix=/usr/local/icinga-mysql', creates => '/usr/local/icinga-mysql/lib/mk-livestatus', make => 'make && make install', @@ -256,14 +260,14 @@ exec { 'populate-openldap': } class { 'phantomjs': - url => 'https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2', - output => 'phantomjs-1.9.1-linux-x86_64.tar.bz2', + url => "https://phantomjs.googlecode.com/files/phantomjs-${phantomjsVersion}-linux-x86_64.tar.bz2", + output => "phantomjs-${phantomjsVersion}-linux-x86_64.tar.bz2", creates => '/usr/local/phantomjs' } class { 'casperjs': - url => 'https://github.com/n1k0/casperjs/tarball/1.0.2', - output => 'casperjs-1.0.2.tar.gz', + url => "https://github.com/n1k0/casperjs/tarball/${casperjsVersion}", + output => "casperjs-${casperjsVersion}.tar.gz", creates => '/usr/local/casperjs' } diff --git a/application/controllers/AuthenticationController.php b/application/controllers/AuthenticationController.php index bbb475989..7d4864d5a 100644 --- a/application/controllers/AuthenticationController.php +++ b/application/controllers/AuthenticationController.php @@ -14,6 +14,7 @@ use Icinga\Exception\AuthenticationException; use Icinga\Exception\NotReadableError; use Icinga\Exception\ConfigurationError; use Icinga\User; +use Icinga\Web\Session; use Icinga\Web\Url; /** @@ -131,9 +132,10 @@ class AuthenticationController extends ActionController public function logoutAction() { $auth = $this->Auth(); + $isRemoteUser = $auth->getUser()->isRemoteUser(); $auth->removeAuthorization(); - if ($auth->isAuthenticatedFromRemoteUser()) { + if ($isRemoteUser === true) { $this->_helper->layout->setLayout('login'); $this->_response->setHttpResponseCode(401); } else { diff --git a/application/views/scripts/authentication/logout.phtml b/application/views/scripts/authentication/logout.phtml index eb0d6dc44..9b03d190f 100644 --- a/application/views/scripts/authentication/logout.phtml +++ b/application/views/scripts/authentication/logout.phtml @@ -7,10 +7,7 @@ in every further request until the browser was closed. To allow logout and to allow the user to change the logged-in user this JavaScript provides a workaround to force a new authentication prompt in most browsers. --> - -
-
-
+

-
-
-
-
- +
-
- diff --git a/library/Icinga/Authentication/Backend/AutoLoginBackend.php b/library/Icinga/Authentication/Backend/AutoLoginBackend.php index d793b50dd..16373bb6c 100644 --- a/library/Icinga/Authentication/Backend/AutoLoginBackend.php +++ b/library/Icinga/Authentication/Backend/AutoLoginBackend.php @@ -53,6 +53,7 @@ class AutoLoginBackend extends UserBackend { if (isset($_SERVER['REMOTE_USER'])) { $username = $_SERVER['REMOTE_USER']; + $user->setRemoteUserInformation($username, 'REMOTE_USER'); if ($this->stripUsernameRegexp !== null) { $stripped = preg_replace($this->stripUsernameRegexp, '', $username); if ($stripped !== false) { diff --git a/library/Icinga/Authentication/Manager.php b/library/Icinga/Authentication/Manager.php index 01964ef00..ec49aa416 100644 --- a/library/Icinga/Authentication/Manager.php +++ b/library/Icinga/Authentication/Manager.php @@ -30,12 +30,6 @@ class Manager */ private $user; - /** - * If the user was authenticated from the REMOTE_USER server variable - * - * @var Boolean - */ - private $fromRemoteUser = false; private function __construct() { @@ -117,6 +111,13 @@ class Manager public function authenticateFromSession() { $this->user = Session::getSession()->get('user'); + + if ($this->user !== null && $this->user->isRemoteUser() === true) { + list($originUsername, $field) = $this->user->getRemoteUserInformation(); + if (array_key_exists($field, $_SERVER) && $_SERVER[$field] !== $originUsername) { + $this->removeAuthorization(); + } + } } /** @@ -204,35 +205,4 @@ class Manager { return $this->user->getGroups(); } - - /** - * Tries to authenticate the user from the session, and then from the REMOTE_USER superglobal, that can be set by - * an external authentication provider. - */ - public function authenticateFromRemoteUser() - { - if (array_key_exists('REMOTE_USER', $_SERVER)) { - $this->fromRemoteUser = true; - } - $this->authenticateFromSession(); - if ($this->user !== null) { - if (array_key_exists('REMOTE_USER', $_SERVER) && $this->user->getUsername() !== $_SERVER["REMOTE_USER"]) { - // Remote user has changed, clear all sessions - $this->removeAuthorization(); - } - return; - } - if (array_key_exists('REMOTE_USER', $_SERVER) && $_SERVER["REMOTE_USER"]) { - $this->user = new User($_SERVER["REMOTE_USER"]); - $this->persistCurrentUser(); - } - } - - /** - * If the session was established from the REMOTE_USER server variable. - */ - public function isAuthenticatedFromRemoteUser() - { - return $this->fromRemoteUser; - } } diff --git a/library/Icinga/User.php b/library/Icinga/User.php index 848877850..13f62881a 100644 --- a/library/Icinga/User.php +++ b/library/Icinga/User.php @@ -58,6 +58,18 @@ class User */ protected $additionalInformation = array(); + /** + * Information if the user is external authenticated + * + * Keys: + * + * 0: origin username + * 1: origin field name + * + * @var array + */ + protected $remoteUserInformation = array(); + /** * Set of permissions * @@ -401,4 +413,35 @@ class User { $this->messages = null; } + + /** + * Set additional remote user information + * + * @param stirng $username + * @param string $field + */ + public function setRemoteUserInformation($username, $field) + { + $this->remoteUserInformation = array($username, $field); + } + + /** + * Get additional remote user information + * + * @return array + */ + public function getRemoteUserInformation() + { + return $this->remoteUserInformation; + } + + /** + * Return true if user has remote user information set + * + * @return bool + */ + public function isRemoteUser() + { + return (count($this->remoteUserInformation)) ? true : false; + } } diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index b28bddc37..1c4111e4b 100644 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -362,6 +362,8 @@ class ActionController extends Zend_Controller_Action 'X-Icinga-Title', rawurlencode($this->view->title . ' :: Icinga Web') ); + } else { + $resp->setHeader('X-Icinga-Title', rawurlencode('Icinga Web')); } if ($this->rerenderLayout) { diff --git a/modules/monitoring/application/clicommands/ListCommand.php b/modules/monitoring/application/clicommands/ListCommand.php index 42a377763..e6b86f4ef 100644 --- a/modules/monitoring/application/clicommands/ListCommand.php +++ b/modules/monitoring/application/clicommands/ListCommand.php @@ -72,6 +72,7 @@ class ListCommand extends Command protected function showFormatted($query, $format, $columns) { + $query = $query->getQuery(); switch($format) { case 'json': echo json_encode($query->fetchAll()); @@ -155,7 +156,7 @@ class ListCommand extends Command 'service_perfdata', 'service_last_state_change' ); - $query = $this->getQuery('status', $columns) + $query = $this->getQuery('serviceStatus', $columns) ->order('host_name'); echo $this->renderStatusQuery($query); } @@ -167,6 +168,7 @@ class ListCommand extends Command $screen = $this->screen; $utils = new CliUtils($screen); $maxCols = $screen->getColumns(); + $query = $query->getQuery(); $rows = $query->fetchAll(); $count = $query->count(); $count = count($rows); diff --git a/modules/monitoring/library/Monitoring/Plugin/Perfdata.php b/modules/monitoring/library/Monitoring/Plugin/Perfdata.php index a6eaddabd..6af3cde17 100644 --- a/modules/monitoring/library/Monitoring/Plugin/Perfdata.php +++ b/modules/monitoring/library/Monitoring/Plugin/Perfdata.php @@ -190,6 +190,9 @@ class Perfdata if ($this->maxValue !== null) { $minValue = $this->minValue !== null ? $this->minValue : 0; + if ($this->maxValue - $minValue === 0.0) { + return null; + } if ($this->value > $minValue) { return (($this->value - $minValue) / ($this->maxValue - $minValue)) * 100; @@ -267,9 +270,13 @@ class Perfdata switch (count($parts)) { case 5: - $this->maxValue = self::convert($parts[4], $this->unit); + if ($parts[4] !== '') { + $this->maxValue = self::convert($parts[4], $this->unit); + } case 4: - $this->minValue = self::convert($parts[3], $this->unit); + if ($parts[3] !== '') { + $this->minValue = self::convert($parts[3], $this->unit); + } case 3: // TODO(#6123): Tresholds have the same UOM and need to be converted as well! $this->criticalThreshold = trim($parts[2]) ? trim($parts[2]) : null; diff --git a/modules/monitoring/test/php/library/Monitoring/Plugin/PerfdataTest.php b/modules/monitoring/test/php/library/Monitoring/Plugin/PerfdataTest.php index 2d8a98b73..9cc132eb2 100644 --- a/modules/monitoring/test/php/library/Monitoring/Plugin/PerfdataTest.php +++ b/modules/monitoring/test/php/library/Monitoring/Plugin/PerfdataTest.php @@ -347,6 +347,14 @@ class PerfdataTest extends BaseTestCase Perfdata::fromString('test=25;;;50;100')->getPercentage(), 'Perfdata objects do return a percentage though their value is lower than it\'s allowed minimum' ); + $this->assertNull( + Perfdata::fromString('test=25;;;0;')->getPercentage(), + 'Perfdata objects do not ignore empty max values when returning percentages' + ); + $this->assertNull( + Perfdata::fromString('test=25;;;0;0')->getPercentage(), + 'Perfdata objects do not ignore impossible min/max combinations when returning percentages' + ); } /** From e42f400f38d955ae81a3312e3f1ca1cce72e3d2c Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 5 Aug 2014 14:42:01 +0200 Subject: [PATCH 006/238] Outsource Icinga database creation and population into pgsql::database refs #6842 --- .vagrant-puppet/manifests/default.pp | 17 +++++------------ .../modules/pgsql/manifests/database.pp | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 .vagrant-puppet/modules/pgsql/manifests/database.pp diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index ede5c5c36..94c868a89 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -26,12 +26,11 @@ mysql::database { 'icinga2': requirement => Package['icinga2-ido-mysql'], } -exec{ 'create-pgsql-icinga-db': - unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icinga\'" | grep -q 1', - command => 'sudo -u postgres psql -c "CREATE ROLE icinga WITH LOGIN PASSWORD \'icingaweb\';" && \ - sudo -u postgres createdb -O icinga -E UTF8 -T template0 icinga && \ - sudo -u postgres createlang plpgsql icinga', - require => Service['postgresql'] +pgsql::database { 'icinga': + username => 'icinga', + password => 'icingaweb', + schemafile => "/usr/local/src/icinga-pgsql/icinga-${icingaVersion}/module/idoutils/db/pgsql/pgsql.sql", + requirement => Cmmi['icinga-pgsql'], } package { [ @@ -119,12 +118,6 @@ file { '/etc/init.d/ido2db-pgsql': require => Cmmi['icinga-pgsql'] } -exec { 'populate-icinga-pgsql-db': - unless => 'psql -U icinga -d icinga -c "SELECT * FROM icinga_dbversion;" &> /dev/null', - command => "sudo -u postgres psql -U icinga -d icinga < /usr/local/src/icinga-pgsql/icinga-${icingaVersion}/module/idoutils/db/pgsql/pgsql.sql", - require => [ Cmmi['icinga-pgsql'], Exec['create-pgsql-icinga-db'] ] -} - service { 'icinga-mysql': ensure => running, require => File['/etc/init.d/icinga-mysql'] diff --git a/.vagrant-puppet/modules/pgsql/manifests/database.pp b/.vagrant-puppet/modules/pgsql/manifests/database.pp new file mode 100644 index 000000000..54703f83a --- /dev/null +++ b/.vagrant-puppet/modules/pgsql/manifests/database.pp @@ -0,0 +1,17 @@ +define pgsql::database ($username, $password, $schemafile, $requirement) { + include pgsql + + exec { "create-pgsql-${name}-db": + unless => "sudo -u postgres psql -tAc \"SELECT 1 FROM pg_roles WHERE rolname='${username}'\" | grep -q 1", + command => "sudo -u postgres psql -c \"CREATE ROLE ${username} WITH LOGIN PASSWORD '${password}';\" && \ +sudo -u postgres createdb -O ${username} -E UTF8 -T template0 ${name} && \ +sudo -u postgres createlang plpgsql ${name}", + require => Service['postgresql'] + } + + exec { "populate-${name}-pgsql-db": + unless => "psql -U ${username} -d ${name} -c \"SELECT * FROM icinga_dbversion;\" &> /dev/null", + command => "sudo -u postgres psql -U ${username} -d ${name} < ${schemafile}", + require => [ $requirement, Exec["create-pgsql-${name}-db"] ] + } +} From ccbc1f5aa0f2078ef814aa8e0a4987242f18adc8 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 5 Aug 2014 15:15:01 +0200 Subject: [PATCH 007/238] Split pgsql::database into pgsql::database::create and pgsql::database::populate refs #6842 --- .vagrant-puppet/manifests/default.pp | 2 +- .vagrant-puppet/modules/pgsql/manifests/database.pp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 94c868a89..cc50a9355 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -26,7 +26,7 @@ mysql::database { 'icinga2': requirement => Package['icinga2-ido-mysql'], } -pgsql::database { 'icinga': +pgsql::database::populate { 'icinga': username => 'icinga', password => 'icingaweb', schemafile => "/usr/local/src/icinga-pgsql/icinga-${icingaVersion}/module/idoutils/db/pgsql/pgsql.sql", diff --git a/.vagrant-puppet/modules/pgsql/manifests/database.pp b/.vagrant-puppet/modules/pgsql/manifests/database.pp index 54703f83a..9d182e6d2 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database.pp @@ -1,4 +1,4 @@ -define pgsql::database ($username, $password, $schemafile, $requirement) { +define pgsql::database::create ($username, $password) { include pgsql exec { "create-pgsql-${name}-db": @@ -8,6 +8,15 @@ sudo -u postgres createdb -O ${username} -E UTF8 -T template0 ${name} && \ sudo -u postgres createlang plpgsql ${name}", require => Service['postgresql'] } +} + +define pgsql::database::populate ($username, $password, $schemafile, $requirement) { + include pgsql + + pgsql::database::create { "create-pgsql-${name}-db": + username => $username, + password => $password, + } exec { "populate-${name}-pgsql-db": unless => "psql -U ${username} -d ${name} -c \"SELECT * FROM icinga_dbversion;\" &> /dev/null", From 9a50cb8fa3d347abff21726088b6dcdaf9963430 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 5 Aug 2014 15:15:46 +0200 Subject: [PATCH 008/238] Outsource 'icinga_unittest' database creation into pgsql::database::create refs #6842 --- .vagrant-puppet/manifests/default.pp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index cc50a9355..8e719bd78 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -489,12 +489,9 @@ exec { 'create-mysql-icinga_unittest-db': require => Service['mysqld'] } -exec{ 'create-pgsql-icinga_unittest-db': - unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icinga_unittest\'" | grep -q 1', - command => 'sudo -u postgres psql -c "CREATE ROLE icinga_unittest WITH LOGIN PASSWORD \'icinga_unittest\';" && \ - sudo -u postgres createdb -O icinga_unittest -E UTF8 -T template0 icinga_unittest && \ - sudo -u postgres createlang plpgsql icinga_unittest', - require => Service['postgresql'] +pgsql::database::create { 'icinga_unittest': + username => 'icinga_unittest', + password => 'icinga_unittest', } exec { 'install php-ZendFramework-Db-Adapter-Pdo-Pgsql': From ee711679e6e999b3886029e00fbd1ca8815e0967 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 5 Aug 2014 15:20:43 +0200 Subject: [PATCH 009/238] Outsource 'icingaweb' database creation into pgsql::database::create refs #6842 --- .vagrant-puppet/manifests/default.pp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 8e719bd78..ea9ee22cb 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -581,12 +581,9 @@ exec { 'create-mysql-icingaweb-db': require => Service['mysqld'] } -exec { 'create-pgsql-icingaweb-db': - unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icingaweb\'" | grep -q 1', - command => 'sudo -u postgres psql -c "CREATE ROLE icingaweb WITH LOGIN PASSWORD \'icinga\';" && \ - sudo -u postgres createdb -O icingaweb -E UTF8 -T template0 icingaweb && \ - sudo -u postgres createlang plpgsql icingaweb', - require => Service['postgresql'] +pgsql::database::create { 'icingaweb': + username => 'icingaweb', + password => 'icinga', } exec { 'populate-icingaweb-mysql-db-accounts': From 538088d177c8dc4df3a229b34d00c3c4b869828a Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 5 Aug 2014 15:37:49 +0200 Subject: [PATCH 010/238] The name of pgsql::database::create MUST NOT be create-pgsql-*-db --- .vagrant-puppet/modules/pgsql/manifests/database.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/pgsql/manifests/database.pp b/.vagrant-puppet/modules/pgsql/manifests/database.pp index 9d182e6d2..01528e6d7 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database.pp @@ -13,7 +13,7 @@ sudo -u postgres createlang plpgsql ${name}", define pgsql::database::populate ($username, $password, $schemafile, $requirement) { include pgsql - pgsql::database::create { "create-pgsql-${name}-db": + pgsql::database::create { $name: username => $username, password => $password, } From 920a784beb256978af1802b430719e1a13abe617 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 5 Aug 2014 15:43:23 +0200 Subject: [PATCH 011/238] Split mysql::database into mysql::database::create and mysql::database::populate refs #6842 --- .vagrant-puppet/manifests/default.pp | 4 ++-- .vagrant-puppet/modules/mysql/manifests/database.pp | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index ea9ee22cb..a79169a7c 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -12,14 +12,14 @@ $livestatusVersion = '1.2.4p5' $phantomjsVersion = '1.9.1' $casperjsVersion = '1.0.2' -mysql::database { 'icinga': +mysql::database::populate { 'icinga': username => 'icinga', password => 'icinga', schemafile => "/usr/local/src/icinga-mysql/icinga-${icingaVersion}/module/idoutils/db/mysql/mysql.sql", requirement => Cmmi['icinga-mysql'], } -mysql::database { 'icinga2': +mysql::database::populate { 'icinga2': username => 'icinga2', password => 'icinga2', schemafile => "/usr/share/doc/icinga2-ido-mysql-${icinga2Version}/schema/mysql.sql", diff --git a/.vagrant-puppet/modules/mysql/manifests/database.pp b/.vagrant-puppet/modules/mysql/manifests/database.pp index e0f990c1b..6fb352a14 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database.pp @@ -1,4 +1,4 @@ -define mysql::database ($username, $password, $schemafile, $requirement) { +define mysql::database::create ($username, $password) { include mysql exec { "create-mysql-${name}-db": @@ -8,6 +8,15 @@ GRANT SELECT,INSERT,UPDATE,DELETE ON ${name}.* TO ${username}@localhost \ IDENTIFIED BY '${password}';\"", require => Service['mysqld'] } +} + +define mysql::database::populate ($username, $password, $schemafile, $requirement) { + include mysql + + mysql::database::create { $name: + username => $username, + password => $password, + } exec { "populate-${name}-mysql-db": unless => "mysql -u${username} -p${password} ${name} -e \"SELECT * FROM icinga_dbversion;\" &> /dev/null", From 2e1afd719487436ea1937219ab5c83098cbeec79 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 5 Aug 2014 16:12:47 +0200 Subject: [PATCH 012/238] Make privileges customizable in mysql::database::create (and mysql::database::populate) refs #6842 --- .vagrant-puppet/manifests/default.pp | 2 ++ .vagrant-puppet/modules/mysql/manifests/database.pp | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index a79169a7c..789c81860 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -15,6 +15,7 @@ $casperjsVersion = '1.0.2' mysql::database::populate { 'icinga': username => 'icinga', password => 'icinga', + privileges => 'SELECT,INSERT,UPDATE,DELETE', schemafile => "/usr/local/src/icinga-mysql/icinga-${icingaVersion}/module/idoutils/db/mysql/mysql.sql", requirement => Cmmi['icinga-mysql'], } @@ -22,6 +23,7 @@ mysql::database::populate { 'icinga': mysql::database::populate { 'icinga2': username => 'icinga2', password => 'icinga2', + privileges => 'SELECT,INSERT,UPDATE,DELETE', schemafile => "/usr/share/doc/icinga2-ido-mysql-${icinga2Version}/schema/mysql.sql", requirement => Package['icinga2-ido-mysql'], } diff --git a/.vagrant-puppet/modules/mysql/manifests/database.pp b/.vagrant-puppet/modules/mysql/manifests/database.pp index 6fb352a14..bc9bee6a8 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database.pp @@ -1,21 +1,22 @@ -define mysql::database::create ($username, $password) { +define mysql::database::create ($username, $password, $privileges) { include mysql exec { "create-mysql-${name}-db": unless => "mysql -u${username} -p${password} ${name}", command => "mysql -uroot -e \"CREATE DATABASE ${name}; \ -GRANT SELECT,INSERT,UPDATE,DELETE ON ${name}.* TO ${username}@localhost \ +GRANT ${privileges} ON ${name}.* TO ${username}@localhost \ IDENTIFIED BY '${password}';\"", require => Service['mysqld'] } } -define mysql::database::populate ($username, $password, $schemafile, $requirement) { +define mysql::database::populate ($username, $password, $privileges, $schemafile, $requirement) { include mysql mysql::database::create { $name: username => $username, password => $password, + privileges => $privileges, } exec { "populate-${name}-mysql-db": From 73a29abac377ea6790ae173e62d1f62744a682f3 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 5 Aug 2014 16:16:05 +0200 Subject: [PATCH 013/238] Outsource 'icinga_unittest' database creation into mysql::database::create refs #6842 --- .vagrant-puppet/manifests/default.pp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 789c81860..b57b98b3d 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -483,12 +483,10 @@ user { 'vagrant': require => Group['icinga-cmd'] } -exec { 'create-mysql-icinga_unittest-db': - unless => 'mysql -uicinga_unittest -picinga_unittest icinga_unittest', - command => 'mysql -uroot -e "CREATE DATABASE icinga_unittest; \ - GRANT ALL ON icinga_unittest.* TO icinga_unittest@localhost \ - IDENTIFIED BY \'icinga_unittest\';"', - require => Service['mysqld'] +mysql::database::create { 'icinga_unittest': + username => 'icinga_unittest', + password => 'icinga_unittest', + privileges => 'ALL', } pgsql::database::create { 'icinga_unittest': From a110b250710ae468da5769705cf46abc16620e7f Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 5 Aug 2014 16:29:02 +0200 Subject: [PATCH 014/238] Outsource 'icingaweb' database creation into mysql::database::create refs #6842 --- .vagrant-puppet/manifests/default.pp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index b57b98b3d..da2a29884 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -573,12 +573,10 @@ populate_monitoring_test_config_plugins{ ['test_hostcheck.pl', 'test_servicechec # # Following section creates and populates MySQL and PostgreSQL Icinga Web 2 databases # -exec { 'create-mysql-icingaweb-db': - unless => 'mysql -uicingaweb -picingaweb icingaweb', - command => 'mysql -uroot -e "CREATE DATABASE icingaweb; \ - GRANT ALL ON icingaweb.* TO icingaweb@localhost \ - IDENTIFIED BY \'icingaweb\';"', - require => Service['mysqld'] +mysql::database::create { 'icingaweb': + username => 'icingaweb', + password => 'icingaweb', + privileges => 'ALL', } pgsql::database::create { 'icingaweb': From 05afbeebe051e9d5d6e61a24860cb04a22379c7e Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 5 Aug 2014 16:29:44 +0200 Subject: [PATCH 015/238] Outsource 'icing_web' database creation into mysql::database::create refs #6842 --- .vagrant-puppet/manifests/default.pp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index da2a29884..7837ed417 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -639,12 +639,10 @@ service { 'icinga_command_proxy': require => [ File['/etc/init.d/icinga_command_proxy'], Service['icinga-mysql'], Service['icinga-pgsql'] ] } -exec { 'create-mysql-icinga_web-db': - unless => 'mysql -uicinga_web -picinga_web icinga_web', - command => 'mysql -uroot -e "CREATE DATABASE icinga_web; \ - GRANT ALL ON icinga_web.* TO icinga_web@localhost \ - IDENTIFIED BY \'icinga_web\';"', - require => Service['mysqld'] +mysql::database::create { 'icinga_web': + username => 'icinga_web', + password => 'icinga_web', + privileges => 'ALL', } cmmi { 'icinga-web': From 392e725d8ade753fd87809086c41b391d8145a6f Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 6 Aug 2014 13:27:16 +0200 Subject: [PATCH 016/238] Outsource specific parts into profiles icinga-mysql, icinga-pgsql, icinga2, icingaweb2 and nodejs refs #6842 --- .vagrant-puppet/manifests/default.pp | 399 +----------------- .../modules/profile/manifests/icinga-mysql.pp | 68 +++ .../modules/profile/manifests/icinga-pgsql.pp | 68 +++ .../modules/profile/manifests/icinga2.pp | 114 +++++ .../modules/profile/manifests/icingaweb2.pp | 111 +++++ .../modules/profile/manifests/nodejs.pp | 43 ++ 6 files changed, 413 insertions(+), 390 deletions(-) create mode 100644 .vagrant-puppet/modules/profile/manifests/icinga-mysql.pp create mode 100644 .vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp create mode 100644 .vagrant-puppet/modules/profile/manifests/icinga2.pp create mode 100644 .vagrant-puppet/modules/profile/manifests/icingaweb2.pp create mode 100644 .vagrant-puppet/modules/profile/manifests/nodejs.pp diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 7837ed417..04ac73a89 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -3,6 +3,9 @@ include mysql include pgsql include openldap +include profile::icingaweb2 +include profile::nodejs + Exec { path => '/bin:/usr/bin:/sbin' } $icingaVersion = '1.11.5' @@ -12,27 +15,14 @@ $livestatusVersion = '1.2.4p5' $phantomjsVersion = '1.9.1' $casperjsVersion = '1.0.2' -mysql::database::populate { 'icinga': - username => 'icinga', - password => 'icinga', - privileges => 'SELECT,INSERT,UPDATE,DELETE', - schemafile => "/usr/local/src/icinga-mysql/icinga-${icingaVersion}/module/idoutils/db/mysql/mysql.sql", - requirement => Cmmi['icinga-mysql'], +class { 'profile::icinga2': + icinga2Version => $icinga2Version, } -mysql::database::populate { 'icinga2': - username => 'icinga2', - password => 'icinga2', - privileges => 'SELECT,INSERT,UPDATE,DELETE', - schemafile => "/usr/share/doc/icinga2-ido-mysql-${icinga2Version}/schema/mysql.sql", - requirement => Package['icinga2-ido-mysql'], -} - -pgsql::database::populate { 'icinga': - username => 'icinga', - password => 'icingaweb', - schemafile => "/usr/local/src/icinga-pgsql/icinga-${icingaVersion}/module/idoutils/db/pgsql/pgsql.sql", - requirement => Cmmi['icinga-pgsql'], +class { [ + 'profile::icinga-mysql', + 'profile::icinga-pgsql' ]: + icingaVersion => $icingaVersion, } package { [ @@ -69,125 +59,6 @@ user { 'apache': require => [ Class['apache'], Group['icinga-cmd'], Group['icingacmd'] ] } -cmmi { 'icinga-mysql': - url => "https://github.com/Icinga/icinga-core/releases/download/v${icingaVersion}/icinga-${icingaVersion}.tar.gz", - output => "icinga-${icingaVersion}.tar.gz", - flags => '--prefix=/usr/local/icinga-mysql --with-command-group=icinga-cmd \ - --enable-idoutils --with-init-dir=/usr/local/icinga-mysql/etc/init.d \ - --with-htmurl=/icinga-mysql --with-httpd-conf-file=/etc/httpd/conf.d/icinga-mysql.conf \ - --with-cgiurl=/icinga-mysql/cgi-bin \ - --with-http-auth-file=/usr/share/icinga/htpasswd.users \ - --with-plugin-dir=/usr/lib64/nagios/plugins/libexec', - creates => '/usr/local/icinga-mysql', - make => 'make all && make fullinstall install-config', - require => [ User['icinga'], Cmmi['icinga-plugins'], Package['apache'] ], - notify => Service['apache'] -} - -file { '/etc/init.d/icinga-mysql': - source => '/usr/local/icinga-mysql/etc/init.d/icinga', - require => Cmmi['icinga-mysql'] -} - -file { '/etc/init.d/ido2db-mysql': - source => '/usr/local/icinga-mysql/etc/init.d/ido2db', - require => Cmmi['icinga-mysql'] -} - -cmmi { 'icinga-pgsql': - url => "https://github.com/Icinga/icinga-core/releases/download/v${icingaVersion}/icinga-${icingaVersion}.tar.gz", - output => "icinga-${icingaVersion}.tar.gz", - flags => '--prefix=/usr/local/icinga-pgsql \ - --with-command-group=icinga-cmd --enable-idoutils \ - --with-init-dir=/usr/local/icinga-pgsql/etc/init.d \ - --with-htmurl=/icinga-pgsql --with-httpd-conf-file=/etc/httpd/conf.d/icinga-pgsql.conf \ - --with-cgiurl=/icinga-pgsql/cgi-bin \ - --with-http-auth-file=/usr/share/icinga/htpasswd.users \ - --with-plugin-dir=/usr/lib64/nagios/plugins/libexec', - creates => '/usr/local/icinga-pgsql', - make => 'make all && make fullinstall install-config', - require => [ User['icinga'], Cmmi['icinga-plugins'], Package['apache'] ], - notify => Service['apache'] -} - -file { '/etc/init.d/icinga-pgsql': - source => '/usr/local/icinga-pgsql/etc/init.d/icinga', - require => Cmmi['icinga-pgsql'] -} - -file { '/etc/init.d/ido2db-pgsql': - source => '/usr/local/icinga-pgsql/etc/init.d/ido2db', - require => Cmmi['icinga-pgsql'] -} - -service { 'icinga-mysql': - ensure => running, - require => File['/etc/init.d/icinga-mysql'] -} - -service { 'ido2db-mysql': - ensure => running, - require => File['/etc/init.d/ido2db-mysql'] -} - -file { '/usr/local/icinga-mysql/etc/ido2db.cfg': - content => template('icinga/ido2db-mysql.cfg.erb'), - owner => 'icinga', - group => 'icinga', - require => Cmmi['icinga-mysql'], - notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] -} - -file { '/usr/local/icinga-mysql/etc/idomod.cfg': - source => '/usr/local/icinga-mysql/etc/idomod.cfg-sample', - owner => 'icinga', - group => 'icinga', - require => Cmmi['icinga-mysql'], - notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] -} - -file { '/usr/local/icinga-mysql/etc/modules/idoutils.cfg': - source => '/usr/local/icinga-mysql/etc/modules/idoutils.cfg-sample', - owner => 'icinga', - group => 'icinga', - require => Cmmi['icinga-mysql'], - notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] -} - -service { 'icinga-pgsql': - ensure => running, - require => Cmmi['icinga-pgsql'] -} - -service { 'ido2db-pgsql': - ensure => running, - require => Cmmi['icinga-pgsql'] -} - -file { '/usr/local/icinga-pgsql/etc/ido2db.cfg': - content => template('icinga/ido2db-pgsql.cfg.erb'), - owner => 'icinga', - group => 'icinga', - require => Cmmi['icinga-pgsql'], - notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ] -} - -file { '/usr/local/icinga-pgsql/etc/idomod.cfg': - source => '/usr/local/icinga-pgsql/etc/idomod.cfg-sample', - owner => 'icinga', - group => 'icinga', - require => Cmmi['icinga-pgsql'], - notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ] -} - -file { '/usr/local/icinga-pgsql/etc/modules/idoutils.cfg': - source => '/usr/local/icinga-pgsql/etc/modules/idoutils.cfg-sample', - owner => 'icinga', - group => 'icinga', - require => Cmmi['icinga-pgsql'], - notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ] -} - exec { 'iptables-allow-http': unless => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables', command => 'iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && iptables-save > /etc/sysconfig/iptables' @@ -284,48 +155,6 @@ exec { 'install PHP CodeSniffer': require => Class['epel'] } -exec { 'install nodejs': - command => 'yum -d 0 -e 0 -y --enablerepo=epel install npm', - unless => 'rpm -qa | grep ^npm', - require => Class['epel'] -} - -exec { 'install npm/mocha': - command => 'npm install -g mocha', - creates => '/usr/lib/node_modules/mocha', - require => Exec['install nodejs'] -} - -exec { 'install npm/mocha-cobertura-reporter': - command => 'npm install -g mocha-cobertura-reporter', - creates => '/usr/lib/node_modules/mocha-cobertura-reporter', - require => Exec['install npm/mocha'] -} - -exec { 'install npm/jshint': - command => 'npm install -g jshint', - creates => '/usr/lib/node_modules/jshint', - require => Exec['install nodejs'] -} - -exec { 'install npm/expect': - command => 'npm install -g expect', - creates => '/usr/lib/node_modules/expect', - require => Exec['install nodejs'] -} - -exec { 'install npm/should': - command => 'npm install -g should', - creates => '/usr/lib/node_modules/should', - require => Exec['install nodejs'] -} - -exec { 'install npm/URIjs': - command => 'npm install -g URIjs', - creates => '/usr/lib/node_modules/URIjs', - require => Exec['install nodejs'] -} - exec { 'install php-ZendFramework': command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework', unless => 'rpm -qa | grep php-ZendFramework', @@ -337,16 +166,6 @@ package { ['cmake', 'boost-devel', 'bison', 'flex']: } # icinga 2 -define icinga2::feature ($feature = $title) { - exec { "icinga2-feature-${feature}": - path => '/bin:/usr/bin:/sbin:/usr/sbin', - unless => "readlink /etc/icinga2/features-enabled/${feature}.conf", - command => "icinga2-enable-feature ${feature}", - require => [ Package['icinga2'] ], - notify => Service['icinga2'] - } -} - yumrepo { 'icinga2-repo': baseurl => "http://packages.icinga.org/epel/6/snapshot/", enabled => '1', @@ -361,110 +180,18 @@ exec { 'install nagios-plugins-all': require => [ Class['epel'], Package['icinga2'] ], } -package { 'icinga2': - ensure => latest, - require => Yumrepo['icinga2-repo'], - alias => 'icinga2' -} - -package { 'icinga2-bin': - ensure => latest, - require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ], - alias => 'icinga2-bin' -} - -package { 'icinga2-doc': - ensure => latest, - require => Yumrepo['icinga2-repo'], - alias => 'icinga2-doc' -} - # icinga 2 classic ui -package { 'icinga2-classicui-config': - ensure => latest, - before => Package["icinga-gui"], - require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ], - notify => Service['apache'] -} - package { 'icinga-gui': ensure => latest, require => Yumrepo['icinga2-repo'], alias => 'icinga-gui' } -icinga2::feature { 'statusdata': - require => Package['icinga2-classicui-config'] -} - -icinga2::feature { 'command': - require => Package['icinga2-classicui-config'] -} - -icinga2::feature { 'compatlog': - require => Package['icinga2-classicui-config'] -} - # icinga 2 ido mysql -package { 'icinga2-ido-mysql': - ensure => latest, - require => Yumrepo['icinga2-repo'], - alias => 'icinga2-ido-mysql' -} - - -file { '/etc/icinga2/features-available/ido-mysql.conf': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf', - owner => 'icinga', - group => 'icinga', - require => Package['icinga2'], - notify => Service['icinga2'] -} - -file { '/etc/icinga2/features-enabled/ido-mysql.conf': - ensure => 'link', - target => '/etc/icinga2/features-available/ido-mysql.conf', - owner => 'root', - group => 'root', - require => Package['icinga2-ido-mysql'] -} - -icinga2::feature { 'ido-mysql': - require => Exec['populate-icinga2-mysql-db'] -} # icinga 2 test config -file { '/etc/icinga2/conf.d/test-config.conf': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf', - owner => 'icinga', - group => 'icinga', - require => [ Package['icinga2'], Exec['create_monitoring_test_config'] ] -} -file { '/etc/icinga2/conf.d/commands.conf': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/commands.conf', - owner => 'icinga', - group => 'icinga', - require => Package['icinga2'] -} - -file { '/etc/icinga2/constants.conf': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/constants.conf', - owner => 'icinga', - group => 'icinga', - require => Package['icinga2'] -} - -service { 'icinga2': - ensure => running, - require => [ - Package['icinga2'], - File['/etc/icinga2/features-enabled/ido-mysql.conf'], - File['/etc/icinga2/conf.d/test-config.conf'], - File['/etc/icinga2/conf.d/commands.conf'] - ] -} exec { 'install php-ZendFramework-Db-Adapter-Pdo-Mysql': command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework-Db-Adapter-Pdo-Mysql', @@ -573,40 +300,7 @@ populate_monitoring_test_config_plugins{ ['test_hostcheck.pl', 'test_servicechec # # Following section creates and populates MySQL and PostgreSQL Icinga Web 2 databases # -mysql::database::create { 'icingaweb': - username => 'icingaweb', - password => 'icingaweb', - privileges => 'ALL', -} -pgsql::database::create { 'icingaweb': - username => 'icingaweb', - password => 'icinga', -} - -exec { 'populate-icingaweb-mysql-db-accounts': - unless => 'mysql -uicingaweb -picingaweb icingaweb -e "SELECT * FROM account;" &> /dev/null', - command => 'mysql -uicingaweb -picingaweb icingaweb < /vagrant/etc/schema/accounts.mysql.sql', - require => [ Exec['create-mysql-icingaweb-db'] ] -} - -exec { 'populate-icingweba-pgsql-db-accounts': - unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM account;" &> /dev/null', - command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/accounts.pgsql.sql', - require => [ Exec['create-pgsql-icingaweb-db'] ] -} - -exec { 'populate-icingaweb-mysql-db-preferences': - unless => 'mysql -uicingaweb -picingaweb icingaweb -e "SELECT * FROM preference;" &> /dev/null', - command => 'mysql -uicingaweb -picingaweb icingaweb < /vagrant/etc/schema/preferences.mysql.sql', - require => [ Exec['create-mysql-icingaweb-db'] ] -} - -exec { 'populate-icingweba-pgsql-db-preferences': - unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM preference;" &> /dev/null', - command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/preferences.pgsql.sql', - require => [ Exec['create-pgsql-icingaweb-db'] ] -} # # Following section creates the Icinga command proxy to /usr/local/icinga-mysql/var/rw/icinga.cmd (which is the @@ -665,81 +359,6 @@ file { '/var/www/html/icingaweb': ensure => absent, } -file { '/etc/httpd/conf.d/icingaweb.conf': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf', - require => Package['apache'], - notify => Service['apache'] -} - -file { '/etc/icingaweb': - ensure => 'directory', - owner => 'apache', - group => 'apache' -} - -file { '/etc/icingaweb/authentication.ini': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/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/.vagrant-puppet/files/etc/icingaweb/menu.ini', - owner => 'apache', - group => 'apache', - # replace => false, -} - -file { '/etc/icingaweb/resources.ini': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/resources.ini', - owner => 'apache', - group => 'apache', - replace => false -} - -file { ['/etc/icingaweb/enabledModules', '/etc/icingaweb/modules', '/etc/icingaweb/modules/monitoring']: - 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', -} - -file { '/etc/icingaweb/modules/monitoring/instances.ini': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/instances.ini', - owner => 'apache', - group => 'apache', -} - -file { '/etc/icingaweb/modules/monitoring/menu.ini': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/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/.vagrant-puppet/files/etc/icingaweb/dashboard/dashboard.ini', - owner => 'apache', - group => 'apache', -} - # pear::package { 'deepend/Mockery': # channel => 'pear.survivethedeepend.com' # } diff --git a/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp b/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp new file mode 100644 index 000000000..2febff764 --- /dev/null +++ b/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp @@ -0,0 +1,68 @@ +class profile::icinga-mysql ($icingaVersion) { + cmmi { 'icinga-mysql': + url => "https://github.com/Icinga/icinga-core/releases/download/v${icingaVersion}/icinga-${icingaVersion}.tar.gz", + output => "icinga-${icingaVersion}.tar.gz", + flags => '--prefix=/usr/local/icinga-mysql --with-command-group=icinga-cmd \ + --enable-idoutils --with-init-dir=/usr/local/icinga-mysql/etc/init.d \ + --with-htmurl=/icinga-mysql --with-httpd-conf-file=/etc/httpd/conf.d/icinga-mysql.conf \ + --with-cgiurl=/icinga-mysql/cgi-bin \ + --with-http-auth-file=/usr/share/icinga/htpasswd.users \ + --with-plugin-dir=/usr/lib64/nagios/plugins/libexec', + creates => '/usr/local/icinga-mysql', + make => 'make all && make fullinstall install-config', + require => [ User['icinga'], Cmmi['icinga-plugins'], Package['apache'] ], + notify => Service['apache'], + } + + file { '/etc/init.d/icinga-mysql': + source => '/usr/local/icinga-mysql/etc/init.d/icinga', + require => Cmmi['icinga-mysql'], + } + + file { '/etc/init.d/ido2db-mysql': + source => '/usr/local/icinga-mysql/etc/init.d/ido2db', + require => Cmmi['icinga-mysql'], + } + + service { 'icinga-mysql': + ensure => running, + require => File['/etc/init.d/icinga-mysql'], + } + + service { 'ido2db-mysql': + ensure => running, + require => File['/etc/init.d/ido2db-mysql'], + } + + file { '/usr/local/icinga-mysql/etc/ido2db.cfg': + content => template('icinga/ido2db-mysql.cfg.erb'), + owner => 'icinga', + group => 'icinga', + require => Cmmi['icinga-mysql'], + notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] + } + + file { '/usr/local/icinga-mysql/etc/idomod.cfg': + source => '/usr/local/icinga-mysql/etc/idomod.cfg-sample', + owner => 'icinga', + group => 'icinga', + require => Cmmi['icinga-mysql'], + notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] + } + + file { '/usr/local/icinga-mysql/etc/modules/idoutils.cfg': + source => '/usr/local/icinga-mysql/etc/modules/idoutils.cfg-sample', + owner => 'icinga', + group => 'icinga', + require => Cmmi['icinga-mysql'], + notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] + } + + mysql::database::populate { 'icinga': + username => 'icinga', + password => 'icinga', + privileges => 'SELECT,INSERT,UPDATE,DELETE', + schemafile => "/usr/local/src/icinga-mysql/icinga-${icingaVersion}/module/idoutils/db/mysql/mysql.sql", + requirement => Cmmi['icinga-mysql'], + } +} diff --git a/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp b/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp new file mode 100644 index 000000000..a76ca6890 --- /dev/null +++ b/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp @@ -0,0 +1,68 @@ +class profile::icinga-pgsql ($icingaVersion) { + cmmi { 'icinga-pgsql': + url => "https://github.com/Icinga/icinga-core/releases/download/v${icingaVersion}/icinga-${icingaVersion}.tar.gz", + output => "icinga-${icingaVersion}.tar.gz", + flags => '--prefix=/usr/local/icinga-pgsql \ + --with-command-group=icinga-cmd --enable-idoutils \ + --with-init-dir=/usr/local/icinga-pgsql/etc/init.d \ + --with-htmurl=/icinga-pgsql --with-httpd-conf-file=/etc/httpd/conf.d/icinga-pgsql.conf \ + --with-cgiurl=/icinga-pgsql/cgi-bin \ + --with-http-auth-file=/usr/share/icinga/htpasswd.users \ + --with-plugin-dir=/usr/lib64/nagios/plugins/libexec', + creates => '/usr/local/icinga-pgsql', + make => 'make all && make fullinstall install-config', + require => [ User['icinga'], Cmmi['icinga-plugins'], Package['apache'] ], + notify => Service['apache'], + } + + file { '/etc/init.d/icinga-pgsql': + source => '/usr/local/icinga-pgsql/etc/init.d/icinga', + require => Cmmi['icinga-pgsql'], + } + + file { '/etc/init.d/ido2db-pgsql': + source => '/usr/local/icinga-pgsql/etc/init.d/ido2db', + require => Cmmi['icinga-pgsql'], + } + + service { 'icinga-pgsql': + ensure => running, + require => Cmmi['icinga-pgsql'], + } + + service { 'ido2db-pgsql': + ensure => running, + require => Cmmi['icinga-pgsql'], + } + + file { '/usr/local/icinga-pgsql/etc/ido2db.cfg': + content => template('icinga/ido2db-pgsql.cfg.erb'), + owner => 'icinga', + group => 'icinga', + require => Cmmi['icinga-pgsql'], + notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ] + } + + file { '/usr/local/icinga-pgsql/etc/idomod.cfg': + source => '/usr/local/icinga-pgsql/etc/idomod.cfg-sample', + owner => 'icinga', + group => 'icinga', + require => Cmmi['icinga-pgsql'], + notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ] + } + + file { '/usr/local/icinga-pgsql/etc/modules/idoutils.cfg': + source => '/usr/local/icinga-pgsql/etc/modules/idoutils.cfg-sample', + owner => 'icinga', + group => 'icinga', + require => Cmmi['icinga-pgsql'], + notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ] + } + + pgsql::database::populate { 'icinga': + username => 'icinga', + password => 'icingaweb', + schemafile => "/usr/local/src/icinga-pgsql/icinga-${icingaVersion}/module/idoutils/db/pgsql/pgsql.sql", + requirement => Cmmi['icinga-pgsql'], + } +} diff --git a/.vagrant-puppet/modules/profile/manifests/icinga2.pp b/.vagrant-puppet/modules/profile/manifests/icinga2.pp new file mode 100644 index 000000000..28790e7cf --- /dev/null +++ b/.vagrant-puppet/modules/profile/manifests/icinga2.pp @@ -0,0 +1,114 @@ +class profile::icinga2 ($icinga2Version) { + mysql::database::populate { 'icinga2': + username => 'icinga2', + password => 'icinga2', + privileges => 'SELECT,INSERT,UPDATE,DELETE', + schemafile => "/usr/share/doc/icinga2-ido-mysql-${icinga2Version}/schema/mysql.sql", + requirement => Package['icinga2-ido-mysql'], + } + + define icinga2::feature ($feature = $title) { + exec { "icinga2-feature-${feature}": + path => '/bin:/usr/bin:/sbin:/usr/sbin', + unless => "readlink /etc/icinga2/features-enabled/${feature}.conf", + command => "icinga2-enable-feature ${feature}", + require => [ Package['icinga2'] ], + notify => Service['icinga2'] + } + } + + icinga2::feature { 'statusdata': + require => Package['icinga2-classicui-config'], + } + + icinga2::feature { 'command': + require => Package['icinga2-classicui-config'], + } + + icinga2::feature { 'compatlog': + require => Package['icinga2-classicui-config'], + } + + icinga2::feature { 'ido-mysql': + require => Exec['populate-icinga2-mysql-db'], + } + + service { 'icinga2': + ensure => running, + require => [ + Package['icinga2'], + File['/etc/icinga2/features-enabled/ido-mysql.conf'], + File['/etc/icinga2/conf.d/test-config.conf'], + File['/etc/icinga2/conf.d/commands.conf'] + ] + } + + package { 'icinga2': + ensure => latest, + require => Yumrepo['icinga2-repo'], + alias => 'icinga2' + } + + package { 'icinga2-bin': + ensure => latest, + require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ], + alias => 'icinga2-bin' + } + + package { 'icinga2-doc': + ensure => latest, + require => Yumrepo['icinga2-repo'], + alias => 'icinga2-doc' + } + + package { 'icinga2-classicui-config': + ensure => latest, + before => Package["icinga-gui"], + require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ], + notify => Service['apache'], + } + + package { 'icinga2-ido-mysql': + ensure => latest, + require => Yumrepo['icinga2-repo'], + alias => 'icinga2-ido-mysql' + } + + + file { '/etc/icinga2/features-available/ido-mysql.conf': + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf', + owner => 'icinga', + group => 'icinga', + require => Package['icinga2'], + notify => Service['icinga2'], + } + + file { '/etc/icinga2/features-enabled/ido-mysql.conf': + ensure => 'link', + target => '/etc/icinga2/features-available/ido-mysql.conf', + owner => 'root', + group => 'root', + require => Package['icinga2-ido-mysql'], + } + + file { '/etc/icinga2/conf.d/test-config.conf': + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf', + owner => 'icinga', + group => 'icinga', + require => [ Package['icinga2'], Exec['create_monitoring_test_config'] ] + } + + file { '/etc/icinga2/conf.d/commands.conf': + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/commands.conf', + owner => 'icinga', + group => 'icinga', + require => Package['icinga2'], + } + + file { '/etc/icinga2/constants.conf': + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/constants.conf', + owner => 'icinga', + group => 'icinga', + require => Package['icinga2'], + } +} diff --git a/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp b/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp new file mode 100644 index 000000000..5d58bac00 --- /dev/null +++ b/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp @@ -0,0 +1,111 @@ +class profile::icingaweb2 { + mysql::database::create { 'icingaweb': + username => 'icingaweb', + password => 'icingaweb', + privileges => 'ALL', + } + + pgsql::database::create { 'icingaweb': + username => 'icingaweb', + password => 'icinga', + } + + exec { 'populate-icingaweb-mysql-db-accounts': + unless => 'mysql -uicingaweb -picingaweb icingaweb -e "SELECT * FROM account;" &> /dev/null', + command => 'mysql -uicingaweb -picingaweb icingaweb < /vagrant/etc/schema/accounts.mysql.sql', + require => [ Exec['create-mysql-icingaweb-db'] ] + } + + exec { 'populate-icingweba-pgsql-db-accounts': + unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM account;" &> /dev/null', + command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/accounts.pgsql.sql', + require => [ Exec['create-pgsql-icingaweb-db'] ] + } + + exec { 'populate-icingaweb-mysql-db-preferences': + unless => 'mysql -uicingaweb -picingaweb icingaweb -e "SELECT * FROM preference;" &> /dev/null', + command => 'mysql -uicingaweb -picingaweb icingaweb < /vagrant/etc/schema/preferences.mysql.sql', + require => [ Exec['create-mysql-icingaweb-db'] ] + } + + exec { 'populate-icingweba-pgsql-db-preferences': + unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM preference;" &> /dev/null', + command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/preferences.pgsql.sql', + require => [ Exec['create-pgsql-icingaweb-db'] ] + } + + file { '/etc/httpd/conf.d/icingaweb.conf': + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf', + require => Package['apache'], + notify => Service['apache'], + } + + file { '/etc/icingaweb': + ensure => 'directory', + owner => 'apache', + group => 'apache' + } + + file { '/etc/icingaweb/authentication.ini': + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/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/.vagrant-puppet/files/etc/icingaweb/menu.ini', + owner => 'apache', + group => 'apache', + # replace => false, + } + + file { '/etc/icingaweb/resources.ini': + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/resources.ini', + owner => 'apache', + group => 'apache', + replace => false + } + + file { ['/etc/icingaweb/enabledModules', '/etc/icingaweb/modules', '/etc/icingaweb/modules/monitoring']: + 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', + } + + file { '/etc/icingaweb/modules/monitoring/instances.ini': + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/instances.ini', + owner => 'apache', + group => 'apache', + } + + file { '/etc/icingaweb/modules/monitoring/menu.ini': + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/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/.vagrant-puppet/files/etc/icingaweb/dashboard/dashboard.ini', + owner => 'apache', + group => 'apache', + } +} diff --git a/.vagrant-puppet/modules/profile/manifests/nodejs.pp b/.vagrant-puppet/modules/profile/manifests/nodejs.pp new file mode 100644 index 000000000..d6c7634c1 --- /dev/null +++ b/.vagrant-puppet/modules/profile/manifests/nodejs.pp @@ -0,0 +1,43 @@ +class profile::nodejs { + exec { 'install nodejs': + command => 'yum -d 0 -e 0 -y --enablerepo=epel install npm', + unless => 'rpm -qa | grep ^npm', + require => Class['epel'], + } + + exec { 'install npm/mocha': + command => 'npm install -g mocha', + creates => '/usr/lib/node_modules/mocha', + require => Exec['install nodejs'], + } + + exec { 'install npm/mocha-cobertura-reporter': + command => 'npm install -g mocha-cobertura-reporter', + creates => '/usr/lib/node_modules/mocha-cobertura-reporter', + require => Exec['install npm/mocha'], + } + + exec { 'install npm/jshint': + command => 'npm install -g jshint', + creates => '/usr/lib/node_modules/jshint', + require => Exec['install nodejs'], + } + + exec { 'install npm/expect': + command => 'npm install -g expect', + creates => '/usr/lib/node_modules/expect', + require => Exec['install nodejs'], + } + + exec { 'install npm/should': + command => 'npm install -g should', + creates => '/usr/lib/node_modules/should', + require => Exec['install nodejs'], + } + + exec { 'install npm/URIjs': + command => 'npm install -g URIjs', + creates => '/usr/lib/node_modules/URIjs', + require => Exec['install nodejs'], + } +} From 26205a76b3c9a937a62f4c221b03c2d4309d4c90 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 6 Aug 2014 14:24:36 +0200 Subject: [PATCH 017/238] Put always a ',' after a parameter because explicit is better than implicit refs #6842 --- .vagrant-puppet/manifests/default.pp | 90 +++++++++---------- .../modules/apache/manifests/init.pp | 6 +- .../modules/casperjs/manifests/init.pp | 10 +-- .../modules/cmmi/manifests/init.pp | 12 +-- .../modules/configure/manifests/init.pp | 4 +- .../modules/cpan/manifests/init.pp | 8 +- .../modules/epel/manifests/init.pp | 2 +- .../modules/mysql/manifests/database.pp | 4 +- .../modules/mysql/manifests/init.pp | 4 +- .../modules/openldap/manifests/init.pp | 6 +- .../modules/pear/manifests/init.pp | 8 +- .../modules/pear/manifests/package.pp | 6 +- .../modules/pgsql/manifests/database.pp | 4 +- .../modules/pgsql/manifests/init.pp | 6 +- .../modules/phantomjs/manifests/init.pp | 10 +-- .../modules/php/manifests/extension.pp | 2 +- .vagrant-puppet/modules/php/manifests/init.pp | 6 +- .../modules/profile/manifests/icinga-mysql.pp | 6 +- .../modules/profile/manifests/icinga-pgsql.pp | 6 +- .../modules/profile/manifests/icinga2.pp | 14 +-- .../modules/profile/manifests/icingaweb2.pp | 12 +-- 21 files changed, 113 insertions(+), 113 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 04ac73a89..74a80ea5e 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -30,44 +30,44 @@ package { [ 'libpng', 'libpng-devel', 'net-snmp', 'net-snmp-devel', 'net-snmp-utils', 'libdbi', 'libdbi-devel', 'libdbi-drivers', 'libdbi-dbd-mysql', 'libdbi-dbd-pgsql' ]: - ensure => installed + ensure => installed, } php::extension { ['php-mysql', 'php-pgsql', 'php-ldap']: - require => [ Class['mysql'], Class['pgsql'], Class['openldap'] ] + require => [ Class['mysql'], Class['pgsql'], Class['openldap'] ], } php::extension { 'php-gd': } group { 'icinga-cmd': - ensure => present + ensure => present, } group { 'icingacmd': ensure => present, - require => Package['icinga2'] + require => Package['icinga2'], } user { 'icinga': ensure => present, groups => 'icinga-cmd', - managehome => false + managehome => false, } user { 'apache': groups => ['icinga-cmd', 'vagrant', 'icingacmd'], - require => [ Class['apache'], Group['icinga-cmd'], Group['icingacmd'] ] + require => [ Class['apache'], Group['icinga-cmd'], Group['icingacmd'] ], } exec { 'iptables-allow-http': unless => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables', - command => 'iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && iptables-save > /etc/sysconfig/iptables' + command => 'iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && iptables-save > /etc/sysconfig/iptables', } exec { 'icinga-htpasswd': creates => '/usr/share/icinga/htpasswd.users', command => 'mkdir -p /usr/share/icinga && htpasswd -b -c /usr/share/icinga/htpasswd.users icingaadmin icinga', - require => Class['apache'] + require => Class['apache'], } cmmi { 'icinga-plugins': @@ -78,7 +78,7 @@ cmmi { 'icinga-plugins': --with-cgiurl=/icinga-mysql/cgi-bin', creates => '/usr/lib64/nagios/plugins/libexec', make => 'make && make install', - require => User['icinga'] + require => User['icinga'], } cmmi { 'mk-livestatus': @@ -87,7 +87,7 @@ cmmi { 'mk-livestatus': flags => '--prefix=/usr/local/icinga-mysql --exec-prefix=/usr/local/icinga-mysql', creates => '/usr/local/icinga-mysql/lib/mk-livestatus', make => 'make && make install', - require => Cmmi['icinga-mysql'] + require => Cmmi['icinga-mysql'], } file { '/usr/local/icinga-mysql/etc/modules/mk-livestatus.cfg': @@ -95,25 +95,25 @@ file { '/usr/local/icinga-mysql/etc/modules/mk-livestatus.cfg': owner => 'icinga', group => 'icinga', require => Cmmi['mk-livestatus'], - notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] + notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ], } file { 'openldap/db.ldif': path => '/usr/share/openldap-servers/db.ldif', source => 'puppet:///modules/openldap/db.ldif', - require => Class['openldap'] + require => Class['openldap'], } file { 'openldap/dit.ldif': path => '/usr/share/openldap-servers/dit.ldif', source => 'puppet:///modules/openldap/dit.ldif', - require => Class['openldap'] + require => Class['openldap'], } file { 'openldap/users.ldif': path => '/usr/share/openldap-servers/users.ldif', source => 'puppet:///modules/openldap/users.ldif', - require => Class['openldap'] + require => Class['openldap'], } exec { 'populate-openldap': @@ -122,23 +122,23 @@ exec { 'populate-openldap': sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/dit.ldif || true && \ sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/users.ldif || true', require => [ Service['slapd'], File['openldap/db.ldif'], - File['openldap/dit.ldif'], File['openldap/users.ldif'] ] + File['openldap/dit.ldif'], File['openldap/users.ldif'] ], } class { 'phantomjs': url => "https://phantomjs.googlecode.com/files/phantomjs-${phantomjsVersion}-linux-x86_64.tar.bz2", output => "phantomjs-${phantomjsVersion}-linux-x86_64.tar.bz2", - creates => '/usr/local/phantomjs' + creates => '/usr/local/phantomjs', } class { 'casperjs': url => "https://github.com/n1k0/casperjs/tarball/${casperjsVersion}", output => "casperjs-${casperjsVersion}.tar.gz", - creates => '/usr/local/casperjs' + creates => '/usr/local/casperjs', } file { '/etc/profile.d/env.sh': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/profile.d/env.sh' + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/profile.d/env.sh', } include epel @@ -146,23 +146,23 @@ include epel exec { 'install PHPUnit': command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-phpunit-PHPUnit', unless => 'rpm -qa | grep php-phpunit-PHPUnit', - require => Class['epel'] + require => Class['epel'], } exec { 'install PHP CodeSniffer': command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-pear-PHP-CodeSniffer', unless => 'rpm -qa | grep php-pear-PHP-CodeSniffer', - require => Class['epel'] + require => Class['epel'], } exec { 'install php-ZendFramework': command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework', unless => 'rpm -qa | grep php-ZendFramework', - require => Class['epel'] + require => Class['epel'], } package { ['cmake', 'boost-devel', 'bison', 'flex']: - ensure => installed + ensure => installed, } # icinga 2 @@ -171,7 +171,7 @@ yumrepo { 'icinga2-repo': enabled => '1', gpgcheck => '1', gpgkey => 'http://packages.icinga.org/icinga.key', - descr => "Icinga Repository - ${::architecture}" + descr => "Icinga Repository - ${::architecture}", } exec { 'install nagios-plugins-all': @@ -184,7 +184,7 @@ exec { 'install nagios-plugins-all': package { 'icinga-gui': ensure => latest, require => Yumrepo['icinga2-repo'], - alias => 'icinga-gui' + alias => 'icinga-gui', } # icinga 2 ido mysql @@ -196,18 +196,18 @@ package { 'icinga-gui': exec { 'install php-ZendFramework-Db-Adapter-Pdo-Mysql': command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework-Db-Adapter-Pdo-Mysql', unless => 'rpm -qa | grep php-ZendFramework-Db-Adapter-Pdo-Mysql', - require => Exec['install php-ZendFramework'] + require => Exec['install php-ZendFramework'], } file { '/etc/motd': source => 'puppet:////vagrant/.vagrant-puppet/files/etc/motd', owner => root, - group => root + group => root, } user { 'vagrant': groups => 'icinga-cmd', - require => Group['icinga-cmd'] + require => Group['icinga-cmd'], } mysql::database::create { 'icinga_unittest': @@ -224,7 +224,7 @@ pgsql::database::create { 'icinga_unittest': exec { 'install php-ZendFramework-Db-Adapter-Pdo-Pgsql': command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework-Db-Adapter-Pdo-Pgsql', unless => 'rpm -qa | grep php-ZendFramework-Db-Adapter-Pdo-Pgsql', - require => Exec['install php-ZendFramework'] + require => Exec['install php-ZendFramework'], } @@ -235,7 +235,7 @@ exec { 'install php-ZendFramework-Db-Adapter-Pdo-Pgsql': # cpan { 'Monitoring::Generator::TestConfig': creates => '/usr/local/share/perl5/Monitoring/Generator/TestConfig.pm', - timeout => 600 + timeout => 600, } exec { 'create_monitoring_test_config': @@ -243,7 +243,7 @@ exec { 'create_monitoring_test_config': sudo /usr/local/bin/create_monitoring_test_config.pl -l icinga \ /usr/local/share/misc/monitoring_test_config', creates => '/usr/local/share/misc/monitoring_test_config', - require => Cpan['Monitoring::Generator::TestConfig'] + require => Cpan['Monitoring::Generator::TestConfig'], } define populate_monitoring_test_config { @@ -251,13 +251,13 @@ define populate_monitoring_test_config { owner => 'icinga', group => 'icinga', source => "/usr/local/share/misc/monitoring_test_config/etc/conf.d/${name}.cfg", - notify => Service['icinga-mysql'] + notify => Service['icinga-mysql'], } file { "/usr/local/icinga-pgsql/etc/conf.d/test_config/${name}.cfg": owner => 'icinga', group => 'icinga', source => "/usr/local/share/misc/monitoring_test_config/etc/conf.d/${name}.cfg", - notify => Service['icinga-pgsql'] + notify => Service['icinga-pgsql'], } } @@ -265,14 +265,14 @@ file { '/usr/local/icinga-mysql/etc/conf.d/test_config/': ensure => directory, owner => icinga, group => icinga, - require => Cmmi['icinga-mysql'] + require => Cmmi['icinga-mysql'], } file { '/usr/local/icinga-pgsql/etc/conf.d/test_config/': ensure => directory, owner => icinga, group => icinga, - require => Cmmi['icinga-pgsql'] + require => Cmmi['icinga-pgsql'], } populate_monitoring_test_config { ['commands', 'contacts', 'dependencies', @@ -287,7 +287,7 @@ define populate_monitoring_test_config_plugins { owner => 'icinga', group => 'icinga', source => "/usr/local/share/misc/monitoring_test_config/plugins/${name}", - notify => [ Service['icinga-mysql'], Service['icinga-pgsql'] ] + notify => [ Service['icinga-mysql'], Service['icinga-pgsql'] ], } } @@ -310,14 +310,14 @@ file { [ '/usr/local/icinga/', '/usr/local/icinga/var/', '/usr/local/icinga/var/ ensure => directory, owner => icinga, group => icinga, - require => User['icinga'] + require => User['icinga'], } file { '/usr/local/bin/icinga_command_proxy': source => 'puppet:////vagrant/.vagrant-puppet/files/usr/local/bin/icinga_command_proxy', owner => root, group => root, - mode => 755 + mode => 755, } file { '/etc/init.d/icinga_command_proxy': @@ -325,12 +325,12 @@ file { '/etc/init.d/icinga_command_proxy': owner => root, group => root, mode => 755, - require => File['/usr/local/bin/icinga_command_proxy'] + require => File['/usr/local/bin/icinga_command_proxy'], } service { 'icinga_command_proxy': ensure => running, - require => [ File['/etc/init.d/icinga_command_proxy'], Service['icinga-mysql'], Service['icinga-pgsql'] ] + require => [ File['/etc/init.d/icinga_command_proxy'], Service['icinga-mysql'], Service['icinga-pgsql'] ], } mysql::database::create { 'icinga_web': @@ -346,13 +346,13 @@ cmmi { 'icinga-web': creates => '/usr/local/icinga-web', make => 'make install && make install-apache-config', require => Service['icinga_command_proxy'], - notify => Service['apache'] + notify => Service['apache'], } exec { 'populate-icinga_web-mysql-db': unless => 'mysql -uicinga_web -picinga_web icinga_web -e "SELECT * FROM nsm_user;" &> /dev/null', command => 'mysql -uicinga_web -picinga_web icinga_web < /usr/local/src/icinga-web/icinga-web-1.10.0-beta/etc/schema/mysql.sql', - require => [ Exec['create-mysql-icinga_web-db'], Cmmi['icinga-web'] ] + require => [ Exec['create-mysql-icinga_web-db'], Cmmi['icinga-web'] ], } file { '/var/www/html/icingaweb': @@ -360,7 +360,7 @@ file { '/var/www/html/icingaweb': } # pear::package { 'deepend/Mockery': -# channel => 'pear.survivethedeepend.com' +# channel => 'pear.survivethedeepend.com', # } # icingacli @@ -369,13 +369,13 @@ file { '/usr/local/bin/icingacli': target => '/vagrant/bin/icingacli', owner => 'apache', group => 'apache', - require => [ File['/etc/icingaweb'], File['/etc/bash_completion.d/icingacli'] ] + require => [ File['/etc/icingaweb'], File['/etc/bash_completion.d/icingacli'] ], } exec { 'install bash-completion': command => 'yum -d 0 -e 0 -y --enablerepo=epel install bash-completion', unless => 'rpm -qa | grep bash-completion', - require => Class['epel'] + require => Class['epel'], } file { '/etc/bash_completion.d/icingacli': @@ -383,6 +383,6 @@ file { '/etc/bash_completion.d/icingacli': owner => 'root', group => 'root', mode => 755, - require => Exec['install bash-completion'] + require => Exec['install bash-completion'], } diff --git a/.vagrant-puppet/modules/apache/manifests/init.pp b/.vagrant-puppet/modules/apache/manifests/init.pp index e328ff95f..07cd11c1b 100644 --- a/.vagrant-puppet/modules/apache/manifests/init.pp +++ b/.vagrant-puppet/modules/apache/manifests/init.pp @@ -16,17 +16,17 @@ class apache { $apache = $::operatingsystem ? { /(Debian|Ubuntu)/ => 'apache2', - /(RedHat|CentOS|Fedora)/ => 'httpd' + /(RedHat|CentOS|Fedora)/ => 'httpd', } package { $apache: ensure => installed, - alias => 'apache' + alias => 'apache', } service { $apache: ensure => running, alias => 'apache', - require => Package['apache'] + require => Package['apache'], } } diff --git a/.vagrant-puppet/modules/casperjs/manifests/init.pp b/.vagrant-puppet/modules/casperjs/manifests/init.pp index 2b9bac3ca..56a8a1bf1 100644 --- a/.vagrant-puppet/modules/casperjs/manifests/init.pp +++ b/.vagrant-puppet/modules/casperjs/manifests/init.pp @@ -17,7 +17,7 @@ # class {'casperjs': # url => 'https://github.com/n1k0/casperjs/tarball/1.0.2', # output => 'casperjs-1.0.2.tar.gz', -# creates => '/usr/local/casperjs' +# creates => '/usr/local/casperjs', # } # class casperjs( @@ -37,7 +37,7 @@ class casperjs( command => "wget -q ${url} -O ${output}", creates => "${cwd}/${output}", timeout => 120, - require => Class['wget'] + require => Class['wget'], } $tld = inline_template('<%= File.basename(output, ".tar.bz2") %>') @@ -49,18 +49,18 @@ class casperjs( --no-same-permissions -xzf ${output} -C ${src} \ --strip-components 1", creates => $src, - require => Exec['download-casperjs'] + require => Exec['download-casperjs'], } file { 'install-casperjs': path => $creates, source => $src, recurse => true, - require => Exec['extract-casperjs'] + require => Exec['extract-casperjs'], } file { 'link-casperjs-bin': ensure => "${creates}/bin/casperjs", - path => '/usr/local/bin/casperjs' + path => '/usr/local/bin/casperjs', } } diff --git a/.vagrant-puppet/modules/cmmi/manifests/init.pp b/.vagrant-puppet/modules/cmmi/manifests/init.pp index 64e42eb12..fca7ce572 100644 --- a/.vagrant-puppet/modules/cmmi/manifests/init.pp +++ b/.vagrant-puppet/modules/cmmi/manifests/init.pp @@ -24,8 +24,8 @@ # output => 'example-software.tar.gz', # flags => '--prefix=/opt/example-software', # creates => '/opt/example-software', -# make => 'make && make install' -# make_timeout => 600 +# make => 'make && make install', +# make_timeout => 600, # } # define cmmi( @@ -48,7 +48,7 @@ define cmmi( cwd => $cwd, command => "wget -q \"${url}\" -O ${output}", creates => "${cwd}/${output}", - require => Class['wget'] + require => Class['wget'], } $tld = inline_template('<%= File.basename(output, ".tar.gz") %>') @@ -60,14 +60,14 @@ define cmmi( --no-same-permissions -xzf ${output} -C ${name}/${tld} \ --strip-components 1", creates => $src, - require => Exec["download-${name}"] + require => Exec["download-${name}"], } exec { "configure-${name}": cwd => $src, command => "${configure_command} ${flags}", creates => "${src}/Makefile", - require => Exec["extract-${name}"] + require => Exec["extract-${name}"], } exec { "make-${name}": @@ -75,6 +75,6 @@ define cmmi( command => $make, creates => $creates, require => Exec["configure-${name}"], - timeout => $make_timeout + timeout => $make_timeout, } } diff --git a/.vagrant-puppet/modules/configure/manifests/init.pp b/.vagrant-puppet/modules/configure/manifests/init.pp index beeb98b17..fc74225f8 100644 --- a/.vagrant-puppet/modules/configure/manifests/init.pp +++ b/.vagrant-puppet/modules/configure/manifests/init.pp @@ -12,6 +12,6 @@ define configure( ) { exec { "configure-${name}": cwd => $path, - command => "sh ./configure ${flags}" + command => "sh ./configure ${flags}", } -} \ No newline at end of file +} diff --git a/.vagrant-puppet/modules/cpan/manifests/init.pp b/.vagrant-puppet/modules/cpan/manifests/init.pp index 9cbdaf8b0..470ee9cc2 100644 --- a/.vagrant-puppet/modules/cpan/manifests/init.pp +++ b/.vagrant-puppet/modules/cpan/manifests/init.pp @@ -16,7 +16,7 @@ # # cpan { 'perl-module': # creates => '/usr/local/share/perl5/perl-module', -# timeout => 600 +# timeout => 600, # } # define cpan( @@ -27,11 +27,11 @@ define cpan( Exec { path => '/usr/bin' } package { 'perl-CPAN': - ensure => installed + ensure => installed, } file { [ '/root/.cpan/', '/root/.cpan/CPAN/' ]: - ensure => directory + ensure => directory, } file { '/root/.cpan/CPAN/MyConfig.pm': @@ -44,6 +44,6 @@ define cpan( command => "sudo perl -MCPAN -e 'install ${name}'", creates => $creates, require => File['/root/.cpan/CPAN/MyConfig.pm'], - timeout => $timeout + timeout => $timeout, } } diff --git a/.vagrant-puppet/modules/epel/manifests/init.pp b/.vagrant-puppet/modules/epel/manifests/init.pp index 65e0a2603..507fff92e 100644 --- a/.vagrant-puppet/modules/epel/manifests/init.pp +++ b/.vagrant-puppet/modules/epel/manifests/init.pp @@ -18,7 +18,7 @@ class epel { mirrorlist => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=${::architecture}", enabled => '0', gpgcheck => '0', - descr => "Extra Packages for Enterprise Linux 6 - ${::architecture}" + descr => "Extra Packages for Enterprise Linux 6 - ${::architecture}", } } diff --git a/.vagrant-puppet/modules/mysql/manifests/database.pp b/.vagrant-puppet/modules/mysql/manifests/database.pp index bc9bee6a8..31dc6ab36 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database.pp @@ -6,7 +6,7 @@ define mysql::database::create ($username, $password, $privileges) { command => "mysql -uroot -e \"CREATE DATABASE ${name}; \ GRANT ${privileges} ON ${name}.* TO ${username}@localhost \ IDENTIFIED BY '${password}';\"", - require => Service['mysqld'] + require => Service['mysqld'], } } @@ -22,6 +22,6 @@ define mysql::database::populate ($username, $password, $privileges, $schemafile exec { "populate-${name}-mysql-db": unless => "mysql -u${username} -p${password} ${name} -e \"SELECT * FROM icinga_dbversion;\" &> /dev/null", command => "mysql -uroot ${name} < ${schemafile}", - require => [ $requirement, Exec["create-mysql-${name}-db"] ] + require => [ $requirement, Exec["create-mysql-${name}-db"] ], } } diff --git a/.vagrant-puppet/modules/mysql/manifests/init.pp b/.vagrant-puppet/modules/mysql/manifests/init.pp index f0cab3fdb..de94e29c1 100644 --- a/.vagrant-puppet/modules/mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/mysql/manifests/init.pp @@ -25,12 +25,12 @@ class mysql { service { 'mysqld': ensure => running, - require => Package['mysql-server'] + require => Package['mysql-server'], } file { '/etc/my.cnf': content => template('mysql/my.cnf.erb'), require => Package['mysql-server'], - notify => Service['mysqld'] + notify => Service['mysqld'], } } diff --git a/.vagrant-puppet/modules/openldap/manifests/init.pp b/.vagrant-puppet/modules/openldap/manifests/init.pp index e9f3c504b..05cbefc31 100644 --- a/.vagrant-puppet/modules/openldap/manifests/init.pp +++ b/.vagrant-puppet/modules/openldap/manifests/init.pp @@ -14,12 +14,12 @@ # class openldap { - package { ['openldap-servers', 'openldap-clients']: - ensure => installed + package { ['openldap-servers', 'openldap-clients']: + ensure => installed, } service { 'slapd': ensure => running, - require => Package['openldap-servers'] + require => Package['openldap-servers'], } } diff --git a/.vagrant-puppet/modules/pear/manifests/init.pp b/.vagrant-puppet/modules/pear/manifests/init.pp index 0c748f2bc..00492ceb6 100644 --- a/.vagrant-puppet/modules/pear/manifests/init.pp +++ b/.vagrant-puppet/modules/pear/manifests/init.pp @@ -22,22 +22,22 @@ class pear { package { 'php-pear': ensure => installed, - require => Class['php'] + require => Class['php'], } exec { 'pear upgrade': command => 'pear upgrade', - require => Package['php-pear'] + require => Package['php-pear'], } exec { 'pear update-channels': command => 'pear update-channels', - require => Package['php-pear'] + require => Package['php-pear'], } exec { 'pear auto discover channels': command => 'pear config-set auto_discover 1', unless => 'pear config-get auto_discover | grep 1', - require => Package['php-pear'] + require => Package['php-pear'], } } diff --git a/.vagrant-puppet/modules/pear/manifests/package.pp b/.vagrant-puppet/modules/pear/manifests/package.pp index 90b807b3d..0a079554a 100644 --- a/.vagrant-puppet/modules/pear/manifests/package.pp +++ b/.vagrant-puppet/modules/pear/manifests/package.pp @@ -33,18 +33,18 @@ define pear::package( command => "sudo pear channel-discover ${channel}", unless => "pear channel-info ${channel}", require => $require_, - before => Exec["pear install ${name}"] + before => Exec["pear install ${name}"], } } exec { "pear install ${name}": command => "pear install --alldeps ${name}", unless => "pear list ${name}", - require => $require_ + require => $require_, } exec { "pear upgrade ${name}": command => "pear upgrade ${name}", - require => Exec["pear install ${name}"] + require => Exec["pear install ${name}"], } } diff --git a/.vagrant-puppet/modules/pgsql/manifests/database.pp b/.vagrant-puppet/modules/pgsql/manifests/database.pp index 01528e6d7..79dd81105 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database.pp @@ -6,7 +6,7 @@ define pgsql::database::create ($username, $password) { command => "sudo -u postgres psql -c \"CREATE ROLE ${username} WITH LOGIN PASSWORD '${password}';\" && \ sudo -u postgres createdb -O ${username} -E UTF8 -T template0 ${name} && \ sudo -u postgres createlang plpgsql ${name}", - require => Service['postgresql'] + require => Service['postgresql'], } } @@ -21,6 +21,6 @@ define pgsql::database::populate ($username, $password, $schemafile, $requiremen exec { "populate-${name}-pgsql-db": unless => "psql -U ${username} -d ${name} -c \"SELECT * FROM icinga_dbversion;\" &> /dev/null", command => "sudo -u postgres psql -U ${username} -d ${name} < ${schemafile}", - require => [ $requirement, Exec["create-pgsql-${name}-db"] ] + require => [ $requirement, Exec["create-pgsql-${name}-db"] ], } } diff --git a/.vagrant-puppet/modules/pgsql/manifests/init.pp b/.vagrant-puppet/modules/pgsql/manifests/init.pp index 36e12bb11..edff19074 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/init.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/init.pp @@ -27,17 +27,17 @@ class pgsql { exec { 'initdb': creates => '/var/lib/pgsql/data/pg_xlog', command => 'service postgresql initdb', - require => Package['postgresql-server'] + require => Package['postgresql-server'], } service { 'postgresql': ensure => running, - require => [Package['postgresql-server'], Exec['initdb']] + require => [Package['postgresql-server'], Exec['initdb']], } file { '/var/lib/pgsql/data/pg_hba.conf': content => template('pgsql/pg_hba.conf.erb'), require => [Package['postgresql-server'], Exec['initdb']], - notify => Service['postgresql'] + notify => Service['postgresql'], } } diff --git a/.vagrant-puppet/modules/phantomjs/manifests/init.pp b/.vagrant-puppet/modules/phantomjs/manifests/init.pp index ea65b1f26..988f5f559 100644 --- a/.vagrant-puppet/modules/phantomjs/manifests/init.pp +++ b/.vagrant-puppet/modules/phantomjs/manifests/init.pp @@ -17,7 +17,7 @@ # class {'phantomjs': # url => 'https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2', # output => 'phantomjs-1.9.1-linux-x86_64.tar.bz2', -# creates => '/usr/local/phantomjs' +# creates => '/usr/local/phantomjs', # } # class phantomjs( @@ -37,7 +37,7 @@ class phantomjs( command => "wget -q ${url} -O ${output}", creates => "${cwd}/${output}", timeout => 120, - require => Class['wget'] + require => Class['wget'], } $src = "${cwd}/phantomjs" @@ -48,18 +48,18 @@ class phantomjs( --no-same-permissions -xjf ${output} -C ${src} \ --strip-components 1", creates => $src, - require => Exec['download-phantomjs'] + require => Exec['download-phantomjs'], } file { 'install-phantomjs': path => $creates, source => $src, recurse => true, - require => Exec['extract-phantomjs'] + require => Exec['extract-phantomjs'], } file { 'link-phantomjs-bin': ensure => "${creates}/bin/phantomjs", - path => '/usr/local/bin/phantomjs' + path => '/usr/local/bin/phantomjs', } } diff --git a/.vagrant-puppet/modules/php/manifests/extension.pp b/.vagrant-puppet/modules/php/manifests/extension.pp index 23cfe6029..7cc2d66a7 100644 --- a/.vagrant-puppet/modules/php/manifests/extension.pp +++ b/.vagrant-puppet/modules/php/manifests/extension.pp @@ -29,6 +29,6 @@ define php::extension( package { $name: ensure => $ensure, require => $require_, - notify => Service['apache'] + notify => Service['apache'], } } diff --git a/.vagrant-puppet/modules/php/manifests/init.pp b/.vagrant-puppet/modules/php/manifests/init.pp index 1a8e31746..21efec021 100644 --- a/.vagrant-puppet/modules/php/manifests/init.pp +++ b/.vagrant-puppet/modules/php/manifests/init.pp @@ -21,18 +21,18 @@ class php { package { 'php': ensure => installed, require => Package['apache'], - notify => Service['apache'] + notify => Service['apache'], } file { '/etc/php.d/error_reporting.ini': content => template('php/error_reporting.ini.erb'), require => Package['php'], - notify => Service['apache'] + notify => Service['apache'], } file { '/etc/php.d/xdebug_settings.ini': content => template('php/xdebug_settings.ini.erb'), require => Package['php'], - notify => Service['apache'] + notify => Service['apache'], } } diff --git a/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp b/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp index 2febff764..8c2dfd319 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp +++ b/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp @@ -39,7 +39,7 @@ class profile::icinga-mysql ($icingaVersion) { owner => 'icinga', group => 'icinga', require => Cmmi['icinga-mysql'], - notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] + notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ], } file { '/usr/local/icinga-mysql/etc/idomod.cfg': @@ -47,7 +47,7 @@ class profile::icinga-mysql ($icingaVersion) { owner => 'icinga', group => 'icinga', require => Cmmi['icinga-mysql'], - notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] + notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ], } file { '/usr/local/icinga-mysql/etc/modules/idoutils.cfg': @@ -55,7 +55,7 @@ class profile::icinga-mysql ($icingaVersion) { owner => 'icinga', group => 'icinga', require => Cmmi['icinga-mysql'], - notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] + notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ], } mysql::database::populate { 'icinga': diff --git a/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp b/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp index a76ca6890..7c7019d89 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp +++ b/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp @@ -40,7 +40,7 @@ class profile::icinga-pgsql ($icingaVersion) { owner => 'icinga', group => 'icinga', require => Cmmi['icinga-pgsql'], - notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ] + notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ], } file { '/usr/local/icinga-pgsql/etc/idomod.cfg': @@ -48,7 +48,7 @@ class profile::icinga-pgsql ($icingaVersion) { owner => 'icinga', group => 'icinga', require => Cmmi['icinga-pgsql'], - notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ] + notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ], } file { '/usr/local/icinga-pgsql/etc/modules/idoutils.cfg': @@ -56,7 +56,7 @@ class profile::icinga-pgsql ($icingaVersion) { owner => 'icinga', group => 'icinga', require => Cmmi['icinga-pgsql'], - notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ] + notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ], } pgsql::database::populate { 'icinga': diff --git a/.vagrant-puppet/modules/profile/manifests/icinga2.pp b/.vagrant-puppet/modules/profile/manifests/icinga2.pp index 28790e7cf..24f3532cf 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga2.pp +++ b/.vagrant-puppet/modules/profile/manifests/icinga2.pp @@ -13,7 +13,7 @@ class profile::icinga2 ($icinga2Version) { unless => "readlink /etc/icinga2/features-enabled/${feature}.conf", command => "icinga2-enable-feature ${feature}", require => [ Package['icinga2'] ], - notify => Service['icinga2'] + notify => Service['icinga2'], } } @@ -40,25 +40,25 @@ class profile::icinga2 ($icinga2Version) { File['/etc/icinga2/features-enabled/ido-mysql.conf'], File['/etc/icinga2/conf.d/test-config.conf'], File['/etc/icinga2/conf.d/commands.conf'] - ] + ], } package { 'icinga2': ensure => latest, require => Yumrepo['icinga2-repo'], - alias => 'icinga2' + alias => 'icinga2', } package { 'icinga2-bin': ensure => latest, require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ], - alias => 'icinga2-bin' + alias => 'icinga2-bin', } package { 'icinga2-doc': ensure => latest, require => Yumrepo['icinga2-repo'], - alias => 'icinga2-doc' + alias => 'icinga2-doc', } package { 'icinga2-classicui-config': @@ -71,7 +71,7 @@ class profile::icinga2 ($icinga2Version) { package { 'icinga2-ido-mysql': ensure => latest, require => Yumrepo['icinga2-repo'], - alias => 'icinga2-ido-mysql' + alias => 'icinga2-ido-mysql', } @@ -95,7 +95,7 @@ class profile::icinga2 ($icinga2Version) { source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf', owner => 'icinga', group => 'icinga', - require => [ Package['icinga2'], Exec['create_monitoring_test_config'] ] + require => [ Package['icinga2'], Exec['create_monitoring_test_config'] ], } file { '/etc/icinga2/conf.d/commands.conf': diff --git a/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp b/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp index 5d58bac00..ac38bf033 100644 --- a/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp +++ b/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp @@ -13,25 +13,25 @@ class profile::icingaweb2 { exec { 'populate-icingaweb-mysql-db-accounts': unless => 'mysql -uicingaweb -picingaweb icingaweb -e "SELECT * FROM account;" &> /dev/null', command => 'mysql -uicingaweb -picingaweb icingaweb < /vagrant/etc/schema/accounts.mysql.sql', - require => [ Exec['create-mysql-icingaweb-db'] ] + require => [ Exec['create-mysql-icingaweb-db'] ], } exec { 'populate-icingweba-pgsql-db-accounts': unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM account;" &> /dev/null', command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/accounts.pgsql.sql', - require => [ Exec['create-pgsql-icingaweb-db'] ] + require => [ Exec['create-pgsql-icingaweb-db'] ], } exec { 'populate-icingaweb-mysql-db-preferences': unless => 'mysql -uicingaweb -picingaweb icingaweb -e "SELECT * FROM preference;" &> /dev/null', command => 'mysql -uicingaweb -picingaweb icingaweb < /vagrant/etc/schema/preferences.mysql.sql', - require => [ Exec['create-mysql-icingaweb-db'] ] + require => [ Exec['create-mysql-icingaweb-db'] ], } exec { 'populate-icingweba-pgsql-db-preferences': unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM preference;" &> /dev/null', command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/preferences.pgsql.sql', - require => [ Exec['create-pgsql-icingaweb-db'] ] + require => [ Exec['create-pgsql-icingaweb-db'] ], } file { '/etc/httpd/conf.d/icingaweb.conf': @@ -43,7 +43,7 @@ class profile::icingaweb2 { file { '/etc/icingaweb': ensure => 'directory', owner => 'apache', - group => 'apache' + group => 'apache', } file { '/etc/icingaweb/authentication.ini': @@ -70,7 +70,7 @@ class profile::icingaweb2 { source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/resources.ini', owner => 'apache', group => 'apache', - replace => false + replace => false, } file { ['/etc/icingaweb/enabledModules', '/etc/icingaweb/modules', '/etc/icingaweb/modules/monitoring']: From 0677105d45171ed0c695c0f9834ec65bf326c240 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 15 Aug 2014 12:45:45 +0200 Subject: [PATCH 018/238] Unify/Deduplicate some icinga2::features refs #6842 --- .vagrant-puppet/modules/profile/manifests/icinga2.pp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.vagrant-puppet/modules/profile/manifests/icinga2.pp b/.vagrant-puppet/modules/profile/manifests/icinga2.pp index 24f3532cf..ab6cdcd12 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga2.pp +++ b/.vagrant-puppet/modules/profile/manifests/icinga2.pp @@ -17,15 +17,7 @@ class profile::icinga2 ($icinga2Version) { } } - icinga2::feature { 'statusdata': - require => Package['icinga2-classicui-config'], - } - - icinga2::feature { 'command': - require => Package['icinga2-classicui-config'], - } - - icinga2::feature { 'compatlog': + icinga2::feature { [ 'statusdata', 'command', 'compatlog' ]: require => Package['icinga2-classicui-config'], } From 67efe521416b2dc54d43725964d05609313c917a Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 18 Aug 2014 11:00:30 +0200 Subject: [PATCH 019/238] Revert "Put always a ',' after a parameter because explicit is better than implicit" This reverts commit 26205a76b3c9a937a62f4c221b03c2d4309d4c90. --- .vagrant-puppet/manifests/default.pp | 90 +++++++++---------- .../modules/apache/manifests/init.pp | 6 +- .../modules/casperjs/manifests/init.pp | 10 +-- .../modules/cmmi/manifests/init.pp | 12 +-- .../modules/configure/manifests/init.pp | 4 +- .../modules/cpan/manifests/init.pp | 8 +- .../modules/epel/manifests/init.pp | 2 +- .../modules/mysql/manifests/database.pp | 4 +- .../modules/mysql/manifests/init.pp | 4 +- .../modules/openldap/manifests/init.pp | 6 +- .../modules/pear/manifests/init.pp | 8 +- .../modules/pear/manifests/package.pp | 6 +- .../modules/pgsql/manifests/database.pp | 4 +- .../modules/pgsql/manifests/init.pp | 6 +- .../modules/phantomjs/manifests/init.pp | 10 +-- .../modules/php/manifests/extension.pp | 2 +- .vagrant-puppet/modules/php/manifests/init.pp | 6 +- .../modules/profile/manifests/icinga-mysql.pp | 6 +- .../modules/profile/manifests/icinga-pgsql.pp | 6 +- .../modules/profile/manifests/icinga2.pp | 14 +-- .../modules/profile/manifests/icingaweb2.pp | 12 +-- 21 files changed, 113 insertions(+), 113 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 74a80ea5e..04ac73a89 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -30,44 +30,44 @@ package { [ 'libpng', 'libpng-devel', 'net-snmp', 'net-snmp-devel', 'net-snmp-utils', 'libdbi', 'libdbi-devel', 'libdbi-drivers', 'libdbi-dbd-mysql', 'libdbi-dbd-pgsql' ]: - ensure => installed, + ensure => installed } php::extension { ['php-mysql', 'php-pgsql', 'php-ldap']: - require => [ Class['mysql'], Class['pgsql'], Class['openldap'] ], + require => [ Class['mysql'], Class['pgsql'], Class['openldap'] ] } php::extension { 'php-gd': } group { 'icinga-cmd': - ensure => present, + ensure => present } group { 'icingacmd': ensure => present, - require => Package['icinga2'], + require => Package['icinga2'] } user { 'icinga': ensure => present, groups => 'icinga-cmd', - managehome => false, + managehome => false } user { 'apache': groups => ['icinga-cmd', 'vagrant', 'icingacmd'], - require => [ Class['apache'], Group['icinga-cmd'], Group['icingacmd'] ], + require => [ Class['apache'], Group['icinga-cmd'], Group['icingacmd'] ] } exec { 'iptables-allow-http': unless => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables', - command => 'iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && iptables-save > /etc/sysconfig/iptables', + command => 'iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && iptables-save > /etc/sysconfig/iptables' } exec { 'icinga-htpasswd': creates => '/usr/share/icinga/htpasswd.users', command => 'mkdir -p /usr/share/icinga && htpasswd -b -c /usr/share/icinga/htpasswd.users icingaadmin icinga', - require => Class['apache'], + require => Class['apache'] } cmmi { 'icinga-plugins': @@ -78,7 +78,7 @@ cmmi { 'icinga-plugins': --with-cgiurl=/icinga-mysql/cgi-bin', creates => '/usr/lib64/nagios/plugins/libexec', make => 'make && make install', - require => User['icinga'], + require => User['icinga'] } cmmi { 'mk-livestatus': @@ -87,7 +87,7 @@ cmmi { 'mk-livestatus': flags => '--prefix=/usr/local/icinga-mysql --exec-prefix=/usr/local/icinga-mysql', creates => '/usr/local/icinga-mysql/lib/mk-livestatus', make => 'make && make install', - require => Cmmi['icinga-mysql'], + require => Cmmi['icinga-mysql'] } file { '/usr/local/icinga-mysql/etc/modules/mk-livestatus.cfg': @@ -95,25 +95,25 @@ file { '/usr/local/icinga-mysql/etc/modules/mk-livestatus.cfg': owner => 'icinga', group => 'icinga', require => Cmmi['mk-livestatus'], - notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ], + notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] } file { 'openldap/db.ldif': path => '/usr/share/openldap-servers/db.ldif', source => 'puppet:///modules/openldap/db.ldif', - require => Class['openldap'], + require => Class['openldap'] } file { 'openldap/dit.ldif': path => '/usr/share/openldap-servers/dit.ldif', source => 'puppet:///modules/openldap/dit.ldif', - require => Class['openldap'], + require => Class['openldap'] } file { 'openldap/users.ldif': path => '/usr/share/openldap-servers/users.ldif', source => 'puppet:///modules/openldap/users.ldif', - require => Class['openldap'], + require => Class['openldap'] } exec { 'populate-openldap': @@ -122,23 +122,23 @@ exec { 'populate-openldap': sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/dit.ldif || true && \ sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/users.ldif || true', require => [ Service['slapd'], File['openldap/db.ldif'], - File['openldap/dit.ldif'], File['openldap/users.ldif'] ], + File['openldap/dit.ldif'], File['openldap/users.ldif'] ] } class { 'phantomjs': url => "https://phantomjs.googlecode.com/files/phantomjs-${phantomjsVersion}-linux-x86_64.tar.bz2", output => "phantomjs-${phantomjsVersion}-linux-x86_64.tar.bz2", - creates => '/usr/local/phantomjs', + creates => '/usr/local/phantomjs' } class { 'casperjs': url => "https://github.com/n1k0/casperjs/tarball/${casperjsVersion}", output => "casperjs-${casperjsVersion}.tar.gz", - creates => '/usr/local/casperjs', + creates => '/usr/local/casperjs' } file { '/etc/profile.d/env.sh': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/profile.d/env.sh', + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/profile.d/env.sh' } include epel @@ -146,23 +146,23 @@ include epel exec { 'install PHPUnit': command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-phpunit-PHPUnit', unless => 'rpm -qa | grep php-phpunit-PHPUnit', - require => Class['epel'], + require => Class['epel'] } exec { 'install PHP CodeSniffer': command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-pear-PHP-CodeSniffer', unless => 'rpm -qa | grep php-pear-PHP-CodeSniffer', - require => Class['epel'], + require => Class['epel'] } exec { 'install php-ZendFramework': command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework', unless => 'rpm -qa | grep php-ZendFramework', - require => Class['epel'], + require => Class['epel'] } package { ['cmake', 'boost-devel', 'bison', 'flex']: - ensure => installed, + ensure => installed } # icinga 2 @@ -171,7 +171,7 @@ yumrepo { 'icinga2-repo': enabled => '1', gpgcheck => '1', gpgkey => 'http://packages.icinga.org/icinga.key', - descr => "Icinga Repository - ${::architecture}", + descr => "Icinga Repository - ${::architecture}" } exec { 'install nagios-plugins-all': @@ -184,7 +184,7 @@ exec { 'install nagios-plugins-all': package { 'icinga-gui': ensure => latest, require => Yumrepo['icinga2-repo'], - alias => 'icinga-gui', + alias => 'icinga-gui' } # icinga 2 ido mysql @@ -196,18 +196,18 @@ package { 'icinga-gui': exec { 'install php-ZendFramework-Db-Adapter-Pdo-Mysql': command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework-Db-Adapter-Pdo-Mysql', unless => 'rpm -qa | grep php-ZendFramework-Db-Adapter-Pdo-Mysql', - require => Exec['install php-ZendFramework'], + require => Exec['install php-ZendFramework'] } file { '/etc/motd': source => 'puppet:////vagrant/.vagrant-puppet/files/etc/motd', owner => root, - group => root, + group => root } user { 'vagrant': groups => 'icinga-cmd', - require => Group['icinga-cmd'], + require => Group['icinga-cmd'] } mysql::database::create { 'icinga_unittest': @@ -224,7 +224,7 @@ pgsql::database::create { 'icinga_unittest': exec { 'install php-ZendFramework-Db-Adapter-Pdo-Pgsql': command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework-Db-Adapter-Pdo-Pgsql', unless => 'rpm -qa | grep php-ZendFramework-Db-Adapter-Pdo-Pgsql', - require => Exec['install php-ZendFramework'], + require => Exec['install php-ZendFramework'] } @@ -235,7 +235,7 @@ exec { 'install php-ZendFramework-Db-Adapter-Pdo-Pgsql': # cpan { 'Monitoring::Generator::TestConfig': creates => '/usr/local/share/perl5/Monitoring/Generator/TestConfig.pm', - timeout => 600, + timeout => 600 } exec { 'create_monitoring_test_config': @@ -243,7 +243,7 @@ exec { 'create_monitoring_test_config': sudo /usr/local/bin/create_monitoring_test_config.pl -l icinga \ /usr/local/share/misc/monitoring_test_config', creates => '/usr/local/share/misc/monitoring_test_config', - require => Cpan['Monitoring::Generator::TestConfig'], + require => Cpan['Monitoring::Generator::TestConfig'] } define populate_monitoring_test_config { @@ -251,13 +251,13 @@ define populate_monitoring_test_config { owner => 'icinga', group => 'icinga', source => "/usr/local/share/misc/monitoring_test_config/etc/conf.d/${name}.cfg", - notify => Service['icinga-mysql'], + notify => Service['icinga-mysql'] } file { "/usr/local/icinga-pgsql/etc/conf.d/test_config/${name}.cfg": owner => 'icinga', group => 'icinga', source => "/usr/local/share/misc/monitoring_test_config/etc/conf.d/${name}.cfg", - notify => Service['icinga-pgsql'], + notify => Service['icinga-pgsql'] } } @@ -265,14 +265,14 @@ file { '/usr/local/icinga-mysql/etc/conf.d/test_config/': ensure => directory, owner => icinga, group => icinga, - require => Cmmi['icinga-mysql'], + require => Cmmi['icinga-mysql'] } file { '/usr/local/icinga-pgsql/etc/conf.d/test_config/': ensure => directory, owner => icinga, group => icinga, - require => Cmmi['icinga-pgsql'], + require => Cmmi['icinga-pgsql'] } populate_monitoring_test_config { ['commands', 'contacts', 'dependencies', @@ -287,7 +287,7 @@ define populate_monitoring_test_config_plugins { owner => 'icinga', group => 'icinga', source => "/usr/local/share/misc/monitoring_test_config/plugins/${name}", - notify => [ Service['icinga-mysql'], Service['icinga-pgsql'] ], + notify => [ Service['icinga-mysql'], Service['icinga-pgsql'] ] } } @@ -310,14 +310,14 @@ file { [ '/usr/local/icinga/', '/usr/local/icinga/var/', '/usr/local/icinga/var/ ensure => directory, owner => icinga, group => icinga, - require => User['icinga'], + require => User['icinga'] } file { '/usr/local/bin/icinga_command_proxy': source => 'puppet:////vagrant/.vagrant-puppet/files/usr/local/bin/icinga_command_proxy', owner => root, group => root, - mode => 755, + mode => 755 } file { '/etc/init.d/icinga_command_proxy': @@ -325,12 +325,12 @@ file { '/etc/init.d/icinga_command_proxy': owner => root, group => root, mode => 755, - require => File['/usr/local/bin/icinga_command_proxy'], + require => File['/usr/local/bin/icinga_command_proxy'] } service { 'icinga_command_proxy': ensure => running, - require => [ File['/etc/init.d/icinga_command_proxy'], Service['icinga-mysql'], Service['icinga-pgsql'] ], + require => [ File['/etc/init.d/icinga_command_proxy'], Service['icinga-mysql'], Service['icinga-pgsql'] ] } mysql::database::create { 'icinga_web': @@ -346,13 +346,13 @@ cmmi { 'icinga-web': creates => '/usr/local/icinga-web', make => 'make install && make install-apache-config', require => Service['icinga_command_proxy'], - notify => Service['apache'], + notify => Service['apache'] } exec { 'populate-icinga_web-mysql-db': unless => 'mysql -uicinga_web -picinga_web icinga_web -e "SELECT * FROM nsm_user;" &> /dev/null', command => 'mysql -uicinga_web -picinga_web icinga_web < /usr/local/src/icinga-web/icinga-web-1.10.0-beta/etc/schema/mysql.sql', - require => [ Exec['create-mysql-icinga_web-db'], Cmmi['icinga-web'] ], + require => [ Exec['create-mysql-icinga_web-db'], Cmmi['icinga-web'] ] } file { '/var/www/html/icingaweb': @@ -360,7 +360,7 @@ file { '/var/www/html/icingaweb': } # pear::package { 'deepend/Mockery': -# channel => 'pear.survivethedeepend.com', +# channel => 'pear.survivethedeepend.com' # } # icingacli @@ -369,13 +369,13 @@ file { '/usr/local/bin/icingacli': target => '/vagrant/bin/icingacli', owner => 'apache', group => 'apache', - require => [ File['/etc/icingaweb'], File['/etc/bash_completion.d/icingacli'] ], + require => [ File['/etc/icingaweb'], File['/etc/bash_completion.d/icingacli'] ] } exec { 'install bash-completion': command => 'yum -d 0 -e 0 -y --enablerepo=epel install bash-completion', unless => 'rpm -qa | grep bash-completion', - require => Class['epel'], + require => Class['epel'] } file { '/etc/bash_completion.d/icingacli': @@ -383,6 +383,6 @@ file { '/etc/bash_completion.d/icingacli': owner => 'root', group => 'root', mode => 755, - require => Exec['install bash-completion'], + require => Exec['install bash-completion'] } diff --git a/.vagrant-puppet/modules/apache/manifests/init.pp b/.vagrant-puppet/modules/apache/manifests/init.pp index 07cd11c1b..e328ff95f 100644 --- a/.vagrant-puppet/modules/apache/manifests/init.pp +++ b/.vagrant-puppet/modules/apache/manifests/init.pp @@ -16,17 +16,17 @@ class apache { $apache = $::operatingsystem ? { /(Debian|Ubuntu)/ => 'apache2', - /(RedHat|CentOS|Fedora)/ => 'httpd', + /(RedHat|CentOS|Fedora)/ => 'httpd' } package { $apache: ensure => installed, - alias => 'apache', + alias => 'apache' } service { $apache: ensure => running, alias => 'apache', - require => Package['apache'], + require => Package['apache'] } } diff --git a/.vagrant-puppet/modules/casperjs/manifests/init.pp b/.vagrant-puppet/modules/casperjs/manifests/init.pp index 56a8a1bf1..2b9bac3ca 100644 --- a/.vagrant-puppet/modules/casperjs/manifests/init.pp +++ b/.vagrant-puppet/modules/casperjs/manifests/init.pp @@ -17,7 +17,7 @@ # class {'casperjs': # url => 'https://github.com/n1k0/casperjs/tarball/1.0.2', # output => 'casperjs-1.0.2.tar.gz', -# creates => '/usr/local/casperjs', +# creates => '/usr/local/casperjs' # } # class casperjs( @@ -37,7 +37,7 @@ class casperjs( command => "wget -q ${url} -O ${output}", creates => "${cwd}/${output}", timeout => 120, - require => Class['wget'], + require => Class['wget'] } $tld = inline_template('<%= File.basename(output, ".tar.bz2") %>') @@ -49,18 +49,18 @@ class casperjs( --no-same-permissions -xzf ${output} -C ${src} \ --strip-components 1", creates => $src, - require => Exec['download-casperjs'], + require => Exec['download-casperjs'] } file { 'install-casperjs': path => $creates, source => $src, recurse => true, - require => Exec['extract-casperjs'], + require => Exec['extract-casperjs'] } file { 'link-casperjs-bin': ensure => "${creates}/bin/casperjs", - path => '/usr/local/bin/casperjs', + path => '/usr/local/bin/casperjs' } } diff --git a/.vagrant-puppet/modules/cmmi/manifests/init.pp b/.vagrant-puppet/modules/cmmi/manifests/init.pp index fca7ce572..64e42eb12 100644 --- a/.vagrant-puppet/modules/cmmi/manifests/init.pp +++ b/.vagrant-puppet/modules/cmmi/manifests/init.pp @@ -24,8 +24,8 @@ # output => 'example-software.tar.gz', # flags => '--prefix=/opt/example-software', # creates => '/opt/example-software', -# make => 'make && make install', -# make_timeout => 600, +# make => 'make && make install' +# make_timeout => 600 # } # define cmmi( @@ -48,7 +48,7 @@ define cmmi( cwd => $cwd, command => "wget -q \"${url}\" -O ${output}", creates => "${cwd}/${output}", - require => Class['wget'], + require => Class['wget'] } $tld = inline_template('<%= File.basename(output, ".tar.gz") %>') @@ -60,14 +60,14 @@ define cmmi( --no-same-permissions -xzf ${output} -C ${name}/${tld} \ --strip-components 1", creates => $src, - require => Exec["download-${name}"], + require => Exec["download-${name}"] } exec { "configure-${name}": cwd => $src, command => "${configure_command} ${flags}", creates => "${src}/Makefile", - require => Exec["extract-${name}"], + require => Exec["extract-${name}"] } exec { "make-${name}": @@ -75,6 +75,6 @@ define cmmi( command => $make, creates => $creates, require => Exec["configure-${name}"], - timeout => $make_timeout, + timeout => $make_timeout } } diff --git a/.vagrant-puppet/modules/configure/manifests/init.pp b/.vagrant-puppet/modules/configure/manifests/init.pp index fc74225f8..beeb98b17 100644 --- a/.vagrant-puppet/modules/configure/manifests/init.pp +++ b/.vagrant-puppet/modules/configure/manifests/init.pp @@ -12,6 +12,6 @@ define configure( ) { exec { "configure-${name}": cwd => $path, - command => "sh ./configure ${flags}", + command => "sh ./configure ${flags}" } -} +} \ No newline at end of file diff --git a/.vagrant-puppet/modules/cpan/manifests/init.pp b/.vagrant-puppet/modules/cpan/manifests/init.pp index 470ee9cc2..9cbdaf8b0 100644 --- a/.vagrant-puppet/modules/cpan/manifests/init.pp +++ b/.vagrant-puppet/modules/cpan/manifests/init.pp @@ -16,7 +16,7 @@ # # cpan { 'perl-module': # creates => '/usr/local/share/perl5/perl-module', -# timeout => 600, +# timeout => 600 # } # define cpan( @@ -27,11 +27,11 @@ define cpan( Exec { path => '/usr/bin' } package { 'perl-CPAN': - ensure => installed, + ensure => installed } file { [ '/root/.cpan/', '/root/.cpan/CPAN/' ]: - ensure => directory, + ensure => directory } file { '/root/.cpan/CPAN/MyConfig.pm': @@ -44,6 +44,6 @@ define cpan( command => "sudo perl -MCPAN -e 'install ${name}'", creates => $creates, require => File['/root/.cpan/CPAN/MyConfig.pm'], - timeout => $timeout, + timeout => $timeout } } diff --git a/.vagrant-puppet/modules/epel/manifests/init.pp b/.vagrant-puppet/modules/epel/manifests/init.pp index 507fff92e..65e0a2603 100644 --- a/.vagrant-puppet/modules/epel/manifests/init.pp +++ b/.vagrant-puppet/modules/epel/manifests/init.pp @@ -18,7 +18,7 @@ class epel { mirrorlist => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=${::architecture}", enabled => '0', gpgcheck => '0', - descr => "Extra Packages for Enterprise Linux 6 - ${::architecture}", + descr => "Extra Packages for Enterprise Linux 6 - ${::architecture}" } } diff --git a/.vagrant-puppet/modules/mysql/manifests/database.pp b/.vagrant-puppet/modules/mysql/manifests/database.pp index 31dc6ab36..bc9bee6a8 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database.pp @@ -6,7 +6,7 @@ define mysql::database::create ($username, $password, $privileges) { command => "mysql -uroot -e \"CREATE DATABASE ${name}; \ GRANT ${privileges} ON ${name}.* TO ${username}@localhost \ IDENTIFIED BY '${password}';\"", - require => Service['mysqld'], + require => Service['mysqld'] } } @@ -22,6 +22,6 @@ define mysql::database::populate ($username, $password, $privileges, $schemafile exec { "populate-${name}-mysql-db": unless => "mysql -u${username} -p${password} ${name} -e \"SELECT * FROM icinga_dbversion;\" &> /dev/null", command => "mysql -uroot ${name} < ${schemafile}", - require => [ $requirement, Exec["create-mysql-${name}-db"] ], + require => [ $requirement, Exec["create-mysql-${name}-db"] ] } } diff --git a/.vagrant-puppet/modules/mysql/manifests/init.pp b/.vagrant-puppet/modules/mysql/manifests/init.pp index de94e29c1..f0cab3fdb 100644 --- a/.vagrant-puppet/modules/mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/mysql/manifests/init.pp @@ -25,12 +25,12 @@ class mysql { service { 'mysqld': ensure => running, - require => Package['mysql-server'], + require => Package['mysql-server'] } file { '/etc/my.cnf': content => template('mysql/my.cnf.erb'), require => Package['mysql-server'], - notify => Service['mysqld'], + notify => Service['mysqld'] } } diff --git a/.vagrant-puppet/modules/openldap/manifests/init.pp b/.vagrant-puppet/modules/openldap/manifests/init.pp index 05cbefc31..e9f3c504b 100644 --- a/.vagrant-puppet/modules/openldap/manifests/init.pp +++ b/.vagrant-puppet/modules/openldap/manifests/init.pp @@ -14,12 +14,12 @@ # class openldap { - package { ['openldap-servers', 'openldap-clients']: - ensure => installed, + package { ['openldap-servers', 'openldap-clients']: + ensure => installed } service { 'slapd': ensure => running, - require => Package['openldap-servers'], + require => Package['openldap-servers'] } } diff --git a/.vagrant-puppet/modules/pear/manifests/init.pp b/.vagrant-puppet/modules/pear/manifests/init.pp index 00492ceb6..0c748f2bc 100644 --- a/.vagrant-puppet/modules/pear/manifests/init.pp +++ b/.vagrant-puppet/modules/pear/manifests/init.pp @@ -22,22 +22,22 @@ class pear { package { 'php-pear': ensure => installed, - require => Class['php'], + require => Class['php'] } exec { 'pear upgrade': command => 'pear upgrade', - require => Package['php-pear'], + require => Package['php-pear'] } exec { 'pear update-channels': command => 'pear update-channels', - require => Package['php-pear'], + require => Package['php-pear'] } exec { 'pear auto discover channels': command => 'pear config-set auto_discover 1', unless => 'pear config-get auto_discover | grep 1', - require => Package['php-pear'], + require => Package['php-pear'] } } diff --git a/.vagrant-puppet/modules/pear/manifests/package.pp b/.vagrant-puppet/modules/pear/manifests/package.pp index 0a079554a..90b807b3d 100644 --- a/.vagrant-puppet/modules/pear/manifests/package.pp +++ b/.vagrant-puppet/modules/pear/manifests/package.pp @@ -33,18 +33,18 @@ define pear::package( command => "sudo pear channel-discover ${channel}", unless => "pear channel-info ${channel}", require => $require_, - before => Exec["pear install ${name}"], + before => Exec["pear install ${name}"] } } exec { "pear install ${name}": command => "pear install --alldeps ${name}", unless => "pear list ${name}", - require => $require_, + require => $require_ } exec { "pear upgrade ${name}": command => "pear upgrade ${name}", - require => Exec["pear install ${name}"], + require => Exec["pear install ${name}"] } } diff --git a/.vagrant-puppet/modules/pgsql/manifests/database.pp b/.vagrant-puppet/modules/pgsql/manifests/database.pp index 79dd81105..01528e6d7 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database.pp @@ -6,7 +6,7 @@ define pgsql::database::create ($username, $password) { command => "sudo -u postgres psql -c \"CREATE ROLE ${username} WITH LOGIN PASSWORD '${password}';\" && \ sudo -u postgres createdb -O ${username} -E UTF8 -T template0 ${name} && \ sudo -u postgres createlang plpgsql ${name}", - require => Service['postgresql'], + require => Service['postgresql'] } } @@ -21,6 +21,6 @@ define pgsql::database::populate ($username, $password, $schemafile, $requiremen exec { "populate-${name}-pgsql-db": unless => "psql -U ${username} -d ${name} -c \"SELECT * FROM icinga_dbversion;\" &> /dev/null", command => "sudo -u postgres psql -U ${username} -d ${name} < ${schemafile}", - require => [ $requirement, Exec["create-pgsql-${name}-db"] ], + require => [ $requirement, Exec["create-pgsql-${name}-db"] ] } } diff --git a/.vagrant-puppet/modules/pgsql/manifests/init.pp b/.vagrant-puppet/modules/pgsql/manifests/init.pp index edff19074..36e12bb11 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/init.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/init.pp @@ -27,17 +27,17 @@ class pgsql { exec { 'initdb': creates => '/var/lib/pgsql/data/pg_xlog', command => 'service postgresql initdb', - require => Package['postgresql-server'], + require => Package['postgresql-server'] } service { 'postgresql': ensure => running, - require => [Package['postgresql-server'], Exec['initdb']], + require => [Package['postgresql-server'], Exec['initdb']] } file { '/var/lib/pgsql/data/pg_hba.conf': content => template('pgsql/pg_hba.conf.erb'), require => [Package['postgresql-server'], Exec['initdb']], - notify => Service['postgresql'], + notify => Service['postgresql'] } } diff --git a/.vagrant-puppet/modules/phantomjs/manifests/init.pp b/.vagrant-puppet/modules/phantomjs/manifests/init.pp index 988f5f559..ea65b1f26 100644 --- a/.vagrant-puppet/modules/phantomjs/manifests/init.pp +++ b/.vagrant-puppet/modules/phantomjs/manifests/init.pp @@ -17,7 +17,7 @@ # class {'phantomjs': # url => 'https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2', # output => 'phantomjs-1.9.1-linux-x86_64.tar.bz2', -# creates => '/usr/local/phantomjs', +# creates => '/usr/local/phantomjs' # } # class phantomjs( @@ -37,7 +37,7 @@ class phantomjs( command => "wget -q ${url} -O ${output}", creates => "${cwd}/${output}", timeout => 120, - require => Class['wget'], + require => Class['wget'] } $src = "${cwd}/phantomjs" @@ -48,18 +48,18 @@ class phantomjs( --no-same-permissions -xjf ${output} -C ${src} \ --strip-components 1", creates => $src, - require => Exec['download-phantomjs'], + require => Exec['download-phantomjs'] } file { 'install-phantomjs': path => $creates, source => $src, recurse => true, - require => Exec['extract-phantomjs'], + require => Exec['extract-phantomjs'] } file { 'link-phantomjs-bin': ensure => "${creates}/bin/phantomjs", - path => '/usr/local/bin/phantomjs', + path => '/usr/local/bin/phantomjs' } } diff --git a/.vagrant-puppet/modules/php/manifests/extension.pp b/.vagrant-puppet/modules/php/manifests/extension.pp index 7cc2d66a7..23cfe6029 100644 --- a/.vagrant-puppet/modules/php/manifests/extension.pp +++ b/.vagrant-puppet/modules/php/manifests/extension.pp @@ -29,6 +29,6 @@ define php::extension( package { $name: ensure => $ensure, require => $require_, - notify => Service['apache'], + notify => Service['apache'] } } diff --git a/.vagrant-puppet/modules/php/manifests/init.pp b/.vagrant-puppet/modules/php/manifests/init.pp index 21efec021..1a8e31746 100644 --- a/.vagrant-puppet/modules/php/manifests/init.pp +++ b/.vagrant-puppet/modules/php/manifests/init.pp @@ -21,18 +21,18 @@ class php { package { 'php': ensure => installed, require => Package['apache'], - notify => Service['apache'], + notify => Service['apache'] } file { '/etc/php.d/error_reporting.ini': content => template('php/error_reporting.ini.erb'), require => Package['php'], - notify => Service['apache'], + notify => Service['apache'] } file { '/etc/php.d/xdebug_settings.ini': content => template('php/xdebug_settings.ini.erb'), require => Package['php'], - notify => Service['apache'], + notify => Service['apache'] } } diff --git a/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp b/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp index 8c2dfd319..2febff764 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp +++ b/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp @@ -39,7 +39,7 @@ class profile::icinga-mysql ($icingaVersion) { owner => 'icinga', group => 'icinga', require => Cmmi['icinga-mysql'], - notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ], + notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] } file { '/usr/local/icinga-mysql/etc/idomod.cfg': @@ -47,7 +47,7 @@ class profile::icinga-mysql ($icingaVersion) { owner => 'icinga', group => 'icinga', require => Cmmi['icinga-mysql'], - notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ], + notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] } file { '/usr/local/icinga-mysql/etc/modules/idoutils.cfg': @@ -55,7 +55,7 @@ class profile::icinga-mysql ($icingaVersion) { owner => 'icinga', group => 'icinga', require => Cmmi['icinga-mysql'], - notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ], + notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] } mysql::database::populate { 'icinga': diff --git a/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp b/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp index 7c7019d89..a76ca6890 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp +++ b/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp @@ -40,7 +40,7 @@ class profile::icinga-pgsql ($icingaVersion) { owner => 'icinga', group => 'icinga', require => Cmmi['icinga-pgsql'], - notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ], + notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ] } file { '/usr/local/icinga-pgsql/etc/idomod.cfg': @@ -48,7 +48,7 @@ class profile::icinga-pgsql ($icingaVersion) { owner => 'icinga', group => 'icinga', require => Cmmi['icinga-pgsql'], - notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ], + notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ] } file { '/usr/local/icinga-pgsql/etc/modules/idoutils.cfg': @@ -56,7 +56,7 @@ class profile::icinga-pgsql ($icingaVersion) { owner => 'icinga', group => 'icinga', require => Cmmi['icinga-pgsql'], - notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ], + notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ] } pgsql::database::populate { 'icinga': diff --git a/.vagrant-puppet/modules/profile/manifests/icinga2.pp b/.vagrant-puppet/modules/profile/manifests/icinga2.pp index ab6cdcd12..f8635db60 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga2.pp +++ b/.vagrant-puppet/modules/profile/manifests/icinga2.pp @@ -13,7 +13,7 @@ class profile::icinga2 ($icinga2Version) { unless => "readlink /etc/icinga2/features-enabled/${feature}.conf", command => "icinga2-enable-feature ${feature}", require => [ Package['icinga2'] ], - notify => Service['icinga2'], + notify => Service['icinga2'] } } @@ -32,25 +32,25 @@ class profile::icinga2 ($icinga2Version) { File['/etc/icinga2/features-enabled/ido-mysql.conf'], File['/etc/icinga2/conf.d/test-config.conf'], File['/etc/icinga2/conf.d/commands.conf'] - ], + ] } package { 'icinga2': ensure => latest, require => Yumrepo['icinga2-repo'], - alias => 'icinga2', + alias => 'icinga2' } package { 'icinga2-bin': ensure => latest, require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ], - alias => 'icinga2-bin', + alias => 'icinga2-bin' } package { 'icinga2-doc': ensure => latest, require => Yumrepo['icinga2-repo'], - alias => 'icinga2-doc', + alias => 'icinga2-doc' } package { 'icinga2-classicui-config': @@ -63,7 +63,7 @@ class profile::icinga2 ($icinga2Version) { package { 'icinga2-ido-mysql': ensure => latest, require => Yumrepo['icinga2-repo'], - alias => 'icinga2-ido-mysql', + alias => 'icinga2-ido-mysql' } @@ -87,7 +87,7 @@ class profile::icinga2 ($icinga2Version) { source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf', owner => 'icinga', group => 'icinga', - require => [ Package['icinga2'], Exec['create_monitoring_test_config'] ], + require => [ Package['icinga2'], Exec['create_monitoring_test_config'] ] } file { '/etc/icinga2/conf.d/commands.conf': diff --git a/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp b/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp index ac38bf033..5d58bac00 100644 --- a/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp +++ b/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp @@ -13,25 +13,25 @@ class profile::icingaweb2 { exec { 'populate-icingaweb-mysql-db-accounts': unless => 'mysql -uicingaweb -picingaweb icingaweb -e "SELECT * FROM account;" &> /dev/null', command => 'mysql -uicingaweb -picingaweb icingaweb < /vagrant/etc/schema/accounts.mysql.sql', - require => [ Exec['create-mysql-icingaweb-db'] ], + require => [ Exec['create-mysql-icingaweb-db'] ] } exec { 'populate-icingweba-pgsql-db-accounts': unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM account;" &> /dev/null', command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/accounts.pgsql.sql', - require => [ Exec['create-pgsql-icingaweb-db'] ], + require => [ Exec['create-pgsql-icingaweb-db'] ] } exec { 'populate-icingaweb-mysql-db-preferences': unless => 'mysql -uicingaweb -picingaweb icingaweb -e "SELECT * FROM preference;" &> /dev/null', command => 'mysql -uicingaweb -picingaweb icingaweb < /vagrant/etc/schema/preferences.mysql.sql', - require => [ Exec['create-mysql-icingaweb-db'] ], + require => [ Exec['create-mysql-icingaweb-db'] ] } exec { 'populate-icingweba-pgsql-db-preferences': unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM preference;" &> /dev/null', command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/preferences.pgsql.sql', - require => [ Exec['create-pgsql-icingaweb-db'] ], + require => [ Exec['create-pgsql-icingaweb-db'] ] } file { '/etc/httpd/conf.d/icingaweb.conf': @@ -43,7 +43,7 @@ class profile::icingaweb2 { file { '/etc/icingaweb': ensure => 'directory', owner => 'apache', - group => 'apache', + group => 'apache' } file { '/etc/icingaweb/authentication.ini': @@ -70,7 +70,7 @@ class profile::icingaweb2 { source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/resources.ini', owner => 'apache', group => 'apache', - replace => false, + replace => false } file { ['/etc/icingaweb/enabledModules', '/etc/icingaweb/modules', '/etc/icingaweb/modules/monitoring']: From 114a648b4f435d475e7e51355992b656a97fa7f2 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 22 Aug 2014 11:37:46 +0200 Subject: [PATCH 020/238] deduplicate puppet code: Fix merge conflicts --- .vagrant-puppet/manifests/default.pp | 16 +++--------- .../modules/profile/manifests/icinga-mysql.pp | 2 +- .../modules/profile/manifests/icinga-pgsql.pp | 2 +- .../modules/profile/manifests/icinga2.pp | 2 +- .../modules/profile/manifests/icingaweb2.pp | 26 ++++++++++++++----- 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 04ac73a89..cfe82ef02 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -6,11 +6,10 @@ include openldap include profile::icingaweb2 include profile::nodejs -Exec { path => '/bin:/usr/bin:/sbin' } +Exec { path => '/bin:/usr/bin:/sbin:/usr/sbin' } $icingaVersion = '1.11.5' $icinga2Version = '2.0.1' -$pluginVersion = '2.0' $livestatusVersion = '1.2.4p5' $phantomjsVersion = '1.9.1' $casperjsVersion = '1.0.2' @@ -70,17 +69,6 @@ exec { 'icinga-htpasswd': require => Class['apache'] } -cmmi { 'icinga-plugins': - url => "https://www.monitoring-plugins.org/download/monitoring-plugins-${pluginVersion}.tar.gz", - output => "monitoring-plugins-${pluginVersion}.tar.gz", - flags => '--prefix=/usr/lib64/nagios/plugins \ - --with-nagios-user=icinga --with-nagios-group=icinga \ - --with-cgiurl=/icinga-mysql/cgi-bin', - creates => '/usr/lib64/nagios/plugins/libexec', - make => 'make && make install', - require => User['icinga'] -} - cmmi { 'mk-livestatus': url => "http://mathias-kettner.de/download/mk-livestatus-${livestatusVersion}.tar.gz", output => "mk-livestatus-${livestatusVersion}.tar.gz", @@ -179,6 +167,8 @@ exec { 'install nagios-plugins-all': unless => 'rpm -qa | grep nagios-plugins-all', require => [ Class['epel'], Package['icinga2'] ], } +# vs include monitoring-plugins (epel is disabled) + # icinga 2 classic ui package { 'icinga-gui': diff --git a/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp b/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp index 2febff764..f340f6fea 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp +++ b/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp @@ -10,7 +10,7 @@ class profile::icinga-mysql ($icingaVersion) { --with-plugin-dir=/usr/lib64/nagios/plugins/libexec', creates => '/usr/local/icinga-mysql', make => 'make all && make fullinstall install-config', - require => [ User['icinga'], Cmmi['icinga-plugins'], Package['apache'] ], + require => [ User['icinga'], Exec['install nagios-plugins-all'], Package['apache'] ], notify => Service['apache'], } diff --git a/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp b/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp index a76ca6890..7cfc50abb 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp +++ b/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp @@ -11,7 +11,7 @@ class profile::icinga-pgsql ($icingaVersion) { --with-plugin-dir=/usr/lib64/nagios/plugins/libexec', creates => '/usr/local/icinga-pgsql', make => 'make all && make fullinstall install-config', - require => [ User['icinga'], Cmmi['icinga-plugins'], Package['apache'] ], + require => [ User['icinga'], Exec['install nagios-plugins-all'], Package['apache'] ], notify => Service['apache'], } diff --git a/.vagrant-puppet/modules/profile/manifests/icinga2.pp b/.vagrant-puppet/modules/profile/manifests/icinga2.pp index f8635db60..a337f47e4 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga2.pp +++ b/.vagrant-puppet/modules/profile/manifests/icinga2.pp @@ -3,7 +3,7 @@ class profile::icinga2 ($icinga2Version) { username => 'icinga2', password => 'icinga2', privileges => 'SELECT,INSERT,UPDATE,DELETE', - schemafile => "/usr/share/doc/icinga2-ido-mysql-${icinga2Version}/schema/mysql.sql", + schemafile => '/usr/share/icinga2-ido-mysql/schema/mysql.sql', requirement => Package['icinga2-ido-mysql'], } diff --git a/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp b/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp index 5d58bac00..2def58b0b 100644 --- a/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp +++ b/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp @@ -47,7 +47,7 @@ class profile::icingaweb2 { } file { '/etc/icingaweb/authentication.ini': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/authentication.ini', + source => 'puppet:////vagrant/config/authentication.ini', owner => 'apache', group => 'apache', require => File['/etc/icingaweb'], @@ -60,20 +60,20 @@ class profile::icingaweb2 { } file { '/etc/icingaweb/menu.ini': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icingaweb/menu.ini', + source => 'puppet:////vagrant/config/menu.ini', owner => 'apache', group => 'apache', # replace => false, } file { '/etc/icingaweb/resources.ini': - source => 'puppet:////vagrant/.vagrant-puppet/files/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']: + file { ['/etc/icingaweb/enabledModules', '/etc/icingaweb/modules', '/etc/icingaweb/modules/monitoring', '/etc/icingaweb/modules/doc']: ensure => 'directory', owner => 'apache', group => 'apache', @@ -85,14 +85,20 @@ class profile::icingaweb2 { group => 'apache', } + 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/.vagrant-puppet/files/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/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/menu.ini', + source => 'puppet:////vagrant/config/modules/monitoring/menu.ini', owner => 'apache', group => 'apache', } @@ -104,7 +110,13 @@ class profile::icingaweb2 { } file { '/etc/icingaweb/dashboard/dashboard.ini': - source => 'puppet:////vagrant/.vagrant-puppet/files/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', } From 5a6995f67fa6de92faf7ac6aa1e0e3c8d4270a2d Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 22 Aug 2014 13:37:27 +0200 Subject: [PATCH 021/238] Outsource `icinga2' stuff, `icinga2-mysql' stuff and `icinga2::feature' into modules refs #6842 --- .../modules/icinga2-mysql/manifests/init.pp | 37 +++++++++ .../modules/icinga2/manifests/feature.pp | 9 +++ .../modules/icinga2/manifests/init.pp | 36 +++++++++ .../modules/profile/manifests/icinga2.pp | 80 +------------------ 4 files changed, 83 insertions(+), 79 deletions(-) create mode 100644 .vagrant-puppet/modules/icinga2-mysql/manifests/init.pp create mode 100644 .vagrant-puppet/modules/icinga2/manifests/feature.pp create mode 100644 .vagrant-puppet/modules/icinga2/manifests/init.pp diff --git a/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp b/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp new file mode 100644 index 000000000..09dcad820 --- /dev/null +++ b/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp @@ -0,0 +1,37 @@ +class icinga2-mysql { + include icinga2 + + mysql::database::populate { 'icinga2': + username => 'icinga2', + password => 'icinga2', + privileges => 'SELECT,INSERT,UPDATE,DELETE', + schemafile => '/usr/share/icinga2-ido-mysql/schema/mysql.sql', + requirement => Package['icinga2-ido-mysql'], + } + + icinga2::feature { 'ido-mysql': + require => Exec['populate-icinga2-mysql-db'], + } + + package { 'icinga2-ido-mysql': + ensure => latest, + require => Yumrepo['icinga2-repo'], + alias => 'icinga2-ido-mysql' + } + + file { '/etc/icinga2/features-available/ido-mysql.conf': + source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf', + owner => 'icinga', + group => 'icinga', + require => Package['icinga2'], + notify => Service['icinga2'], + } + + file { '/etc/icinga2/features-enabled/ido-mysql.conf': + ensure => 'link', + target => '/etc/icinga2/features-available/ido-mysql.conf', + owner => 'root', + group => 'root', + require => Package['icinga2-ido-mysql'], + } +} diff --git a/.vagrant-puppet/modules/icinga2/manifests/feature.pp b/.vagrant-puppet/modules/icinga2/manifests/feature.pp new file mode 100644 index 000000000..0f28771e7 --- /dev/null +++ b/.vagrant-puppet/modules/icinga2/manifests/feature.pp @@ -0,0 +1,9 @@ +define icinga2::feature ($feature = $title) { + exec { "icinga2-feature-${feature}": + path => '/bin:/usr/bin:/sbin:/usr/sbin', + unless => "readlink /etc/icinga2/features-enabled/${feature}.conf", + command => "icinga2-enable-feature ${feature}", + require => [ Package['icinga2'] ], + notify => Service['icinga2'] + } +} diff --git a/.vagrant-puppet/modules/icinga2/manifests/init.pp b/.vagrant-puppet/modules/icinga2/manifests/init.pp new file mode 100644 index 000000000..4f86ccdb2 --- /dev/null +++ b/.vagrant-puppet/modules/icinga2/manifests/init.pp @@ -0,0 +1,36 @@ +class icinga2 { + service { 'icinga2': + ensure => running, + require => [ + Package['icinga2'], + File['/etc/icinga2/features-enabled/ido-mysql.conf'], + File['/etc/icinga2/conf.d/test-config.conf'], + File['/etc/icinga2/conf.d/commands.conf'] + ] + } + + package { 'icinga2': + ensure => latest, + require => Yumrepo['icinga2-repo'], + alias => 'icinga2' + } + + package { 'icinga2-bin': + ensure => latest, + require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ], + alias => 'icinga2-bin' + } + + package { 'icinga2-doc': + ensure => latest, + require => Yumrepo['icinga2-repo'], + alias => 'icinga2-doc' + } + + package { 'icinga2-classicui-config': + ensure => latest, + before => Package["icinga-gui"], + require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ], + notify => Service['apache'], + } +} diff --git a/.vagrant-puppet/modules/profile/manifests/icinga2.pp b/.vagrant-puppet/modules/profile/manifests/icinga2.pp index a337f47e4..99c269607 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga2.pp +++ b/.vagrant-puppet/modules/profile/manifests/icinga2.pp @@ -1,88 +1,10 @@ class profile::icinga2 ($icinga2Version) { - mysql::database::populate { 'icinga2': - username => 'icinga2', - password => 'icinga2', - privileges => 'SELECT,INSERT,UPDATE,DELETE', - schemafile => '/usr/share/icinga2-ido-mysql/schema/mysql.sql', - requirement => Package['icinga2-ido-mysql'], - } - - define icinga2::feature ($feature = $title) { - exec { "icinga2-feature-${feature}": - path => '/bin:/usr/bin:/sbin:/usr/sbin', - unless => "readlink /etc/icinga2/features-enabled/${feature}.conf", - command => "icinga2-enable-feature ${feature}", - require => [ Package['icinga2'] ], - notify => Service['icinga2'] - } - } + include icinga2-mysql icinga2::feature { [ 'statusdata', 'command', 'compatlog' ]: require => Package['icinga2-classicui-config'], } - icinga2::feature { 'ido-mysql': - require => Exec['populate-icinga2-mysql-db'], - } - - service { 'icinga2': - ensure => running, - require => [ - Package['icinga2'], - File['/etc/icinga2/features-enabled/ido-mysql.conf'], - File['/etc/icinga2/conf.d/test-config.conf'], - File['/etc/icinga2/conf.d/commands.conf'] - ] - } - - package { 'icinga2': - ensure => latest, - require => Yumrepo['icinga2-repo'], - alias => 'icinga2' - } - - package { 'icinga2-bin': - ensure => latest, - require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ], - alias => 'icinga2-bin' - } - - package { 'icinga2-doc': - ensure => latest, - require => Yumrepo['icinga2-repo'], - alias => 'icinga2-doc' - } - - package { 'icinga2-classicui-config': - ensure => latest, - before => Package["icinga-gui"], - require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ], - notify => Service['apache'], - } - - package { 'icinga2-ido-mysql': - ensure => latest, - require => Yumrepo['icinga2-repo'], - alias => 'icinga2-ido-mysql' - } - - - file { '/etc/icinga2/features-available/ido-mysql.conf': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf', - owner => 'icinga', - group => 'icinga', - require => Package['icinga2'], - notify => Service['icinga2'], - } - - file { '/etc/icinga2/features-enabled/ido-mysql.conf': - ensure => 'link', - target => '/etc/icinga2/features-available/ido-mysql.conf', - owner => 'root', - group => 'root', - require => Package['icinga2-ido-mysql'], - } - file { '/etc/icinga2/conf.d/test-config.conf': source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf', owner => 'icinga', From aa030111bda4735ad0c5b4dfbd1f5cb62d8c0c43 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 22 Aug 2014 13:45:47 +0200 Subject: [PATCH 022/238] Rename `profile::icinga2' to `profile::icinga2-dev' refs #6842 --- .vagrant-puppet/manifests/default.pp | 2 +- .../modules/profile/manifests/{icinga2.pp => icinga2-dev.pp} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .vagrant-puppet/modules/profile/manifests/{icinga2.pp => icinga2-dev.pp} (94%) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index cfe82ef02..613fbe51a 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -14,7 +14,7 @@ $livestatusVersion = '1.2.4p5' $phantomjsVersion = '1.9.1' $casperjsVersion = '1.0.2' -class { 'profile::icinga2': +class { 'profile::icinga2-dev ': icinga2Version => $icinga2Version, } diff --git a/.vagrant-puppet/modules/profile/manifests/icinga2.pp b/.vagrant-puppet/modules/profile/manifests/icinga2-dev.pp similarity index 94% rename from .vagrant-puppet/modules/profile/manifests/icinga2.pp rename to .vagrant-puppet/modules/profile/manifests/icinga2-dev.pp index 99c269607..6f67e3131 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga2.pp +++ b/.vagrant-puppet/modules/profile/manifests/icinga2-dev.pp @@ -1,4 +1,4 @@ -class profile::icinga2 ($icinga2Version) { +class profile::icinga2-dev ($icinga2Version) { include icinga2-mysql icinga2::feature { [ 'statusdata', 'command', 'compatlog' ]: From ee9f87b4e47f4e1aef0041faf91713937f4a886e Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 22 Aug 2014 15:45:44 +0200 Subject: [PATCH 023/238] profile::icinga2-dev: remove parameter`icinga2Version' refs #6842 --- .vagrant-puppet/manifests/default.pp | 5 +---- .vagrant-puppet/modules/profile/manifests/icinga2-dev.pp | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 613fbe51a..039abf02d 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -5,6 +5,7 @@ include openldap include profile::icingaweb2 include profile::nodejs +include profile::icinga2-dev Exec { path => '/bin:/usr/bin:/sbin:/usr/sbin' } @@ -14,10 +15,6 @@ $livestatusVersion = '1.2.4p5' $phantomjsVersion = '1.9.1' $casperjsVersion = '1.0.2' -class { 'profile::icinga2-dev ': - icinga2Version => $icinga2Version, -} - class { [ 'profile::icinga-mysql', 'profile::icinga-pgsql' ]: diff --git a/.vagrant-puppet/modules/profile/manifests/icinga2-dev.pp b/.vagrant-puppet/modules/profile/manifests/icinga2-dev.pp index 6f67e3131..5dc3bd08c 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga2-dev.pp +++ b/.vagrant-puppet/modules/profile/manifests/icinga2-dev.pp @@ -1,4 +1,4 @@ -class profile::icinga2-dev ($icinga2Version) { +class profile::icinga2-dev { include icinga2-mysql icinga2::feature { [ 'statusdata', 'command', 'compatlog' ]: From 99133823ddbc2bc49072c3734c8720040787d2e8 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 22 Aug 2014 17:32:34 +0200 Subject: [PATCH 024/238] profile::nodejs: include epel because it's required refs #6842 --- .vagrant-puppet/modules/profile/manifests/nodejs.pp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.vagrant-puppet/modules/profile/manifests/nodejs.pp b/.vagrant-puppet/modules/profile/manifests/nodejs.pp index d6c7634c1..99f8c5efd 100644 --- a/.vagrant-puppet/modules/profile/manifests/nodejs.pp +++ b/.vagrant-puppet/modules/profile/manifests/nodejs.pp @@ -1,4 +1,6 @@ class profile::nodejs { + include epel + exec { 'install nodejs': command => 'yum -d 0 -e 0 -y --enablerepo=epel install npm', unless => 'rpm -qa | grep ^npm', From 42a564dc8bf4dce1a3e6a02b5471e9a9c5b64420 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 28 Aug 2014 12:31:13 +0200 Subject: [PATCH 025/238] Outsource yumrepo `icinga-packages' into module `icinga-packages' refs #6842 --- .../modules/icinga-packages/manifests/init.pp | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .vagrant-puppet/modules/icinga-packages/manifests/init.pp diff --git a/.vagrant-puppet/modules/icinga-packages/manifests/init.pp b/.vagrant-puppet/modules/icinga-packages/manifests/init.pp new file mode 100644 index 000000000..e249364f7 --- /dev/null +++ b/.vagrant-puppet/modules/icinga-packages/manifests/init.pp @@ -0,0 +1,9 @@ +class icinga-packages { + yumrepo { 'icinga-packages': + baseurl => "http://packages.icinga.org/epel/6/snapshot/", + enabled => '1', + gpgcheck => '1', + gpgkey => 'http://packages.icinga.org/icinga.key', + descr => "Icinga Repository - ${::architecture}" + } +} From 75ea24361db6ab1fc34a1501f287b16bd57da882 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 28 Aug 2014 12:38:52 +0200 Subject: [PATCH 026/238] Clean up module `icinga2' refs #6842 --- .../modules/icinga2/manifests/init.pp | 29 ++++--------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/init.pp b/.vagrant-puppet/modules/icinga2/manifests/init.pp index 4f86ccdb2..c2699fd1d 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/init.pp @@ -1,36 +1,19 @@ class icinga2 { + include icinga-packages + service { 'icinga2': ensure => running, - require => [ - Package['icinga2'], - File['/etc/icinga2/features-enabled/ido-mysql.conf'], - File['/etc/icinga2/conf.d/test-config.conf'], - File['/etc/icinga2/conf.d/commands.conf'] - ] + enable => true, + require => Package['icinga2'] } package { 'icinga2': ensure => latest, - require => Yumrepo['icinga2-repo'], - alias => 'icinga2' - } - - package { 'icinga2-bin': - ensure => latest, - require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ], - alias => 'icinga2-bin' + require => Class['icinga-packages'], } package { 'icinga2-doc': ensure => latest, - require => Yumrepo['icinga2-repo'], - alias => 'icinga2-doc' - } - - package { 'icinga2-classicui-config': - ensure => latest, - before => Package["icinga-gui"], - require => [ Yumrepo['icinga2-repo'], Package['icinga2'] ], - notify => Service['apache'], + require => Class['icinga-packages'], } } From f6a9c67fa21ea78b289d965442976f99b8892319 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 28 Aug 2014 13:08:42 +0200 Subject: [PATCH 027/238] Clean up `icinga2::feature' refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/feature.pp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/feature.pp b/.vagrant-puppet/modules/icinga2/manifests/feature.pp index 0f28771e7..e6ca49784 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/feature.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/feature.pp @@ -1,9 +1,11 @@ define icinga2::feature ($feature = $title) { + include icinga2 + exec { "icinga2-feature-${feature}": path => '/bin:/usr/bin:/sbin:/usr/sbin', unless => "readlink /etc/icinga2/features-enabled/${feature}.conf", command => "icinga2-enable-feature ${feature}", - require => [ Package['icinga2'] ], + require => Package['icinga2'], notify => Service['icinga2'] } } From 5c0f9980852663f4d75ace696189e6ecc71f9cc7 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 28 Aug 2014 13:33:47 +0200 Subject: [PATCH 028/238] Clean up module `icinga2-mysql' refs #6842 --- .vagrant-puppet/modules/icinga2-mysql/manifests/init.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp b/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp index 09dcad820..46c1f58d7 100644 --- a/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp @@ -1,4 +1,5 @@ class icinga2-mysql { + include icinga-packages include icinga2 mysql::database::populate { 'icinga2': @@ -10,20 +11,19 @@ class icinga2-mysql { } icinga2::feature { 'ido-mysql': - require => Exec['populate-icinga2-mysql-db'], + require => Mysql::Database::Populate['icinga2'], } package { 'icinga2-ido-mysql': ensure => latest, - require => Yumrepo['icinga2-repo'], - alias => 'icinga2-ido-mysql' + require => Class['icinga-packages'], } file { '/etc/icinga2/features-available/ido-mysql.conf': source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf', owner => 'icinga', group => 'icinga', - require => Package['icinga2'], + require => Class['icinga2'], notify => Service['icinga2'], } From 5f977328a9b9f67bcbf9a9a08c420bb275909b22 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 28 Aug 2014 14:16:21 +0200 Subject: [PATCH 029/238] Clean up `mysql::database' refs #6842 --- .vagrant-puppet/modules/icinga2-mysql/manifests/init.pp | 2 +- .vagrant-puppet/modules/mysql/manifests/database.pp | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp b/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp index 46c1f58d7..56aaa2ef0 100644 --- a/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp @@ -7,7 +7,7 @@ class icinga2-mysql { password => 'icinga2', privileges => 'SELECT,INSERT,UPDATE,DELETE', schemafile => '/usr/share/icinga2-ido-mysql/schema/mysql.sql', - requirement => Package['icinga2-ido-mysql'], + require => Package['icinga2-ido-mysql'], } icinga2::feature { 'ido-mysql': diff --git a/.vagrant-puppet/modules/mysql/manifests/database.pp b/.vagrant-puppet/modules/mysql/manifests/database.pp index bc9bee6a8..dd7c89c69 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database.pp @@ -6,13 +6,11 @@ define mysql::database::create ($username, $password, $privileges) { command => "mysql -uroot -e \"CREATE DATABASE ${name}; \ GRANT ${privileges} ON ${name}.* TO ${username}@localhost \ IDENTIFIED BY '${password}';\"", - require => Service['mysqld'] + require => Class['mysql'] } } -define mysql::database::populate ($username, $password, $privileges, $schemafile, $requirement) { - include mysql - +define mysql::database::populate ($username, $password, $privileges, $schemafile) { mysql::database::create { $name: username => $username, password => $password, @@ -22,6 +20,6 @@ define mysql::database::populate ($username, $password, $privileges, $schemafile exec { "populate-${name}-mysql-db": unless => "mysql -u${username} -p${password} ${name} -e \"SELECT * FROM icinga_dbversion;\" &> /dev/null", command => "mysql -uroot ${name} < ${schemafile}", - require => [ $requirement, Exec["create-mysql-${name}-db"] ] + require => Mysql::Database::Create[$name], } } From 4dc1541459ede78e2b6dab174157e21a4ac9ddd5 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 28 Aug 2014 14:24:18 +0200 Subject: [PATCH 030/238] Clean up `pgsql::database' refs #6842 --- .vagrant-puppet/modules/pgsql/manifests/database.pp | 8 +++----- .vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.vagrant-puppet/modules/pgsql/manifests/database.pp b/.vagrant-puppet/modules/pgsql/manifests/database.pp index 01528e6d7..1129ed598 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database.pp @@ -6,13 +6,11 @@ define pgsql::database::create ($username, $password) { command => "sudo -u postgres psql -c \"CREATE ROLE ${username} WITH LOGIN PASSWORD '${password}';\" && \ sudo -u postgres createdb -O ${username} -E UTF8 -T template0 ${name} && \ sudo -u postgres createlang plpgsql ${name}", - require => Service['postgresql'] + require => Class['pgsql'] } } -define pgsql::database::populate ($username, $password, $schemafile, $requirement) { - include pgsql - +define pgsql::database::populate ($username, $password, $schemafile) { pgsql::database::create { $name: username => $username, password => $password, @@ -21,6 +19,6 @@ define pgsql::database::populate ($username, $password, $schemafile, $requiremen exec { "populate-${name}-pgsql-db": unless => "psql -U ${username} -d ${name} -c \"SELECT * FROM icinga_dbversion;\" &> /dev/null", command => "sudo -u postgres psql -U ${username} -d ${name} < ${schemafile}", - require => [ $requirement, Exec["create-pgsql-${name}-db"] ] + require => Pgsql::Database::Create[$name], } } diff --git a/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp b/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp index 7cfc50abb..e1b366bd1 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp +++ b/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp @@ -63,6 +63,6 @@ class profile::icinga-pgsql ($icingaVersion) { username => 'icinga', password => 'icingaweb', schemafile => "/usr/local/src/icinga-pgsql/icinga-${icingaVersion}/module/idoutils/db/pgsql/pgsql.sql", - requirement => Cmmi['icinga-pgsql'], + require => Cmmi['icinga-pgsql'], } } From 146f315b4486ab9f8e80058b0610a632fd06d463 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 28 Aug 2014 14:35:06 +0200 Subject: [PATCH 031/238] Enable service mysqld refs #6842 --- .vagrant-puppet/modules/mysql/manifests/init.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/.vagrant-puppet/modules/mysql/manifests/init.pp b/.vagrant-puppet/modules/mysql/manifests/init.pp index f0cab3fdb..b96b6ac5d 100644 --- a/.vagrant-puppet/modules/mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/mysql/manifests/init.pp @@ -25,6 +25,7 @@ class mysql { service { 'mysqld': ensure => running, + enable => true, require => Package['mysql-server'] } From f2fd9f1fc4b84776ba6600f14b39de39eeb64bdf Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 28 Aug 2014 14:54:22 +0200 Subject: [PATCH 032/238] Set exec path in `mysql::database::populate' and `pgsql::database::populate' refs #6842 --- .vagrant-puppet/modules/mysql/manifests/database.pp | 2 ++ .vagrant-puppet/modules/pgsql/manifests/database.pp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.vagrant-puppet/modules/mysql/manifests/database.pp b/.vagrant-puppet/modules/mysql/manifests/database.pp index dd7c89c69..5829a0975 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database.pp @@ -11,6 +11,8 @@ IDENTIFIED BY '${password}';\"", } define mysql::database::populate ($username, $password, $privileges, $schemafile) { + Exec { path => '/usr/bin' } + mysql::database::create { $name: username => $username, password => $password, diff --git a/.vagrant-puppet/modules/pgsql/manifests/database.pp b/.vagrant-puppet/modules/pgsql/manifests/database.pp index 1129ed598..b8d1f7e33 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database.pp @@ -11,6 +11,8 @@ sudo -u postgres createlang plpgsql ${name}", } define pgsql::database::populate ($username, $password, $schemafile) { + Exec { path => '/usr/bin' } + pgsql::database::create { $name: username => $username, password => $password, From 3e5a0af69633336835c1ad70fc312000a5b28c19 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 28 Aug 2014 15:13:47 +0200 Subject: [PATCH 033/238] Avoid dependency cycle refs #6842 --- .vagrant-puppet/modules/icinga2-mysql/manifests/init.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp b/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp index 56aaa2ef0..f422ae740 100644 --- a/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp @@ -23,7 +23,6 @@ class icinga2-mysql { source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf', owner => 'icinga', group => 'icinga', - require => Class['icinga2'], notify => Service['icinga2'], } From 3d75d2e9c917a531a0fe5f0e2077386a7655768f Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 28 Aug 2014 16:17:54 +0200 Subject: [PATCH 034/238] Move '/etc/icinga2/features-available/ido-mysql.conf' into the `icinga2-mysql' module refs #6842 --- .../files/etc/icinga2/features-available/ido-mysql.conf | 0 .vagrant-puppet/modules/icinga2-mysql/manifests/init.pp | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .vagrant-puppet/{ => modules/icinga2-mysql}/files/etc/icinga2/features-available/ido-mysql.conf (100%) diff --git a/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf b/.vagrant-puppet/modules/icinga2-mysql/files/etc/icinga2/features-available/ido-mysql.conf similarity index 100% rename from .vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf rename to .vagrant-puppet/modules/icinga2-mysql/files/etc/icinga2/features-available/ido-mysql.conf diff --git a/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp b/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp index f422ae740..a336e0816 100644 --- a/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp @@ -20,7 +20,7 @@ class icinga2-mysql { } file { '/etc/icinga2/features-available/ido-mysql.conf': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf', + source => 'puppet:///modules/icinga2-mysql/etc/icinga2/features-available/ido-mysql.conf', owner => 'icinga', group => 'icinga', notify => Service['icinga2'], From cc4907bae6e58be2c18aaf12f29158d6ff8d8337 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 28 Aug 2014 16:56:10 +0200 Subject: [PATCH 035/238] icinga2-mysql: remove file '/etc/icinga2/features-enabled/ido-mysql.conf' refs #6842 --- .../modules/icinga2-mysql/manifests/init.pp | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp b/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp index a336e0816..0e481eb1c 100644 --- a/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp @@ -1,6 +1,10 @@ class icinga2-mysql { include icinga-packages - include icinga2 + + package { 'icinga2-ido-mysql': + ensure => latest, + require => Class['icinga-packages'], + } mysql::database::populate { 'icinga2': username => 'icinga2', @@ -10,27 +14,16 @@ class icinga2-mysql { require => Package['icinga2-ido-mysql'], } - icinga2::feature { 'ido-mysql': - require => Mysql::Database::Populate['icinga2'], - } - - package { 'icinga2-ido-mysql': - ensure => latest, - require => Class['icinga-packages'], - } - file { '/etc/icinga2/features-available/ido-mysql.conf': source => 'puppet:///modules/icinga2-mysql/etc/icinga2/features-available/ido-mysql.conf', owner => 'icinga', group => 'icinga', - notify => Service['icinga2'], } - file { '/etc/icinga2/features-enabled/ido-mysql.conf': - ensure => 'link', - target => '/etc/icinga2/features-available/ido-mysql.conf', - owner => 'root', - group => 'root', - require => Package['icinga2-ido-mysql'], + icinga2::feature { 'ido-mysql': + require => [ + Mysql::Database::Populate['icinga2'], + File['/etc/icinga2/features-available/ido-mysql.conf'] + ], } } From f1d18c1725d8dfbb2189ac1f93b88512b00fb64b Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 29 Aug 2014 10:25:36 +0200 Subject: [PATCH 036/238] Module `icinga2': add some `icinga2::feature's refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/init.pp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.vagrant-puppet/modules/icinga2/manifests/init.pp b/.vagrant-puppet/modules/icinga2/manifests/init.pp index c2699fd1d..f05d51465 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/init.pp @@ -16,4 +16,6 @@ class icinga2 { ensure => latest, require => Class['icinga-packages'], } + + icinga2::feature { [ 'statusdata', 'command', 'compatlog' ]: } } From 6c52b5233f4abdaa2ebc5b9eb8cb3d0563618245 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 29 Aug 2014 11:43:09 +0200 Subject: [PATCH 037/238] Move profile `icinga2-dev' and its files to `profiles/icinga2-dev' refs #6842 --- .../modules/profile/manifests/icinga2-dev.pp | 28 ------------------- .../files/etc/icinga2/conf.d/commands.conf | 0 .../files/etc/icinga2/conf.d/test-config.conf | 0 .../files/etc/icinga2/constants.conf | 0 .../profiles/icinga2-dev/manifests/init.pp | 16 +++++++++++ 5 files changed, 16 insertions(+), 28 deletions(-) delete mode 100644 .vagrant-puppet/modules/profile/manifests/icinga2-dev.pp rename .vagrant-puppet/{ => profiles/icinga2-dev}/files/etc/icinga2/conf.d/commands.conf (100%) rename .vagrant-puppet/{ => profiles/icinga2-dev}/files/etc/icinga2/conf.d/test-config.conf (100%) rename .vagrant-puppet/{ => profiles/icinga2-dev}/files/etc/icinga2/constants.conf (100%) create mode 100644 .vagrant-puppet/profiles/icinga2-dev/manifests/init.pp diff --git a/.vagrant-puppet/modules/profile/manifests/icinga2-dev.pp b/.vagrant-puppet/modules/profile/manifests/icinga2-dev.pp deleted file mode 100644 index 5dc3bd08c..000000000 --- a/.vagrant-puppet/modules/profile/manifests/icinga2-dev.pp +++ /dev/null @@ -1,28 +0,0 @@ -class profile::icinga2-dev { - include icinga2-mysql - - icinga2::feature { [ 'statusdata', 'command', 'compatlog' ]: - require => Package['icinga2-classicui-config'], - } - - file { '/etc/icinga2/conf.d/test-config.conf': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf', - owner => 'icinga', - group => 'icinga', - require => [ Package['icinga2'], Exec['create_monitoring_test_config'] ] - } - - file { '/etc/icinga2/conf.d/commands.conf': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/conf.d/commands.conf', - owner => 'icinga', - group => 'icinga', - require => Package['icinga2'], - } - - file { '/etc/icinga2/constants.conf': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/constants.conf', - owner => 'icinga', - group => 'icinga', - require => Package['icinga2'], - } -} diff --git a/.vagrant-puppet/files/etc/icinga2/conf.d/commands.conf b/.vagrant-puppet/profiles/icinga2-dev/files/etc/icinga2/conf.d/commands.conf similarity index 100% rename from .vagrant-puppet/files/etc/icinga2/conf.d/commands.conf rename to .vagrant-puppet/profiles/icinga2-dev/files/etc/icinga2/conf.d/commands.conf diff --git a/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf b/.vagrant-puppet/profiles/icinga2-dev/files/etc/icinga2/conf.d/test-config.conf similarity index 100% rename from .vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf rename to .vagrant-puppet/profiles/icinga2-dev/files/etc/icinga2/conf.d/test-config.conf diff --git a/.vagrant-puppet/files/etc/icinga2/constants.conf b/.vagrant-puppet/profiles/icinga2-dev/files/etc/icinga2/constants.conf similarity index 100% rename from .vagrant-puppet/files/etc/icinga2/constants.conf rename to .vagrant-puppet/profiles/icinga2-dev/files/etc/icinga2/constants.conf diff --git a/.vagrant-puppet/profiles/icinga2-dev/manifests/init.pp b/.vagrant-puppet/profiles/icinga2-dev/manifests/init.pp new file mode 100644 index 000000000..f12757dee --- /dev/null +++ b/.vagrant-puppet/profiles/icinga2-dev/manifests/init.pp @@ -0,0 +1,16 @@ +class icinga2-dev { + include icinga2 + include icinga2-mysql + + define icinga2-config { + $path = "/etc/icinga2/${name}.conf" + file { $path: + source => "puppet:///modules/icinga2-dev${path}", + owner => 'icinga', + group => 'icinga', + require => Class['icinga2'], + } + } + + icinga2-config { [ 'conf.d/test-config', 'conf.d/commands', 'constants' ]: } +} From 9ebf011e361b56296853984d933a053be50cd9bc Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 29 Aug 2014 11:46:15 +0200 Subject: [PATCH 038/238] Move profile `nodejs' to `profiles/nodejs' refs #6842 --- .vagrant-puppet/manifests/default.pp | 2 +- .../manifests/nodejs.pp => profiles/nodejs/manifests/init.pp} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .vagrant-puppet/{modules/profile/manifests/nodejs.pp => profiles/nodejs/manifests/init.pp} (98%) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 039abf02d..10f2e18b9 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -4,7 +4,7 @@ include pgsql include openldap include profile::icingaweb2 -include profile::nodejs +include nodejs include profile::icinga2-dev Exec { path => '/bin:/usr/bin:/sbin:/usr/sbin' } diff --git a/.vagrant-puppet/modules/profile/manifests/nodejs.pp b/.vagrant-puppet/profiles/nodejs/manifests/init.pp similarity index 98% rename from .vagrant-puppet/modules/profile/manifests/nodejs.pp rename to .vagrant-puppet/profiles/nodejs/manifests/init.pp index 99f8c5efd..2146a73b8 100644 --- a/.vagrant-puppet/modules/profile/manifests/nodejs.pp +++ b/.vagrant-puppet/profiles/nodejs/manifests/init.pp @@ -1,4 +1,4 @@ -class profile::nodejs { +class nodejs { include epel exec { 'install nodejs': From 58c854d731be679286ca1d5c1791e56cc00f5daf Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 1 Sep 2014 15:07:08 +0200 Subject: [PATCH 039/238] Move profile `icinga-mysql' to `profiles/icinga-mysql' refs #6842 --- .vagrant-puppet/manifests/default.pp | 2 +- .../icinga-mysql.pp => profiles/icinga-mysql/manifests/init.pp} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .vagrant-puppet/{modules/profile/manifests/icinga-mysql.pp => profiles/icinga-mysql/manifests/init.pp} (98%) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 10f2e18b9..939f458ce 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -16,7 +16,7 @@ $phantomjsVersion = '1.9.1' $casperjsVersion = '1.0.2' class { [ - 'profile::icinga-mysql', + 'icinga-mysql', 'profile::icinga-pgsql' ]: icingaVersion => $icingaVersion, } diff --git a/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp b/.vagrant-puppet/profiles/icinga-mysql/manifests/init.pp similarity index 98% rename from .vagrant-puppet/modules/profile/manifests/icinga-mysql.pp rename to .vagrant-puppet/profiles/icinga-mysql/manifests/init.pp index f340f6fea..5de78faad 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga-mysql.pp +++ b/.vagrant-puppet/profiles/icinga-mysql/manifests/init.pp @@ -1,4 +1,4 @@ -class profile::icinga-mysql ($icingaVersion) { +class icinga-mysql ($icingaVersion) { cmmi { 'icinga-mysql': url => "https://github.com/Icinga/icinga-core/releases/download/v${icingaVersion}/icinga-${icingaVersion}.tar.gz", output => "icinga-${icingaVersion}.tar.gz", From 4114e736260ece51b84892b6331f3d6628daa6fa Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 1 Sep 2014 15:10:17 +0200 Subject: [PATCH 040/238] Move profile `icinga-pgsql' to `profiles/icinga-pgsql' refs #6842 --- .vagrant-puppet/manifests/default.pp | 2 +- .../icinga-pgsql.pp => profiles/icinga-pgsql/manifests/init.pp} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .vagrant-puppet/{modules/profile/manifests/icinga-pgsql.pp => profiles/icinga-pgsql/manifests/init.pp} (98%) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 939f458ce..7a71c79d2 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -17,7 +17,7 @@ $casperjsVersion = '1.0.2' class { [ 'icinga-mysql', - 'profile::icinga-pgsql' ]: + 'icinga-pgsql' ]: icingaVersion => $icingaVersion, } diff --git a/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp b/.vagrant-puppet/profiles/icinga-pgsql/manifests/init.pp similarity index 98% rename from .vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp rename to .vagrant-puppet/profiles/icinga-pgsql/manifests/init.pp index e1b366bd1..266ca3561 100644 --- a/.vagrant-puppet/modules/profile/manifests/icinga-pgsql.pp +++ b/.vagrant-puppet/profiles/icinga-pgsql/manifests/init.pp @@ -1,4 +1,4 @@ -class profile::icinga-pgsql ($icingaVersion) { +class icinga-pgsql ($icingaVersion) { cmmi { 'icinga-pgsql': url => "https://github.com/Icinga/icinga-core/releases/download/v${icingaVersion}/icinga-${icingaVersion}.tar.gz", output => "icinga-${icingaVersion}.tar.gz", From 26132c4b0a28487c4234295a0207db1343a0c7b9 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 1 Sep 2014 15:13:18 +0200 Subject: [PATCH 041/238] Move profile `icingaweb2' to `profiles/icingaweb2' refs #6842 --- .vagrant-puppet/manifests/default.pp | 2 +- .../icingaweb2.pp => profiles/icingaweb2/manifests/init.pp} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .vagrant-puppet/{modules/profile/manifests/icingaweb2.pp => profiles/icingaweb2/manifests/init.pp} (99%) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 7a71c79d2..6dbe04033 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -3,7 +3,7 @@ include mysql include pgsql include openldap -include profile::icingaweb2 +include icingaweb2 include nodejs include profile::icinga2-dev diff --git a/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp b/.vagrant-puppet/profiles/icingaweb2/manifests/init.pp similarity index 99% rename from .vagrant-puppet/modules/profile/manifests/icingaweb2.pp rename to .vagrant-puppet/profiles/icingaweb2/manifests/init.pp index 2def58b0b..c3bb57c65 100644 --- a/.vagrant-puppet/modules/profile/manifests/icingaweb2.pp +++ b/.vagrant-puppet/profiles/icingaweb2/manifests/init.pp @@ -1,4 +1,4 @@ -class profile::icingaweb2 { +class icingaweb2 { mysql::database::create { 'icingaweb': username => 'icingaweb', password => 'icingaweb', From bec1b65c136fab8845915a3de5b1d80058826d52 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 1 Sep 2014 16:27:46 +0200 Subject: [PATCH 042/238] Module 'icinga2': add package 'icinga2-debuginfo' refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/init.pp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/init.pp b/.vagrant-puppet/modules/icinga2/manifests/init.pp index f05d51465..364ea3632 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/init.pp @@ -7,12 +7,8 @@ class icinga2 { require => Package['icinga2'] } - package { 'icinga2': - ensure => latest, - require => Class['icinga-packages'], - } - - package { 'icinga2-doc': + package { [ + 'icinga2', 'icinga2-doc', 'icinga2-debuginfo' ]: ensure => latest, require => Class['icinga-packages'], } From 809b7149c45775ca18516ffeb5eaf96296ed73da Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 2 Sep 2014 12:11:36 +0200 Subject: [PATCH 043/238] Puppet style guide: neither class nor defined type names may contain dashes refs #6842 --- .vagrant-puppet/manifests/default.pp | 8 ++++---- .vagrant-puppet/modules/icinga2/manifests/init.pp | 4 ++-- .../etc/icinga2/features-available/ido-mysql.conf | 0 .../{icinga2-mysql => icinga2_mysql}/manifests/init.pp | 8 ++++---- .../manifests/init.pp | 4 ++-- .../manifests/init.pp | 2 +- .../files/etc/icinga2/conf.d/commands.conf | 0 .../files/etc/icinga2/conf.d/test-config.conf | 0 .../files/etc/icinga2/constants.conf | 0 .../{icinga2-dev => icinga2_dev}/manifests/init.pp | 10 +++++----- .../{icinga-mysql => icinga_mysql}/manifests/init.pp | 2 +- .../{icinga-pgsql => icinga_pgsql}/manifests/init.pp | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) rename .vagrant-puppet/modules/{icinga2-mysql => icinga2_mysql}/files/etc/icinga2/features-available/ido-mysql.conf (100%) rename .vagrant-puppet/modules/{icinga2-mysql => icinga2_mysql}/manifests/init.pp (80%) rename .vagrant-puppet/modules/{icinga-packages => icinga_packages}/manifests/init.pp (80%) rename .vagrant-puppet/modules/{monitoring-plugins => monitoring_plugins}/manifests/init.pp (83%) rename .vagrant-puppet/profiles/{icinga2-dev => icinga2_dev}/files/etc/icinga2/conf.d/commands.conf (100%) rename .vagrant-puppet/profiles/{icinga2-dev => icinga2_dev}/files/etc/icinga2/conf.d/test-config.conf (100%) rename .vagrant-puppet/profiles/{icinga2-dev => icinga2_dev}/files/etc/icinga2/constants.conf (100%) rename .vagrant-puppet/profiles/{icinga2-dev => icinga2_dev}/manifests/init.pp (50%) rename .vagrant-puppet/profiles/{icinga-mysql => icinga_mysql}/manifests/init.pp (98%) rename .vagrant-puppet/profiles/{icinga-pgsql => icinga_pgsql}/manifests/init.pp (98%) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp index 6dbe04033..f2516f6d0 100644 --- a/.vagrant-puppet/manifests/default.pp +++ b/.vagrant-puppet/manifests/default.pp @@ -5,7 +5,7 @@ include openldap include icingaweb2 include nodejs -include profile::icinga2-dev +include icinga2_dev Exec { path => '/bin:/usr/bin:/sbin:/usr/sbin' } @@ -16,8 +16,8 @@ $phantomjsVersion = '1.9.1' $casperjsVersion = '1.0.2' class { [ - 'icinga-mysql', - 'icinga-pgsql' ]: + 'icinga_mysql', + 'icinga_pgsql' ]: icingaVersion => $icingaVersion, } @@ -164,7 +164,7 @@ exec { 'install nagios-plugins-all': unless => 'rpm -qa | grep nagios-plugins-all', require => [ Class['epel'], Package['icinga2'] ], } -# vs include monitoring-plugins (epel is disabled) +# vs include monitoring_plugins (epel is disabled) # icinga 2 classic ui diff --git a/.vagrant-puppet/modules/icinga2/manifests/init.pp b/.vagrant-puppet/modules/icinga2/manifests/init.pp index 364ea3632..cd072bcc0 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/init.pp @@ -1,5 +1,5 @@ class icinga2 { - include icinga-packages + include icinga_packages service { 'icinga2': ensure => running, @@ -10,7 +10,7 @@ class icinga2 { package { [ 'icinga2', 'icinga2-doc', 'icinga2-debuginfo' ]: ensure => latest, - require => Class['icinga-packages'], + require => Class['icinga_packages'], } icinga2::feature { [ 'statusdata', 'command', 'compatlog' ]: } diff --git a/.vagrant-puppet/modules/icinga2-mysql/files/etc/icinga2/features-available/ido-mysql.conf b/.vagrant-puppet/modules/icinga2_mysql/files/etc/icinga2/features-available/ido-mysql.conf similarity index 100% rename from .vagrant-puppet/modules/icinga2-mysql/files/etc/icinga2/features-available/ido-mysql.conf rename to .vagrant-puppet/modules/icinga2_mysql/files/etc/icinga2/features-available/ido-mysql.conf diff --git a/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp b/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp similarity index 80% rename from .vagrant-puppet/modules/icinga2-mysql/manifests/init.pp rename to .vagrant-puppet/modules/icinga2_mysql/manifests/init.pp index 0e481eb1c..4b02908f0 100644 --- a/.vagrant-puppet/modules/icinga2-mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp @@ -1,9 +1,9 @@ -class icinga2-mysql { - include icinga-packages +class icinga2_mysql { + include icinga_packages package { 'icinga2-ido-mysql': ensure => latest, - require => Class['icinga-packages'], + require => Class['icinga_packages'], } mysql::database::populate { 'icinga2': @@ -15,7 +15,7 @@ class icinga2-mysql { } file { '/etc/icinga2/features-available/ido-mysql.conf': - source => 'puppet:///modules/icinga2-mysql/etc/icinga2/features-available/ido-mysql.conf', + source => 'puppet:///modules/icinga2_mysql/etc/icinga2/features-available/ido-mysql.conf', owner => 'icinga', group => 'icinga', } diff --git a/.vagrant-puppet/modules/icinga-packages/manifests/init.pp b/.vagrant-puppet/modules/icinga_packages/manifests/init.pp similarity index 80% rename from .vagrant-puppet/modules/icinga-packages/manifests/init.pp rename to .vagrant-puppet/modules/icinga_packages/manifests/init.pp index e249364f7..0695996ea 100644 --- a/.vagrant-puppet/modules/icinga-packages/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga_packages/manifests/init.pp @@ -1,5 +1,5 @@ -class icinga-packages { - yumrepo { 'icinga-packages': +class icinga_packages { + yumrepo { 'icinga_packages': baseurl => "http://packages.icinga.org/epel/6/snapshot/", enabled => '1', gpgcheck => '1', diff --git a/.vagrant-puppet/modules/monitoring-plugins/manifests/init.pp b/.vagrant-puppet/modules/monitoring_plugins/manifests/init.pp similarity index 83% rename from .vagrant-puppet/modules/monitoring-plugins/manifests/init.pp rename to .vagrant-puppet/modules/monitoring_plugins/manifests/init.pp index 6dc7be09d..0cf4b897b 100644 --- a/.vagrant-puppet/modules/monitoring-plugins/manifests/init.pp +++ b/.vagrant-puppet/modules/monitoring_plugins/manifests/init.pp @@ -1,4 +1,4 @@ -class monitoring-plugins { +class monitoring_plugins { include epel # nagios plugins from epel diff --git a/.vagrant-puppet/profiles/icinga2-dev/files/etc/icinga2/conf.d/commands.conf b/.vagrant-puppet/profiles/icinga2_dev/files/etc/icinga2/conf.d/commands.conf similarity index 100% rename from .vagrant-puppet/profiles/icinga2-dev/files/etc/icinga2/conf.d/commands.conf rename to .vagrant-puppet/profiles/icinga2_dev/files/etc/icinga2/conf.d/commands.conf diff --git a/.vagrant-puppet/profiles/icinga2-dev/files/etc/icinga2/conf.d/test-config.conf b/.vagrant-puppet/profiles/icinga2_dev/files/etc/icinga2/conf.d/test-config.conf similarity index 100% rename from .vagrant-puppet/profiles/icinga2-dev/files/etc/icinga2/conf.d/test-config.conf rename to .vagrant-puppet/profiles/icinga2_dev/files/etc/icinga2/conf.d/test-config.conf diff --git a/.vagrant-puppet/profiles/icinga2-dev/files/etc/icinga2/constants.conf b/.vagrant-puppet/profiles/icinga2_dev/files/etc/icinga2/constants.conf similarity index 100% rename from .vagrant-puppet/profiles/icinga2-dev/files/etc/icinga2/constants.conf rename to .vagrant-puppet/profiles/icinga2_dev/files/etc/icinga2/constants.conf diff --git a/.vagrant-puppet/profiles/icinga2-dev/manifests/init.pp b/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp similarity index 50% rename from .vagrant-puppet/profiles/icinga2-dev/manifests/init.pp rename to .vagrant-puppet/profiles/icinga2_dev/manifests/init.pp index f12757dee..611d0f116 100644 --- a/.vagrant-puppet/profiles/icinga2-dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp @@ -1,16 +1,16 @@ -class icinga2-dev { +class icinga2_dev { include icinga2 - include icinga2-mysql + include icinga2_mysql - define icinga2-config { + define icinga2_config { $path = "/etc/icinga2/${name}.conf" file { $path: - source => "puppet:///modules/icinga2-dev${path}", + source => "puppet:///modules/icinga2_dev${path}", owner => 'icinga', group => 'icinga', require => Class['icinga2'], } } - icinga2-config { [ 'conf.d/test-config', 'conf.d/commands', 'constants' ]: } + icinga2_config { [ 'conf.d/test-config', 'conf.d/commands', 'constants' ]: } } diff --git a/.vagrant-puppet/profiles/icinga-mysql/manifests/init.pp b/.vagrant-puppet/profiles/icinga_mysql/manifests/init.pp similarity index 98% rename from .vagrant-puppet/profiles/icinga-mysql/manifests/init.pp rename to .vagrant-puppet/profiles/icinga_mysql/manifests/init.pp index 5de78faad..6d393e4a9 100644 --- a/.vagrant-puppet/profiles/icinga-mysql/manifests/init.pp +++ b/.vagrant-puppet/profiles/icinga_mysql/manifests/init.pp @@ -1,4 +1,4 @@ -class icinga-mysql ($icingaVersion) { +class icinga_mysql ($icingaVersion) { cmmi { 'icinga-mysql': url => "https://github.com/Icinga/icinga-core/releases/download/v${icingaVersion}/icinga-${icingaVersion}.tar.gz", output => "icinga-${icingaVersion}.tar.gz", diff --git a/.vagrant-puppet/profiles/icinga-pgsql/manifests/init.pp b/.vagrant-puppet/profiles/icinga_pgsql/manifests/init.pp similarity index 98% rename from .vagrant-puppet/profiles/icinga-pgsql/manifests/init.pp rename to .vagrant-puppet/profiles/icinga_pgsql/manifests/init.pp index 266ca3561..37d4cd70c 100644 --- a/.vagrant-puppet/profiles/icinga-pgsql/manifests/init.pp +++ b/.vagrant-puppet/profiles/icinga_pgsql/manifests/init.pp @@ -1,4 +1,4 @@ -class icinga-pgsql ($icingaVersion) { +class icinga_pgsql ($icingaVersion) { cmmi { 'icinga-pgsql': url => "https://github.com/Icinga/icinga-core/releases/download/v${icingaVersion}/icinga-${icingaVersion}.tar.gz", output => "icinga-${icingaVersion}.tar.gz", From e8dfbe688773cccf0a66f3d56ed3a41934ef6317 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 2 Sep 2014 12:12:43 +0200 Subject: [PATCH 044/238] Puppet style guide: Avoid double quoted strings containing no variables refs #6842 --- .vagrant-puppet/modules/icinga_packages/manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/icinga_packages/manifests/init.pp b/.vagrant-puppet/modules/icinga_packages/manifests/init.pp index 0695996ea..a14ee1bc1 100644 --- a/.vagrant-puppet/modules/icinga_packages/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga_packages/manifests/init.pp @@ -1,6 +1,6 @@ class icinga_packages { yumrepo { 'icinga_packages': - baseurl => "http://packages.icinga.org/epel/6/snapshot/", + baseurl => 'http://packages.icinga.org/epel/6/snapshot/', enabled => '1', gpgcheck => '1', gpgkey => 'http://packages.icinga.org/icinga.key', From f3d2347432fc5dfda381bb098f40f9a4ca8a68b4 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 2 Sep 2014 12:21:28 +0200 Subject: [PATCH 045/238] Puppet style guide: align indentation of => properly refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/feature.pp | 6 +++--- .vagrant-puppet/modules/icinga2/manifests/init.pp | 2 +- .vagrant-puppet/modules/icinga2_mysql/manifests/init.pp | 8 ++++---- .../modules/monitoring_plugins/manifests/init.pp | 4 ++-- .vagrant-puppet/modules/mysql/manifests/database.pp | 4 ++-- .vagrant-puppet/modules/openldap/manifests/init.pp | 2 +- .vagrant-puppet/modules/pear/manifests/package.pp | 6 +++--- .vagrant-puppet/profiles/icinga_mysql/manifests/init.pp | 8 ++++---- .vagrant-puppet/profiles/icinga_pgsql/manifests/init.pp | 6 +++--- .vagrant-puppet/profiles/icingaweb2/manifests/init.pp | 4 ++-- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/feature.pp b/.vagrant-puppet/modules/icinga2/manifests/feature.pp index e6ca49784..48a36cfec 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/feature.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/feature.pp @@ -2,10 +2,10 @@ define icinga2::feature ($feature = $title) { include icinga2 exec { "icinga2-feature-${feature}": - path => '/bin:/usr/bin:/sbin:/usr/sbin', - unless => "readlink /etc/icinga2/features-enabled/${feature}.conf", + path => '/bin:/usr/bin:/sbin:/usr/sbin', + unless => "readlink /etc/icinga2/features-enabled/${feature}.conf", command => "icinga2-enable-feature ${feature}", require => Package['icinga2'], - notify => Service['icinga2'] + notify => Service['icinga2'] } } diff --git a/.vagrant-puppet/modules/icinga2/manifests/init.pp b/.vagrant-puppet/modules/icinga2/manifests/init.pp index cd072bcc0..5a5d51abf 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/init.pp @@ -9,7 +9,7 @@ class icinga2 { package { [ 'icinga2', 'icinga2-doc', 'icinga2-debuginfo' ]: - ensure => latest, + ensure => latest, require => Class['icinga_packages'], } diff --git a/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp b/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp index 4b02908f0..5752cdc1e 100644 --- a/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp @@ -2,16 +2,16 @@ class icinga2_mysql { include icinga_packages package { 'icinga2-ido-mysql': - ensure => latest, + ensure => latest, require => Class['icinga_packages'], } mysql::database::populate { 'icinga2': - username => 'icinga2', - password => 'icinga2', + username => 'icinga2', + password => 'icinga2', privileges => 'SELECT,INSERT,UPDATE,DELETE', schemafile => '/usr/share/icinga2-ido-mysql/schema/mysql.sql', - require => Package['icinga2-ido-mysql'], + require => Package['icinga2-ido-mysql'], } file { '/etc/icinga2/features-available/ido-mysql.conf': diff --git a/.vagrant-puppet/modules/monitoring_plugins/manifests/init.pp b/.vagrant-puppet/modules/monitoring_plugins/manifests/init.pp index 0cf4b897b..23b9f19d4 100644 --- a/.vagrant-puppet/modules/monitoring_plugins/manifests/init.pp +++ b/.vagrant-puppet/modules/monitoring_plugins/manifests/init.pp @@ -3,7 +3,7 @@ class monitoring_plugins { # nagios plugins from epel package { 'nagios-plugins-all': - ensure => installed, + ensure => installed, require => Class['epel'] } -} \ No newline at end of file +} diff --git a/.vagrant-puppet/modules/mysql/manifests/database.pp b/.vagrant-puppet/modules/mysql/manifests/database.pp index 5829a0975..81a9956f5 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database.pp @@ -14,8 +14,8 @@ define mysql::database::populate ($username, $password, $privileges, $schemafile Exec { path => '/usr/bin' } mysql::database::create { $name: - username => $username, - password => $password, + username => $username, + password => $password, privileges => $privileges, } diff --git a/.vagrant-puppet/modules/openldap/manifests/init.pp b/.vagrant-puppet/modules/openldap/manifests/init.pp index e9f3c504b..187a5f57b 100644 --- a/.vagrant-puppet/modules/openldap/manifests/init.pp +++ b/.vagrant-puppet/modules/openldap/manifests/init.pp @@ -14,7 +14,7 @@ # class openldap { - package { ['openldap-servers', 'openldap-clients']: + package { ['openldap-servers', 'openldap-clients']: ensure => installed } diff --git a/.vagrant-puppet/modules/pear/manifests/package.pp b/.vagrant-puppet/modules/pear/manifests/package.pp index 90b807b3d..17de50ecf 100644 --- a/.vagrant-puppet/modules/pear/manifests/package.pp +++ b/.vagrant-puppet/modules/pear/manifests/package.pp @@ -31,15 +31,15 @@ define pear::package( if $channel { exec { "pear discover ${channel}": command => "sudo pear channel-discover ${channel}", - unless => "pear channel-info ${channel}", + unless => "pear channel-info ${channel}", require => $require_, - before => Exec["pear install ${name}"] + before => Exec["pear install ${name}"] } } exec { "pear install ${name}": command => "pear install --alldeps ${name}", - unless => "pear list ${name}", + unless => "pear list ${name}", require => $require_ } diff --git a/.vagrant-puppet/profiles/icinga_mysql/manifests/init.pp b/.vagrant-puppet/profiles/icinga_mysql/manifests/init.pp index 6d393e4a9..c5ab38a81 100644 --- a/.vagrant-puppet/profiles/icinga_mysql/manifests/init.pp +++ b/.vagrant-puppet/profiles/icinga_mysql/manifests/init.pp @@ -59,10 +59,10 @@ class icinga_mysql ($icingaVersion) { } mysql::database::populate { 'icinga': - username => 'icinga', - password => 'icinga', - privileges => 'SELECT,INSERT,UPDATE,DELETE', - schemafile => "/usr/local/src/icinga-mysql/icinga-${icingaVersion}/module/idoutils/db/mysql/mysql.sql", + username => 'icinga', + password => 'icinga', + privileges => 'SELECT,INSERT,UPDATE,DELETE', + schemafile => "/usr/local/src/icinga-mysql/icinga-${icingaVersion}/module/idoutils/db/mysql/mysql.sql", requirement => Cmmi['icinga-mysql'], } } diff --git a/.vagrant-puppet/profiles/icinga_pgsql/manifests/init.pp b/.vagrant-puppet/profiles/icinga_pgsql/manifests/init.pp index 37d4cd70c..a9590a913 100644 --- a/.vagrant-puppet/profiles/icinga_pgsql/manifests/init.pp +++ b/.vagrant-puppet/profiles/icinga_pgsql/manifests/init.pp @@ -60,9 +60,9 @@ class icinga_pgsql ($icingaVersion) { } pgsql::database::populate { 'icinga': - username => 'icinga', - password => 'icingaweb', + username => 'icinga', + password => 'icingaweb', schemafile => "/usr/local/src/icinga-pgsql/icinga-${icingaVersion}/module/idoutils/db/pgsql/pgsql.sql", - require => Cmmi['icinga-pgsql'], + require => Cmmi['icinga-pgsql'], } } diff --git a/.vagrant-puppet/profiles/icingaweb2/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2/manifests/init.pp index c3bb57c65..f0e13a47b 100644 --- a/.vagrant-puppet/profiles/icingaweb2/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2/manifests/init.pp @@ -1,7 +1,7 @@ class icingaweb2 { mysql::database::create { 'icingaweb': - username => 'icingaweb', - password => 'icingaweb', + username => 'icingaweb', + password => 'icingaweb', privileges => 'ALL', } From 1b3c42ff8a9dd230f5e578e68e7b5663ef97e3b3 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 2 Sep 2014 12:49:29 +0200 Subject: [PATCH 046/238] Puppet style guide: use two-space soft tabs refs #6842 --- .vagrant-puppet/modules/cpan/manifests/init.pp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.vagrant-puppet/modules/cpan/manifests/init.pp b/.vagrant-puppet/modules/cpan/manifests/init.pp index 9cbdaf8b0..4b9ca9d27 100644 --- a/.vagrant-puppet/modules/cpan/manifests/init.pp +++ b/.vagrant-puppet/modules/cpan/manifests/init.pp @@ -36,8 +36,10 @@ define cpan( file { '/root/.cpan/CPAN/MyConfig.pm': content => template('cpan/MyConfig.pm.erb'), - require => [ Package['perl-CPAN'], - File[[ '/root/.cpan/', '/root/.cpan/CPAN/' ]] ] + require => [ + Package['perl-CPAN'], + File[[ '/root/.cpan/', '/root/.cpan/CPAN/' ]] + ] } exec { "cpan-${name}": From e31e6a8972e396909f25b699a5fee3b8105e211d Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 2 Sep 2014 12:54:03 +0200 Subject: [PATCH 047/238] Puppet style guide: don't list optional parameters before required parameters refs #6842 --- .vagrant-puppet/modules/cmmi/manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/cmmi/manifests/init.pp b/.vagrant-puppet/modules/cmmi/manifests/init.pp index e0116fbc9..f83cd53ca 100644 --- a/.vagrant-puppet/modules/cmmi/manifests/init.pp +++ b/.vagrant-puppet/modules/cmmi/manifests/init.pp @@ -31,9 +31,9 @@ define cmmi( $url, $output, - $flags='', $creates, $make, + $flags='', $make_timeout=300, $configure_command='sh ./configure' ) { From 62def403dc2e88fb1f140c0852c6db30621aa66f Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 2 Sep 2014 13:12:41 +0200 Subject: [PATCH 048/238] Puppet style guide: don't define define inside a class refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/config.pp | 11 +++++++++++ .../profiles/icinga2_dev/manifests/init.pp | 13 +++---------- 2 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 .vagrant-puppet/modules/icinga2/manifests/config.pp diff --git a/.vagrant-puppet/modules/icinga2/manifests/config.pp b/.vagrant-puppet/modules/icinga2/manifests/config.pp new file mode 100644 index 000000000..310dea1e7 --- /dev/null +++ b/.vagrant-puppet/modules/icinga2/manifests/config.pp @@ -0,0 +1,11 @@ +define icinga2::config ($source) { + include icinga2 + + $path = "/etc/icinga2/${name}.conf" + file { $path: + source => "${source}${path}", + owner => 'icinga', + group => 'icinga', + require => Class['icinga2'], + } +} diff --git a/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp index 611d0f116..5a34707e9 100644 --- a/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp @@ -2,15 +2,8 @@ class icinga2_dev { include icinga2 include icinga2_mysql - define icinga2_config { - $path = "/etc/icinga2/${name}.conf" - file { $path: - source => "puppet:///modules/icinga2_dev${path}", - owner => 'icinga', - group => 'icinga', - require => Class['icinga2'], - } + icinga2::config { [ + 'conf.d/test-config', 'conf.d/commands', 'constants' ]: + source => 'puppet:///modules/icinga2_dev', } - - icinga2_config { [ 'conf.d/test-config', 'conf.d/commands', 'constants' ]: } } From d602f82db8000e4755d8e866ce2e4bc7dbdf6db0 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 2 Sep 2014 13:29:43 +0200 Subject: [PATCH 049/238] Puppet style guide: modified MySQL and PgSQL database creation and population resources to fit autoload module layout refs #6842 --- .../modules/mysql/manifests/database/create.pp | 11 +++++++++++ .../{database.pp => database/populate.pp} | 12 ------------ .../manifests/{database.pp => database/create.pp} | 15 --------------- .../modules/pgsql/manifests/database/populate.pp | 14 ++++++++++++++ 4 files changed, 25 insertions(+), 27 deletions(-) create mode 100644 .vagrant-puppet/modules/mysql/manifests/database/create.pp rename .vagrant-puppet/modules/mysql/manifests/{database.pp => database/populate.pp} (57%) rename .vagrant-puppet/modules/pgsql/manifests/{database.pp => database/create.pp} (50%) create mode 100644 .vagrant-puppet/modules/pgsql/manifests/database/populate.pp diff --git a/.vagrant-puppet/modules/mysql/manifests/database/create.pp b/.vagrant-puppet/modules/mysql/manifests/database/create.pp new file mode 100644 index 000000000..a1d242fde --- /dev/null +++ b/.vagrant-puppet/modules/mysql/manifests/database/create.pp @@ -0,0 +1,11 @@ +define mysql::database::create ($username, $password, $privileges) { + include mysql + + exec { "create-mysql-${name}-db": + unless => "mysql -u${username} -p${password} ${name}", + command => "mysql -uroot -e \"CREATE DATABASE ${name}; \ +GRANT ${privileges} ON ${name}.* TO ${username}@localhost \ +IDENTIFIED BY '${password}';\"", + require => Class['mysql'] + } +} diff --git a/.vagrant-puppet/modules/mysql/manifests/database.pp b/.vagrant-puppet/modules/mysql/manifests/database/populate.pp similarity index 57% rename from .vagrant-puppet/modules/mysql/manifests/database.pp rename to .vagrant-puppet/modules/mysql/manifests/database/populate.pp index 81a9956f5..5e3bf2d84 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database/populate.pp @@ -1,15 +1,3 @@ -define mysql::database::create ($username, $password, $privileges) { - include mysql - - exec { "create-mysql-${name}-db": - unless => "mysql -u${username} -p${password} ${name}", - command => "mysql -uroot -e \"CREATE DATABASE ${name}; \ -GRANT ${privileges} ON ${name}.* TO ${username}@localhost \ -IDENTIFIED BY '${password}';\"", - require => Class['mysql'] - } -} - define mysql::database::populate ($username, $password, $privileges, $schemafile) { Exec { path => '/usr/bin' } diff --git a/.vagrant-puppet/modules/pgsql/manifests/database.pp b/.vagrant-puppet/modules/pgsql/manifests/database/create.pp similarity index 50% rename from .vagrant-puppet/modules/pgsql/manifests/database.pp rename to .vagrant-puppet/modules/pgsql/manifests/database/create.pp index b8d1f7e33..09f280aa2 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database/create.pp @@ -9,18 +9,3 @@ sudo -u postgres createlang plpgsql ${name}", require => Class['pgsql'] } } - -define pgsql::database::populate ($username, $password, $schemafile) { - Exec { path => '/usr/bin' } - - pgsql::database::create { $name: - username => $username, - password => $password, - } - - exec { "populate-${name}-pgsql-db": - unless => "psql -U ${username} -d ${name} -c \"SELECT * FROM icinga_dbversion;\" &> /dev/null", - command => "sudo -u postgres psql -U ${username} -d ${name} < ${schemafile}", - require => Pgsql::Database::Create[$name], - } -} diff --git a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp new file mode 100644 index 000000000..ab25b19ef --- /dev/null +++ b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp @@ -0,0 +1,14 @@ +define pgsql::database::populate ($username, $password, $schemafile) { + Exec { path => '/usr/bin' } + + pgsql::database::create { $name: + username => $username, + password => $password, + } + + exec { "populate-${name}-pgsql-db": + unless => "psql -U ${username} -d ${name} -c \"SELECT * FROM icinga_dbversion;\" &> /dev/null", + command => "sudo -u postgres psql -U ${username} -d ${name} < ${schemafile}", + require => Pgsql::Database::Create[$name], + } +} From 2de3af2505e493c8536b770a4a4c65efea569626 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 2 Sep 2014 14:56:27 +0200 Subject: [PATCH 050/238] Module 'icinga2': add documentation refs #6842 --- .../modules/icinga2/manifests/config.pp | 22 +++++++++++++++++++ .../modules/icinga2/manifests/feature.pp | 20 +++++++++++++---- .../modules/icinga2/manifests/init.pp | 13 +++++++++++ 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/config.pp b/.vagrant-puppet/modules/icinga2/manifests/config.pp index 310dea1e7..a512335b0 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/config.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/config.pp @@ -1,3 +1,25 @@ +# Define: icinga2::config +# +# Provide Icinga 2 configuration file +# +# Parameters: +# +# [*source*] - where to take the file from +# +# Requires: +# +# icinga2 +# +# Sample Usage: +# +# icinga2::config { 'constants'; +# source => 'puppet:///modules/icinga2_dev', +# } +# +# Provide configuration file '/etc/icinga2/constants.conf' +# from 'puppet:///modules/icinga2_dev/etc/icinga2/constants.conf' +# ('/path/to/puppet/modules/icinga2_dev/files/etc/icinga2/constants.conf') +# define icinga2::config ($source) { include icinga2 diff --git a/.vagrant-puppet/modules/icinga2/manifests/feature.pp b/.vagrant-puppet/modules/icinga2/manifests/feature.pp index 48a36cfec..052192a3e 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/feature.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/feature.pp @@ -1,10 +1,22 @@ -define icinga2::feature ($feature = $title) { +# Define: icinga2::feature +# +# Enable Icinga 2 feature +# +# Requires: +# +# icinga2 +# +# Sample Usage: +# +# icinga2::feature { 'example-feature'; } +# +define icinga2::feature { include icinga2 - exec { "icinga2-feature-${feature}": + exec { "icinga2-feature-${name}": path => '/bin:/usr/bin:/sbin:/usr/sbin', - unless => "readlink /etc/icinga2/features-enabled/${feature}.conf", - command => "icinga2-enable-feature ${feature}", + unless => "readlink /etc/icinga2/features-enabled/${name}.conf", + command => "icinga2-enable-feature ${name}", require => Package['icinga2'], notify => Service['icinga2'] } diff --git a/.vagrant-puppet/modules/icinga2/manifests/init.pp b/.vagrant-puppet/modules/icinga2/manifests/init.pp index 5a5d51abf..c22e82b92 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/init.pp @@ -1,3 +1,16 @@ +# Class: icinga2 +# +# This class installs Icinga 2. +# +# Requires: +# +# icinga_packages +# icinga2::feature +# +# Sample Usage: +# +# include icinga2 +# class icinga2 { include icinga_packages From d3d64e3efe45bdb926a17dcba154c1ff64525a8a Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 2 Sep 2014 15:30:51 +0200 Subject: [PATCH 051/238] Module 'icinga2_mysql': add documentation refs #6842 --- .../modules/icinga2_mysql/manifests/init.pp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp b/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp index 5752cdc1e..8f6ff779f 100644 --- a/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp @@ -1,4 +1,20 @@ +# Class: icinga2_mysql +# +# This class installs Icinga 2 and Icinga-2-IDO-MySQL and set up the database for the last one. +# +# Requires: +# +# icinga2 +# icinga_packages +# icinga2::feature +# mysql::database::populate +# +# Sample Usage: +# +# include icinga2_mysql +# class icinga2_mysql { + include icinga2 include icinga_packages package { 'icinga2-ido-mysql': From 96e98c8c53bb98da634f2b9748504a03f0777d1e Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 2 Sep 2014 15:51:30 +0200 Subject: [PATCH 052/238] Module 'icinga_packages': add documentation refs #6842 --- .vagrant-puppet/modules/icinga_packages/manifests/init.pp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.vagrant-puppet/modules/icinga_packages/manifests/init.pp b/.vagrant-puppet/modules/icinga_packages/manifests/init.pp index a14ee1bc1..7e3e8d188 100644 --- a/.vagrant-puppet/modules/icinga_packages/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga_packages/manifests/init.pp @@ -1,3 +1,11 @@ +# Class: icinga_packages +# +# This class adds the YUM repository for the Icinga packages. +# +# Sample Usage: +# +# include icinga_packages +# class icinga_packages { yumrepo { 'icinga_packages': baseurl => 'http://packages.icinga.org/epel/6/snapshot/', From 65f305159d340618b0bf6f906753f29db4daa7e3 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 2 Sep 2014 16:18:06 +0200 Subject: [PATCH 053/238] Module 'mysql': add documentation refs #6842 --- .../mysql/manifests/database/create.pp | 22 +++++++++++++++++ .../mysql/manifests/database/populate.pp | 24 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/.vagrant-puppet/modules/mysql/manifests/database/create.pp b/.vagrant-puppet/modules/mysql/manifests/database/create.pp index a1d242fde..fff93c6e6 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database/create.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database/create.pp @@ -1,3 +1,25 @@ +# Define: mysql::database::create +# +# Create a MySQL database +# +# Parameters: +# +# [*username*] - name of the user the database belongs to +# [*password*] - password of the user the database belongs to +# [*privileges*] - privileges of the user the database belongs to +# +# Requires: +# +# mysql +# +# Sample Usage: +# +# mysql::database::create { 'icinga2': +# username => 'icinga2', +# password => 'icinga2', +# privileges => 'SELECT,INSERT,UPDATE,DELETE', +# } +# define mysql::database::create ($username, $password, $privileges) { include mysql diff --git a/.vagrant-puppet/modules/mysql/manifests/database/populate.pp b/.vagrant-puppet/modules/mysql/manifests/database/populate.pp index 5e3bf2d84..2d40af0b9 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database/populate.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database/populate.pp @@ -1,3 +1,27 @@ +# Define: mysql::database::populate +# +# Create and populate a MySQL database +# +# Parameters: +# +# [*username*] - name of the user the database belongs to +# [*password*] - password of the user the database belongs to +# [*privileges*] - privileges of the user the database belongs to +# [*schemafile*] - file with the schema for the database +# +# Requires: +# +# mysql::database::create +# +# Sample Usage: +# +# mysql::database::populate { 'icinga2': +# username => 'icinga2', +# password => 'icinga2', +# privileges => 'SELECT,INSERT,UPDATE,DELETE', +# schemafile => '/usr/share/icinga2-ido-mysql/schema/mysql.sql', +# } +# define mysql::database::populate ($username, $password, $privileges, $schemafile) { Exec { path => '/usr/bin' } From 7b45e5cc8ec4148f7256c57c176967742b70ae35 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 2 Sep 2014 16:19:33 +0200 Subject: [PATCH 054/238] Module 'pgsql': add documentation refs #6842 --- .../pgsql/manifests/database/create.pp | 20 +++++++++++++++++ .../pgsql/manifests/database/populate.pp | 22 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/.vagrant-puppet/modules/pgsql/manifests/database/create.pp b/.vagrant-puppet/modules/pgsql/manifests/database/create.pp index 09f280aa2..8e36fe7ea 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database/create.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database/create.pp @@ -1,3 +1,23 @@ +# Define: pgsql::database::create +# +# Create a PgSQL database +# +# Parameters: +# +# [*username*] - name of the user the database belongs to +# [*password*] - password of the user the database belongs to +# +# Requires: +# +# pgsql +# +# Sample Usage: +# +# pgsql::database::create { 'icinga2': +# username => 'icinga2', +# password => 'icinga2', +# } +# define pgsql::database::create ($username, $password) { include pgsql diff --git a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp index ab25b19ef..9d849da7d 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp @@ -1,3 +1,25 @@ +# Define: pgsql::database::populate +# +# Create and populate a PgSQL database +# +# Parameters: +# +# [*username*] - name of the user the database belongs to +# [*password*] - password of the user the database belongs to +# [*schemafile*] - file with the schema for the database +# +# Requires: +# +# pgsql::database::create +# +# Sample Usage: +# +# pgsql::database::populate { 'icinga2': +# username => 'icinga2', +# password => 'icinga2', +# schemafile => '/usr/share/icinga2-ido-pgsql/schema/pgsql.sql', +# } +# define pgsql::database::populate ($username, $password, $schemafile) { Exec { path => '/usr/bin' } From 4d3268531655e09d3f084c4a58ed523d570863db Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 2 Sep 2014 16:41:16 +0200 Subject: [PATCH 055/238] Module (profile) 'icinga2_dev': add documentation refs #6842 --- .../profiles/icinga2_dev/manifests/init.pp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp index 5a34707e9..94e97f7b2 100644 --- a/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp @@ -1,5 +1,17 @@ +# Class: icinga2_dev +# +# This class installs Icinga 2 w/ MySQL and provides Icinga 2 test configuration. +# +# Requires: +# +# icinga2_mysql +# icinga2::config +# +# Sample Usage: +# +# include icinga2_dev +# class icinga2_dev { - include icinga2 include icinga2_mysql icinga2::config { [ From 2c0d71ad956ced3993c12f79cdc995b7eae07940 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 8 Sep 2014 12:24:28 +0200 Subject: [PATCH 056/238] Rename profile `icingaweb2' to `icingaweb2_dev' refs #6842 --- .../profiles/{icingaweb2 => icingaweb2_dev}/manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .vagrant-puppet/profiles/{icingaweb2 => icingaweb2_dev}/manifests/init.pp (99%) diff --git a/.vagrant-puppet/profiles/icingaweb2/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp similarity index 99% rename from .vagrant-puppet/profiles/icingaweb2/manifests/init.pp rename to .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index f0e13a47b..400a08b00 100644 --- a/.vagrant-puppet/profiles/icingaweb2/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -1,4 +1,4 @@ -class icingaweb2 { +class icingaweb2_dev { mysql::database::create { 'icingaweb': username => 'icingaweb', password => 'icingaweb', From 4484a3117b04cf84ff4f9e66cef69d1ffa972764 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 9 Sep 2014 12:30:35 +0200 Subject: [PATCH 057/238] mysql::database::populate: populate the DB only if it's empty refs #6842 --- .vagrant-puppet/modules/mysql/manifests/database/populate.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/mysql/manifests/database/populate.pp b/.vagrant-puppet/modules/mysql/manifests/database/populate.pp index 2d40af0b9..39b819e1e 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database/populate.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database/populate.pp @@ -32,7 +32,7 @@ define mysql::database::populate ($username, $password, $privileges, $schemafile } exec { "populate-${name}-mysql-db": - unless => "mysql -u${username} -p${password} ${name} -e \"SELECT * FROM icinga_dbversion;\" &> /dev/null", + onlyif => "mysql -u${username} -p${password} ${name} -e \"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '${name}';\" 2>/dev/null |grep -qEe '^ *0 *$'", command => "mysql -uroot ${name} < ${schemafile}", require => Mysql::Database::Create[$name], } From be7bae8cd698b62dbe4260ab70006aab894ed930 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 9 Sep 2014 12:32:21 +0200 Subject: [PATCH 058/238] pgsql::database::populate: populate the DB only if it's empty refs #6842 --- .vagrant-puppet/modules/pgsql/manifests/database/populate.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp index 9d849da7d..3bc35b5c7 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp @@ -29,7 +29,7 @@ define pgsql::database::populate ($username, $password, $schemafile) { } exec { "populate-${name}-pgsql-db": - unless => "psql -U ${username} -d ${name} -c \"SELECT * FROM icinga_dbversion;\" &> /dev/null", + onlyif => "psql -U ${username} -d ${name} -c \"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '${name}';\" 2>/dev/null |grep -qEe '^ *0 *$'", command => "sudo -u postgres psql -U ${username} -d ${name} < ${schemafile}", require => Pgsql::Database::Create[$name], } From 77719be042910b6574a305516e02ce18c4a4055b Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 9 Sep 2014 13:19:12 +0200 Subject: [PATCH 059/238] Profile `icingaweb2_dev': deduplicate DB creation/population refs #6842 --- .../profiles/icingaweb2_dev/manifests/init.pp | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 400a08b00..e65e920b9 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -1,37 +1,27 @@ class icingaweb2_dev { - mysql::database::create { 'icingaweb': + mysql::database::populate { 'icingaweb': username => 'icingaweb', password => 'icingaweb', privileges => 'ALL', + schemafile => '/vagrant/etc/schema/accounts.mysql.sql', } - pgsql::database::create { 'icingaweb': + pgsql::database::populate { 'icingaweb': username => 'icingaweb', password => 'icinga', - } - - exec { 'populate-icingaweb-mysql-db-accounts': - unless => 'mysql -uicingaweb -picingaweb icingaweb -e "SELECT * FROM account;" &> /dev/null', - command => 'mysql -uicingaweb -picingaweb icingaweb < /vagrant/etc/schema/accounts.mysql.sql', - require => [ Exec['create-mysql-icingaweb-db'] ] - } - - exec { 'populate-icingweba-pgsql-db-accounts': - unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM account;" &> /dev/null', - command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/accounts.pgsql.sql', - require => [ Exec['create-pgsql-icingaweb-db'] ] + schemafile => '/vagrant/etc/schema/accounts.pgsql.sql', } exec { 'populate-icingaweb-mysql-db-preferences': unless => 'mysql -uicingaweb -picingaweb icingaweb -e "SELECT * FROM preference;" &> /dev/null', command => 'mysql -uicingaweb -picingaweb icingaweb < /vagrant/etc/schema/preferences.mysql.sql', - require => [ Exec['create-mysql-icingaweb-db'] ] + require => Mysql::Database::Populate['icingaweb'], } - exec { 'populate-icingweba-pgsql-db-preferences': + exec { 'populate-icingweb-pgsql-db-preferences': unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM preference;" &> /dev/null', command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/preferences.pgsql.sql', - require => [ Exec['create-pgsql-icingaweb-db'] ] + require => Pgsql::Database::Populate['icingaweb'], } file { '/etc/httpd/conf.d/icingaweb.conf': From 6aa2dcdd72d5617f40d29954496e53d235ddeb36 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 9 Sep 2014 13:40:16 +0200 Subject: [PATCH 060/238] 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' ]: } } From 7e4feb748d1be8b724a9586cb1fbdb277fe25329 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 9 Sep 2014 14:45:04 +0200 Subject: [PATCH 061/238] Profile `icingaweb2_dev': softcode '/etc/icingaweb' as $cfgpath refs #6842 --- .../profiles/icingaweb2_dev/manifests/init.pp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index f3e93ca16..2f1e3e012 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -30,30 +30,31 @@ class icingaweb2_dev { notify => Service['apache'], } - file { '/etc/icingaweb/config.ini': + $cfgpath = '/etc/icingaweb' + + file { "${cfgpath}/config.ini": ensure => file, owner => 'apache', group => 'apache', } file { [ - '/etc/icingaweb', - '/etc/icingaweb/enabledModules', - '/etc/icingaweb/modules', - '/etc/icingaweb/modules/monitoring', - '/etc/icingaweb/modules/doc', - '/etc/icingaweb/dashboard' + "${cfgpath}", + "${cfgpath}/enabledModules", + "${cfgpath}/modules", + "${cfgpath}/modules/monitoring", + "${cfgpath}/modules/doc" ]: ensure => 'directory', owner => 'apache', group => 'apache', } - icingaweb2::config { [ 'dashboard/dashboard', 'modules/doc/menu', 'authentication', 'menu' ]: } + icingaweb2::config { 'authentication': } icingaweb2::config { 'resources': replace => false, } - icingaweb2::config::monitoring { [ 'backends', 'config', 'instances', 'menu' ]: } + icingaweb2::config::monitoring { [ 'backends', 'config', 'instances' ]: } } From 1e511a0e3ac71542001c61ae70809b6a3a19778c Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 9 Sep 2014 14:48:55 +0200 Subject: [PATCH 062/238] Rename `icingaweb2::config::monitoring' to `icingaweb2::config::module' refs #6842 --- .../modules/icingaweb2/manifests/config/module.pp | 6 ++++++ .../modules/icingaweb2/manifests/config/monitoring.pp | 6 ------ .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 .vagrant-puppet/modules/icingaweb2/manifests/config/module.pp delete mode 100644 .vagrant-puppet/modules/icingaweb2/manifests/config/monitoring.pp diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config/module.pp b/.vagrant-puppet/modules/icingaweb2/manifests/config/module.pp new file mode 100644 index 000000000..ece68c025 --- /dev/null +++ b/.vagrant-puppet/modules/icingaweb2/manifests/config/module.pp @@ -0,0 +1,6 @@ +define icingaweb2::config::module ($source, $module = 'monitoring', $replace = true) { + icingaweb2::config { "modules/${module}/${name}": + source => $source, + replace => $replace, + } +} diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config/monitoring.pp b/.vagrant-puppet/modules/icingaweb2/manifests/config/monitoring.pp deleted file mode 100644 index 151252185..000000000 --- a/.vagrant-puppet/modules/icingaweb2/manifests/config/monitoring.pp +++ /dev/null @@ -1,6 +0,0 @@ -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 2f1e3e012..576c431d6 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -56,5 +56,5 @@ class icingaweb2_dev { replace => false, } - icingaweb2::config::monitoring { [ 'backends', 'config', 'instances' ]: } + icingaweb2::config::module { [ 'backends', 'config', 'instances' ]: } } From 858e7c2f9e54fe0ff533c36b5f36348f01c6fae0 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 9 Sep 2014 15:15:53 +0200 Subject: [PATCH 063/238] Profile `icingaweb2_dev': add config file 'resources.ini' refs #6842 --- .../files/etc/icingaweb/resources.ini | 26 +++++++++++++++++++ .../profiles/icingaweb2_dev/manifests/init.pp | 5 ++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/resources.ini diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/resources.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/resources.ini new file mode 100644 index 000000000..6b304b934 --- /dev/null +++ b/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/resources.ini @@ -0,0 +1,26 @@ +[icingaweb-mysql] +type = db +db = mysql +host = localhost +port = 3306 +password = icingaweb +username = icingaweb +dbname = icingaweb + +[icingaweb-pgsql] +type = db +db = pgsql +host = localhost +port = 5432 +password = icingaweb +username = icingaweb +dbname = icingaweb + +[ido-icinga2] +type = db +db = mysql +host = localhost +port = 3306 +password = icinga2 +username = icinga2 +dbname = icinga2 diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 576c431d6..05f2f098e 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -8,7 +8,7 @@ class icingaweb2_dev { pgsql::database::populate { 'icingaweb': username => 'icingaweb', - password => 'icinga', + password => 'icingaweb', schemafile => '/vagrant/etc/schema/accounts.pgsql.sql', } @@ -53,7 +53,8 @@ class icingaweb2_dev { icingaweb2::config { 'authentication': } icingaweb2::config { 'resources': - replace => false, + source => 'puppet:///modules/icingaweb2_dev', + replace => false, } icingaweb2::config::module { [ 'backends', 'config', 'instances' ]: } From 0fbe0727479396c3c9aab3bc92cacca3e3b52889 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 9 Sep 2014 16:27:26 +0200 Subject: [PATCH 064/238] Profile `icingaweb2_dev': add config file 'authentication.ini' refs #6842 --- .../files/etc/icingaweb/authentication.ini | 13 +++++++++++++ .../profiles/icingaweb2_dev/manifests/init.pp | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/authentication.ini diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/authentication.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/authentication.ini new file mode 100644 index 000000000..2e78afb1b --- /dev/null +++ b/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/authentication.ini @@ -0,0 +1,13 @@ +[autologin] +backend = autologin +; +; If you want to strip the domain +; strip_username_regexp = /\@[^$]+$/ + +[icingaweb-mysql] +backend = db +resource = icingaweb-mysql + +[icingaweb-pgsql] +backend = db +resource = icingaweb-pgsql diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 05f2f098e..8ef6ae57e 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -50,7 +50,9 @@ class icingaweb2_dev { group => 'apache', } - icingaweb2::config { 'authentication': } + icingaweb2::config { 'authentication': + source => 'puppet:///modules/icingaweb2_dev', + } icingaweb2::config { 'resources': source => 'puppet:///modules/icingaweb2_dev', From 07c45914993c975938de00a8497f80f482a082e8 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 9 Sep 2014 16:27:26 +0200 Subject: [PATCH 065/238] Profile `icingaweb2_dev': add config file 'config.ini' refs #6842 --- .../files/etc/icingaweb/config.ini | 25 +++++++++++++++++++ .../profiles/icingaweb2_dev/manifests/init.pp | 8 +----- 2 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 .vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/config.ini diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/config.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/config.ini new file mode 100644 index 000000000..0ec657436 --- /dev/null +++ b/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/config.ini @@ -0,0 +1,25 @@ +[logging] +enable = true +; Writing to a Stream +type = "file" +; Write data to the following file +target = "/vagrant/var/log/icingaweb.log" +; Write data to a PHP stream +;target = "php://output" + +; Writing to the System Log +;type = "syslog" +; Prefix all syslog messages generated with the string "icingaweb" +;application = "icingaweb" +;facility = "LOG_USER" + +level = 3 +; The default level is DEBUG, which means that only events of this level and +; above will be tracked. Level numbers descend in order of importance where +; ERROR (0) is the most important level and DEBUG (3) is the least important +; level: +; +; ERROR = 0 - Error: error conditions +; WARNING = 1 - Warning: warning conditions +; INFO = 2 - Informational: informational messages +; DEBUG = 3 - Debug: debug messages diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 8ef6ae57e..1c9d43d4d 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -32,12 +32,6 @@ class icingaweb2_dev { $cfgpath = '/etc/icingaweb' - file { "${cfgpath}/config.ini": - ensure => file, - owner => 'apache', - group => 'apache', - } - file { [ "${cfgpath}", "${cfgpath}/enabledModules", @@ -54,7 +48,7 @@ class icingaweb2_dev { source => 'puppet:///modules/icingaweb2_dev', } - icingaweb2::config { 'resources': + icingaweb2::config { [ 'resources', 'config' ]: source => 'puppet:///modules/icingaweb2_dev', replace => false, } From 924a511386d93ed1b51a43936201cae619ccdb67 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 9 Sep 2014 16:27:26 +0200 Subject: [PATCH 066/238] Profile `icingaweb2_dev': add config files to 'modules/monitoring' backends.ini config.ini instances.ini refs #6842 --- .../icingaweb/modules/monitoring/backends.ini | 18 ++++++++++++++++++ .../icingaweb/modules/monitoring/config.ini | 2 ++ .../icingaweb/modules/monitoring/instances.ini | 2 ++ .../profiles/icingaweb2_dev/manifests/init.pp | 4 +++- 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 .vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/backends.ini create mode 100644 .vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/config.ini create mode 100644 .vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/instances.ini diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/backends.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/backends.ini new file mode 100644 index 000000000..8b305d50c --- /dev/null +++ b/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/backends.ini @@ -0,0 +1,18 @@ +[localdb] +type = ido +resource = ido + +[locallive] +disabled = 1 +type = livestatus +resource = livestatus + +[localfile] +disabled = 1 +type = statusdat +resource = statusdat + +;[localfailsafe] +;enabled=false +;type = combo +;backends = localdb, locallive, localfile diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/config.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/config.ini new file mode 100644 index 000000000..9b69fe86f --- /dev/null +++ b/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/config.ini @@ -0,0 +1,2 @@ +[security] +protected_customvars = "*pw*,*pass*,community" diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/instances.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/instances.ini new file mode 100644 index 000000000..a47b06629 --- /dev/null +++ b/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/instances.ini @@ -0,0 +1,2 @@ +[icinga] +path = "/var/run/icinga2/cmd/icinga2.cmd" diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 1c9d43d4d..49088c8b7 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -53,5 +53,7 @@ class icingaweb2_dev { replace => false, } - icingaweb2::config::module { [ 'backends', 'config', 'instances' ]: } + icingaweb2::config::module { [ 'backends', 'config', 'instances' ]: + source => 'puppet:///modules/icingaweb2_dev', + } } From 01807c26a777dc3c9e6ce8893745b5bf8a1c4097 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 10:04:27 +0200 Subject: [PATCH 067/238] Add module `grep' refs #6842 --- .vagrant-puppet/modules/grep/manifests/init.pp | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .vagrant-puppet/modules/grep/manifests/init.pp diff --git a/.vagrant-puppet/modules/grep/manifests/init.pp b/.vagrant-puppet/modules/grep/manifests/init.pp new file mode 100644 index 000000000..68366f597 --- /dev/null +++ b/.vagrant-puppet/modules/grep/manifests/init.pp @@ -0,0 +1,11 @@ +# Class: grep +# +# This class installs grep. +# +# Sample Usage: +# +# include grep +# +class grep { + package { 'grep': } +} From 645a2ec3804157e6958056b39b0ae1cb2c720091 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 10:20:22 +0200 Subject: [PATCH 068/238] mysql::database::populate: require module `grep' refs #6842 --- .../modules/mysql/manifests/database/populate.pp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/mysql/manifests/database/populate.pp b/.vagrant-puppet/modules/mysql/manifests/database/populate.pp index 39b819e1e..7099cc4dd 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database/populate.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database/populate.pp @@ -12,6 +12,7 @@ # Requires: # # mysql::database::create +# grep # # Sample Usage: # @@ -23,6 +24,8 @@ # } # define mysql::database::populate ($username, $password, $privileges, $schemafile) { + include grep + Exec { path => '/usr/bin' } mysql::database::create { $name: @@ -34,6 +37,9 @@ define mysql::database::populate ($username, $password, $privileges, $schemafile exec { "populate-${name}-mysql-db": onlyif => "mysql -u${username} -p${password} ${name} -e \"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '${name}';\" 2>/dev/null |grep -qEe '^ *0 *$'", command => "mysql -uroot ${name} < ${schemafile}", - require => Mysql::Database::Create[$name], + require => [ + Mysql::Database::Create[$name], + Class['grep'] + ], } } From 9bb68c42a0169220d92a6c3408c7416f90529877 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 10:06:42 +0200 Subject: [PATCH 069/238] pgsql::database::populate: require module `grep' refs #6842 --- .../modules/pgsql/manifests/database/populate.pp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp index 3bc35b5c7..da7720610 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp @@ -11,6 +11,7 @@ # Requires: # # pgsql::database::create +# grep # # Sample Usage: # @@ -21,6 +22,8 @@ # } # define pgsql::database::populate ($username, $password, $schemafile) { + include grep + Exec { path => '/usr/bin' } pgsql::database::create { $name: @@ -31,6 +34,9 @@ define pgsql::database::populate ($username, $password, $schemafile) { exec { "populate-${name}-pgsql-db": onlyif => "psql -U ${username} -d ${name} -c \"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '${name}';\" 2>/dev/null |grep -qEe '^ *0 *$'", command => "sudo -u postgres psql -U ${username} -d ${name} < ${schemafile}", - require => Pgsql::Database::Create[$name], + require => [ + Pgsql::Database::Create[$name], + Class['grep'] + ], } } From 406f3ba6f7d0a5700121677365ceef0739efe676 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 10:20:22 +0200 Subject: [PATCH 070/238] mysql::database::populate: Exec: add '/bin' to `path' refs #6842 --- .vagrant-puppet/modules/mysql/manifests/database/populate.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/mysql/manifests/database/populate.pp b/.vagrant-puppet/modules/mysql/manifests/database/populate.pp index 7099cc4dd..6b7e780c5 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database/populate.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database/populate.pp @@ -26,7 +26,7 @@ define mysql::database::populate ($username, $password, $privileges, $schemafile) { include grep - Exec { path => '/usr/bin' } + Exec { path => '/bin:/usr/bin' } mysql::database::create { $name: username => $username, From 930416b0dc4476c667d55c4807c4296056714cf5 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 10:20:22 +0200 Subject: [PATCH 071/238] pgsql::database::populate: Exec: add '/bin' to `path' refs #6842 --- .vagrant-puppet/modules/pgsql/manifests/database/populate.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp index da7720610..d37301c85 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp @@ -24,7 +24,7 @@ define pgsql::database::populate ($username, $password, $schemafile) { include grep - Exec { path => '/usr/bin' } + Exec { path => '/bin:/usr/bin' } pgsql::database::create { $name: username => $username, From 260ec95771b3c362df00846a3ce455d00ae3a710 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 11:21:29 +0200 Subject: [PATCH 072/238] Rename `icingaweb2::config' to `icingaweb2::config::general' refs #6842 --- .../icingaweb2/manifests/config/{init.pp => general.pp} | 2 +- .vagrant-puppet/modules/icingaweb2/manifests/config/module.pp | 2 +- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename .vagrant-puppet/modules/icingaweb2/manifests/config/{init.pp => general.pp} (72%) diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config/init.pp b/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp similarity index 72% rename from .vagrant-puppet/modules/icingaweb2/manifests/config/init.pp rename to .vagrant-puppet/modules/icingaweb2/manifests/config/general.pp index a1f364d06..642f43a26 100644 --- a/.vagrant-puppet/modules/icingaweb2/manifests/config/init.pp +++ b/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp @@ -1,4 +1,4 @@ -define icingaweb2::config ($source, $replace = true) { +define icingaweb2::config::general ($source, $replace = true) { $path = "/etc/icingaweb/${name}.ini" file { $path: source => "${source}${path}", diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config/module.pp b/.vagrant-puppet/modules/icingaweb2/manifests/config/module.pp index ece68c025..fe5b6c0cc 100644 --- a/.vagrant-puppet/modules/icingaweb2/manifests/config/module.pp +++ b/.vagrant-puppet/modules/icingaweb2/manifests/config/module.pp @@ -1,5 +1,5 @@ define icingaweb2::config::module ($source, $module = 'monitoring', $replace = true) { - icingaweb2::config { "modules/${module}/${name}": + icingaweb2::config::general { "modules/${module}/${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 49088c8b7..fe50fc9c5 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -44,11 +44,11 @@ class icingaweb2_dev { group => 'apache', } - icingaweb2::config { 'authentication': + icingaweb2::config::general { 'authentication': source => 'puppet:///modules/icingaweb2_dev', } - icingaweb2::config { [ 'resources', 'config' ]: + icingaweb2::config::general { [ 'resources', 'config' ]: source => 'puppet:///modules/icingaweb2_dev', replace => false, } From a33042bcc9ff9c60ce57e70e56877f0189845cce Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 11:27:28 +0200 Subject: [PATCH 073/238] Profile `icingaweb2_dev': add `path' for Exec refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index fe50fc9c5..2aca73772 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -1,4 +1,6 @@ class icingaweb2_dev { + Exec { path => '/bin:/usr/bin' } + mysql::database::populate { 'icingaweb': username => 'icingaweb', password => 'icingaweb', From 5e3f60d42b089dd49fa4946cadb6f6c4b1b5fd00 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 11:38:10 +0200 Subject: [PATCH 074/238] Module `apache': add user `apache' refs #6842 --- .vagrant-puppet/modules/apache/manifests/init.pp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.vagrant-puppet/modules/apache/manifests/init.pp b/.vagrant-puppet/modules/apache/manifests/init.pp index e328ff95f..ed60b838f 100644 --- a/.vagrant-puppet/modules/apache/manifests/init.pp +++ b/.vagrant-puppet/modules/apache/manifests/init.pp @@ -13,20 +13,28 @@ # include apache # class apache { - $apache = $::operatingsystem ? { /(Debian|Ubuntu)/ => 'apache2', /(RedHat|CentOS|Fedora)/ => 'httpd' } + $user = $::operatingsystem ? { + /(Debian|Ubuntu)/ => 'www-data', + /(RedHat|CentOS|Fedora)/ => 'apache' + } + package { $apache: ensure => installed, - alias => 'apache' + alias => 'apache', } service { $apache: ensure => running, alias => 'apache', - require => Package['apache'] + require => Package['apache'], + } + + user { $user: + alias => 'apache', } } From d61e883422f536f2a53e61c815906a74226d1d11 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 11:45:57 +0200 Subject: [PATCH 075/238] icingaweb2::config::general: require module `apache' refs #6842 --- .vagrant-puppet/modules/icingaweb2/manifests/config/general.pp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp b/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp index 642f43a26..c54847b9e 100644 --- a/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp +++ b/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp @@ -1,9 +1,12 @@ define icingaweb2::config::general ($source, $replace = true) { + include apache + $path = "/etc/icingaweb/${name}.ini" file { $path: source => "${source}${path}", owner => 'apache', group => 'apache', replace => $replace, + require => Class['apache'], } } From 65a65ae2b33e23158911ce63ff5ba0449a394179 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 11:45:57 +0200 Subject: [PATCH 076/238] Profile `icingaweb2_dev': require module `apache' refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 2aca73772..d2d25c688 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -1,4 +1,6 @@ class icingaweb2_dev { + include apache + Exec { path => '/bin:/usr/bin' } mysql::database::populate { 'icingaweb': @@ -28,7 +30,6 @@ class icingaweb2_dev { file { '/etc/httpd/conf.d/icingaweb.conf': source => 'puppet:////vagrant/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf', - require => Package['apache'], notify => Service['apache'], } @@ -44,6 +45,7 @@ class icingaweb2_dev { ensure => 'directory', owner => 'apache', group => 'apache', + require => Class['apache'], } icingaweb2::config::general { 'authentication': From 2576a3bc32d06b08180695a65da476f71f939773 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 12:48:22 +0200 Subject: [PATCH 077/238] Module `icinga2_mysql': require `icinga2::config' refs #6842 --- .vagrant-puppet/modules/icinga2_mysql/manifests/init.pp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp b/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp index 8f6ff779f..55e4af58c 100644 --- a/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp @@ -4,9 +4,10 @@ # # Requires: # -# icinga2 # icinga_packages +# icinga2 # icinga2::feature +# icinga2::config # mysql::database::populate # # Sample Usage: @@ -30,10 +31,8 @@ class icinga2_mysql { require => Package['icinga2-ido-mysql'], } - file { '/etc/icinga2/features-available/ido-mysql.conf': - source => 'puppet:///modules/icinga2_mysql/etc/icinga2/features-available/ido-mysql.conf', - owner => 'icinga', - group => 'icinga', + icinga2::config { 'features-available/ido-mysql': + source => 'puppet:///modules/icinga2_mysql', } icinga2::feature { 'ido-mysql': From 203dddbb24474e68b9c630735eeb2ae0900ff91d Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 13:57:37 +0200 Subject: [PATCH 078/238] Module `icinga2_mysql': require `Icinga2::Config[...]' rather than `File[...]' refs #6842 --- .vagrant-puppet/modules/icinga2_mysql/manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp b/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp index 55e4af58c..e82bf19c0 100644 --- a/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp @@ -38,7 +38,7 @@ class icinga2_mysql { icinga2::feature { 'ido-mysql': require => [ Mysql::Database::Populate['icinga2'], - File['/etc/icinga2/features-available/ido-mysql.conf'] + Icinga2::Config['features-available/ido-mysql'], ], } } From a99dbab4d43300474074237dddb0bb017d4b8af3 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 14:10:30 +0200 Subject: [PATCH 079/238] icinga2::feature: don't require Package[icinga2] refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/feature.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/feature.pp b/.vagrant-puppet/modules/icinga2/manifests/feature.pp index 052192a3e..be2acdc93 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/feature.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/feature.pp @@ -17,7 +17,6 @@ define icinga2::feature { path => '/bin:/usr/bin:/sbin:/usr/sbin', unless => "readlink /etc/icinga2/features-enabled/${name}.conf", command => "icinga2-enable-feature ${name}", - require => Package['icinga2'], notify => Service['icinga2'] } } From e124a4254df062339dfa9451e18fc27f2418f4b2 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 14:38:18 +0200 Subject: [PATCH 080/238] icinga2::config: hardcode '/etc/icinga2' once less refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/config.pp | 9 ++++----- .../{etc/icinga2 => }/features-available/ido-mysql.conf | 0 .../files/{etc/icinga2 => }/conf.d/commands.conf | 0 .../files/{etc/icinga2 => }/conf.d/test-config.conf | 0 .../icinga2_dev/files/{etc/icinga2 => }/constants.conf | 0 5 files changed, 4 insertions(+), 5 deletions(-) rename .vagrant-puppet/modules/icinga2_mysql/files/{etc/icinga2 => }/features-available/ido-mysql.conf (100%) rename .vagrant-puppet/profiles/icinga2_dev/files/{etc/icinga2 => }/conf.d/commands.conf (100%) rename .vagrant-puppet/profiles/icinga2_dev/files/{etc/icinga2 => }/conf.d/test-config.conf (100%) rename .vagrant-puppet/profiles/icinga2_dev/files/{etc/icinga2 => }/constants.conf (100%) diff --git a/.vagrant-puppet/modules/icinga2/manifests/config.pp b/.vagrant-puppet/modules/icinga2/manifests/config.pp index a512335b0..160a9de63 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/config.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/config.pp @@ -17,15 +17,14 @@ # } # # Provide configuration file '/etc/icinga2/constants.conf' -# from 'puppet:///modules/icinga2_dev/etc/icinga2/constants.conf' -# ('/path/to/puppet/modules/icinga2_dev/files/etc/icinga2/constants.conf') +# from 'puppet:///modules/icinga2_dev/constants.conf' +# ('/path/to/puppet/modules/icinga2_dev/files/constants.conf') # define icinga2::config ($source) { include icinga2 - $path = "/etc/icinga2/${name}.conf" - file { $path: - source => "${source}${path}", + file { "/etc/icinga2/${name}.conf": + source => "${source}/${name}.conf", owner => 'icinga', group => 'icinga', require => Class['icinga2'], diff --git a/.vagrant-puppet/modules/icinga2_mysql/files/etc/icinga2/features-available/ido-mysql.conf b/.vagrant-puppet/modules/icinga2_mysql/files/features-available/ido-mysql.conf similarity index 100% rename from .vagrant-puppet/modules/icinga2_mysql/files/etc/icinga2/features-available/ido-mysql.conf rename to .vagrant-puppet/modules/icinga2_mysql/files/features-available/ido-mysql.conf diff --git a/.vagrant-puppet/profiles/icinga2_dev/files/etc/icinga2/conf.d/commands.conf b/.vagrant-puppet/profiles/icinga2_dev/files/conf.d/commands.conf similarity index 100% rename from .vagrant-puppet/profiles/icinga2_dev/files/etc/icinga2/conf.d/commands.conf rename to .vagrant-puppet/profiles/icinga2_dev/files/conf.d/commands.conf diff --git a/.vagrant-puppet/profiles/icinga2_dev/files/etc/icinga2/conf.d/test-config.conf b/.vagrant-puppet/profiles/icinga2_dev/files/conf.d/test-config.conf similarity index 100% rename from .vagrant-puppet/profiles/icinga2_dev/files/etc/icinga2/conf.d/test-config.conf rename to .vagrant-puppet/profiles/icinga2_dev/files/conf.d/test-config.conf diff --git a/.vagrant-puppet/profiles/icinga2_dev/files/etc/icinga2/constants.conf b/.vagrant-puppet/profiles/icinga2_dev/files/constants.conf similarity index 100% rename from .vagrant-puppet/profiles/icinga2_dev/files/etc/icinga2/constants.conf rename to .vagrant-puppet/profiles/icinga2_dev/files/constants.conf From 4008b86e33fb8eebb5c06f42fce9721dfad5851f Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 14:59:44 +0200 Subject: [PATCH 081/238] icinga2::feature: replace `exec' with `file' refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/feature.pp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/feature.pp b/.vagrant-puppet/modules/icinga2/manifests/feature.pp index be2acdc93..2aa01c431 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/feature.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/feature.pp @@ -13,10 +13,9 @@ define icinga2::feature { include icinga2 - exec { "icinga2-feature-${name}": - path => '/bin:/usr/bin:/sbin:/usr/sbin', - unless => "readlink /etc/icinga2/features-enabled/${name}.conf", - command => "icinga2-enable-feature ${name}", - notify => Service['icinga2'] + file { "/etc/icinga2/features-enabled/${name}.conf": + ensure => link, + target => "/etc/icinga2/features-available/${name}.conf", + notify => Service['icinga2'], } } From a5b3601d44faef9cfc4d2c8246dba4353eb735c9 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 15:14:14 +0200 Subject: [PATCH 082/238] Make `icinga2::feature' responsible for `icinga2::config' refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/feature.pp | 8 +++++++- .../modules/icinga2_mysql/manifests/init.pp | 10 ++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/feature.pp b/.vagrant-puppet/modules/icinga2/manifests/feature.pp index 2aa01c431..97fd4cbce 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/feature.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/feature.pp @@ -10,9 +10,15 @@ # # icinga2::feature { 'example-feature'; } # -define icinga2::feature { +define icinga2::feature ($source = undef) { include icinga2 + if $source != undef { + icinga2::config { "features-available/${name}": + source => $source, + } + } + file { "/etc/icinga2/features-enabled/${name}.conf": ensure => link, target => "/etc/icinga2/features-available/${name}.conf", diff --git a/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp b/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp index e82bf19c0..1ddc9440e 100644 --- a/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp @@ -31,14 +31,8 @@ class icinga2_mysql { require => Package['icinga2-ido-mysql'], } - icinga2::config { 'features-available/ido-mysql': - source => 'puppet:///modules/icinga2_mysql', - } - icinga2::feature { 'ido-mysql': - require => [ - Mysql::Database::Populate['icinga2'], - Icinga2::Config['features-available/ido-mysql'], - ], + source => 'puppet:///modules/icinga2_mysql', + require => Mysql::Database::Populate['icinga2'], } } From 4a2259a0df921dd6e8ea40b4d852954792fb7fcd Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 15:36:42 +0200 Subject: [PATCH 083/238] Module `icinga2': notify Service[...] rather than requiring (the whole) Class[...] refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/config.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/config.pp b/.vagrant-puppet/modules/icinga2/manifests/config.pp index 160a9de63..d710ddc1a 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/config.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/config.pp @@ -27,6 +27,6 @@ define icinga2::config ($source) { source => "${source}/${name}.conf", owner => 'icinga', group => 'icinga', - require => Class['icinga2'], + notify => Service['icinga2'], } } From a82bafc07baf5d0f519413e606644cb69aafcedc Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 16:58:06 +0200 Subject: [PATCH 084/238] Make `icinga2::config' responsible for parent directory creation refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/config.pp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/config.pp b/.vagrant-puppet/modules/icinga2/manifests/config.pp index d710ddc1a..c62c84cbd 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/config.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/config.pp @@ -23,10 +23,19 @@ define icinga2::config ($source) { include icinga2 - file { "/etc/icinga2/${name}.conf": + $path = "/etc/icinga2/${name}.conf" + $cmd = "mkdir-p-for-${path}" + + exec { $cmd: + command => "mkdir -p \"\$(dirname \"\$(readlink -m '${path}')\")\"", + path => '/bin:/usr/bin', + } + + file { $path: source => "${source}/${name}.conf", owner => 'icinga', group => 'icinga', notify => Service['icinga2'], + require => Exec[$cmd], } } From de4380e233cb01a2c2170d3dd93ddc08706d34a2 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 17:02:36 +0200 Subject: [PATCH 085/238] Module `icinga2': add user `icinga' refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/config.pp | 5 ++++- .vagrant-puppet/modules/icinga2/manifests/init.pp | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/config.pp b/.vagrant-puppet/modules/icinga2/manifests/config.pp index c62c84cbd..604d5772e 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/config.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/config.pp @@ -36,6 +36,9 @@ define icinga2::config ($source) { owner => 'icinga', group => 'icinga', notify => Service['icinga2'], - require => Exec[$cmd], + require => [ + Exec[$cmd], + User['icinga'] + ], } } diff --git a/.vagrant-puppet/modules/icinga2/manifests/init.pp b/.vagrant-puppet/modules/icinga2/manifests/init.pp index c22e82b92..1ef272e1c 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/init.pp @@ -27,4 +27,8 @@ class icinga2 { } icinga2::feature { [ 'statusdata', 'command', 'compatlog' ]: } + + user { 'icinga': + ensure => present, + } } From 413634280e3e409de891f23840ea9d0bb566979d Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 17:49:17 +0200 Subject: [PATCH 086/238] Exec: prefer "user => ..." rather than "command => 'sudo -u ..." refs #6842 --- .../modules/pgsql/manifests/database/create.pp | 9 +++++---- .../modules/pgsql/manifests/database/populate.pp | 3 ++- .../profiles/icingaweb2_dev/manifests/init.pp | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.vagrant-puppet/modules/pgsql/manifests/database/create.pp b/.vagrant-puppet/modules/pgsql/manifests/database/create.pp index 8e36fe7ea..97fcb163d 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database/create.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database/create.pp @@ -22,10 +22,11 @@ define pgsql::database::create ($username, $password) { include pgsql exec { "create-pgsql-${name}-db": - unless => "sudo -u postgres psql -tAc \"SELECT 1 FROM pg_roles WHERE rolname='${username}'\" | grep -q 1", - command => "sudo -u postgres psql -c \"CREATE ROLE ${username} WITH LOGIN PASSWORD '${password}';\" && \ -sudo -u postgres createdb -O ${username} -E UTF8 -T template0 ${name} && \ -sudo -u postgres createlang plpgsql ${name}", + unless => "psql -tAc \"SELECT 1 FROM pg_roles WHERE rolname='${username}'\" | grep -q 1", + command => "psql -c \"CREATE ROLE ${username} WITH LOGIN PASSWORD '${password}';\" && \ +createdb -O ${username} -E UTF8 -T template0 ${name} && \ +createlang plpgsql ${name}", + user => 'postgres', require => Class['pgsql'] } } diff --git a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp index d37301c85..03950f281 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp @@ -33,7 +33,8 @@ define pgsql::database::populate ($username, $password, $schemafile) { exec { "populate-${name}-pgsql-db": onlyif => "psql -U ${username} -d ${name} -c \"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '${name}';\" 2>/dev/null |grep -qEe '^ *0 *$'", - command => "sudo -u postgres psql -U ${username} -d ${name} < ${schemafile}", + command => "psql -U ${username} -d ${name} < ${schemafile}", + user => 'postgres', require => [ Pgsql::Database::Create[$name], Class['grep'] diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index d2d25c688..caa6eefc7 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -24,7 +24,8 @@ class icingaweb2_dev { exec { 'populate-icingweb-pgsql-db-preferences': unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM preference;" &> /dev/null', - command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/preferences.pgsql.sql', + command => 'psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/preferences.pgsql.sql', + user => 'postgres', require => Pgsql::Database::Populate['icingaweb'], } From 03100d0d9af6b67e7d47129f07b204e6e2b0ab3c Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 18:02:00 +0200 Subject: [PATCH 087/238] icinga2::config: outsource parent directory creation into module `parent_dirs' refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/config.pp | 8 ++------ .vagrant-puppet/modules/parent_dirs/manifests/init.pp | 6 ++++++ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 .vagrant-puppet/modules/parent_dirs/manifests/init.pp diff --git a/.vagrant-puppet/modules/icinga2/manifests/config.pp b/.vagrant-puppet/modules/icinga2/manifests/config.pp index 604d5772e..db804bc64 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/config.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/config.pp @@ -24,12 +24,8 @@ define icinga2::config ($source) { include icinga2 $path = "/etc/icinga2/${name}.conf" - $cmd = "mkdir-p-for-${path}" - exec { $cmd: - command => "mkdir -p \"\$(dirname \"\$(readlink -m '${path}')\")\"", - path => '/bin:/usr/bin', - } + parent_dirs { $path: } file { $path: source => "${source}/${name}.conf", @@ -37,7 +33,7 @@ define icinga2::config ($source) { group => 'icinga', notify => Service['icinga2'], require => [ - Exec[$cmd], + Parent_dirs[$path], User['icinga'] ], } diff --git a/.vagrant-puppet/modules/parent_dirs/manifests/init.pp b/.vagrant-puppet/modules/parent_dirs/manifests/init.pp new file mode 100644 index 000000000..e7a044dee --- /dev/null +++ b/.vagrant-puppet/modules/parent_dirs/manifests/init.pp @@ -0,0 +1,6 @@ +define parent_dirs { + exec { "parent_dirs-${name}": + command => "mkdir -p \"\$(dirname \"\$(readlink -m '${name}')\")\"", + path => '/bin:/usr/bin', + } +} From d5bfb3dbdaffb50489517b894e16d40bba1c4a08 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 18:14:32 +0200 Subject: [PATCH 088/238] Make `icinga2::feature' responsible for parent directory creation refs #6842 --- .../modules/icinga2/manifests/feature.pp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/feature.pp b/.vagrant-puppet/modules/icinga2/manifests/feature.pp index 97fd4cbce..ec6b5e91c 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/feature.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/feature.pp @@ -13,15 +13,22 @@ define icinga2::feature ($source = undef) { include icinga2 + $target = "features-available/${name}" + $cfgpath = '/etc/icinga2' + $path = "${cfgpath}/features-enabled/${name}.conf" + if $source != undef { - icinga2::config { "features-available/${name}": + icinga2::config { $target: source => $source, } } - file { "/etc/icinga2/features-enabled/${name}.conf": - ensure => link, - target => "/etc/icinga2/features-available/${name}.conf", - notify => Service['icinga2'], + parent_dirs { $path: } + + file { $path: + ensure => link, + target => "${cfgpath}/${target}.conf", + require => Parent_dirs[$path], + notify => Service['icinga2'], } } From e5ca8eb6261abc96824ab87547a79b0a6a86959a Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 18:27:27 +0200 Subject: [PATCH 089/238] Profile `icingaweb2_dev': include php refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index caa6eefc7..19150b411 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -1,5 +1,6 @@ class icingaweb2_dev { include apache + include php Exec { path => '/bin:/usr/bin' } From 0b1f3183adad93813128a7cab0636533d0e9d98f Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 10 Sep 2014 18:41:49 +0200 Subject: [PATCH 090/238] Make `icingaweb2::config::general' responsible for parent directory creation refs #6842 --- .../icingaweb2/manifests/config/general.pp | 3 +++ .../profiles/icingaweb2_dev/manifests/init.pp | 15 --------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp b/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp index c54847b9e..0f5f05eec 100644 --- a/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp +++ b/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp @@ -2,6 +2,9 @@ define icingaweb2::config::general ($source, $replace = true) { include apache $path = "/etc/icingaweb/${name}.ini" + + parent_dirs { $path: } + file { $path: source => "${source}${path}", owner => 'apache', diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 19150b411..250e38465 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -35,21 +35,6 @@ class icingaweb2_dev { notify => Service['apache'], } - $cfgpath = '/etc/icingaweb' - - file { [ - "${cfgpath}", - "${cfgpath}/enabledModules", - "${cfgpath}/modules", - "${cfgpath}/modules/monitoring", - "${cfgpath}/modules/doc" - ]: - ensure => 'directory', - owner => 'apache', - group => 'apache', - require => Class['apache'], - } - icingaweb2::config::general { 'authentication': source => 'puppet:///modules/icingaweb2_dev', } From dc28f53033ebbef16f3fe9e8c2b6f76677952f6b Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 10:18:18 +0200 Subject: [PATCH 091/238] Revert "pgsql::database::populate: require module `grep'" This reverts commit 9bb68c42a0169220d92a6c3408c7416f90529877. Conflicts: .vagrant-puppet/modules/pgsql/manifests/database/populate.pp --- .../modules/pgsql/manifests/database/populate.pp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp index 03950f281..8663ff3f1 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp @@ -11,7 +11,6 @@ # Requires: # # pgsql::database::create -# grep # # Sample Usage: # @@ -22,8 +21,6 @@ # } # define pgsql::database::populate ($username, $password, $schemafile) { - include grep - Exec { path => '/bin:/usr/bin' } pgsql::database::create { $name: @@ -35,9 +32,6 @@ define pgsql::database::populate ($username, $password, $schemafile) { onlyif => "psql -U ${username} -d ${name} -c \"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '${name}';\" 2>/dev/null |grep -qEe '^ *0 *$'", command => "psql -U ${username} -d ${name} < ${schemafile}", user => 'postgres', - require => [ - Pgsql::Database::Create[$name], - Class['grep'] - ], + require => Pgsql::Database::Create[$name], } } From d892ae56709b4370982bf7eb20c3faa3c6f319a3 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 10:20:59 +0200 Subject: [PATCH 092/238] Revert "mysql::database::populate: require module `grep'" This reverts commit 645a2ec3804157e6958056b39b0ae1cb2c720091. Conflicts: .vagrant-puppet/modules/mysql/manifests/database/populate.pp --- .../modules/mysql/manifests/database/populate.pp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.vagrant-puppet/modules/mysql/manifests/database/populate.pp b/.vagrant-puppet/modules/mysql/manifests/database/populate.pp index 6b7e780c5..dc54a0800 100644 --- a/.vagrant-puppet/modules/mysql/manifests/database/populate.pp +++ b/.vagrant-puppet/modules/mysql/manifests/database/populate.pp @@ -12,7 +12,6 @@ # Requires: # # mysql::database::create -# grep # # Sample Usage: # @@ -24,8 +23,6 @@ # } # define mysql::database::populate ($username, $password, $privileges, $schemafile) { - include grep - Exec { path => '/bin:/usr/bin' } mysql::database::create { $name: @@ -37,9 +34,6 @@ define mysql::database::populate ($username, $password, $privileges, $schemafile exec { "populate-${name}-mysql-db": onlyif => "mysql -u${username} -p${password} ${name} -e \"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '${name}';\" 2>/dev/null |grep -qEe '^ *0 *$'", command => "mysql -uroot ${name} < ${schemafile}", - require => [ - Mysql::Database::Create[$name], - Class['grep'] - ], + require => Mysql::Database::Create[$name], } } From 8881d96f6b95e1c602bfa052e1a34aec060247cb Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 10:21:27 +0200 Subject: [PATCH 093/238] Revert "Add module `grep'" This reverts commit 01807c26a777dc3c9e6ce8893745b5bf8a1c4097. --- .vagrant-puppet/modules/grep/manifests/init.pp | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 .vagrant-puppet/modules/grep/manifests/init.pp diff --git a/.vagrant-puppet/modules/grep/manifests/init.pp b/.vagrant-puppet/modules/grep/manifests/init.pp deleted file mode 100644 index 68366f597..000000000 --- a/.vagrant-puppet/modules/grep/manifests/init.pp +++ /dev/null @@ -1,11 +0,0 @@ -# Class: grep -# -# This class installs grep. -# -# Sample Usage: -# -# include grep -# -class grep { - package { 'grep': } -} From d22e251b5931cd3d7075b2cdedd3fdf5bc82c95f Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 10:28:05 +0200 Subject: [PATCH 094/238] Add module/class `zend_framework' refs #6842 --- .../modules/zend_framework/manifests/init.pp | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .vagrant-puppet/modules/zend_framework/manifests/init.pp diff --git a/.vagrant-puppet/modules/zend_framework/manifests/init.pp b/.vagrant-puppet/modules/zend_framework/manifests/init.pp new file mode 100644 index 000000000..1e54259b1 --- /dev/null +++ b/.vagrant-puppet/modules/zend_framework/manifests/init.pp @@ -0,0 +1,24 @@ +# Class: zend_framework +# +# This class installs the Zend Framework. +# +# Requires: +# +# epel +# +# Sample Usage: +# +# include zend_framework +# +class zend_framework { + include epel + + package { [ + 'php-ZendFramework', + 'php-ZendFramework-Db-Adapter-Pdo-Mysql', + 'php-ZendFramework-Db-Adapter-Pdo-Pgsql' + ]: + ensure => latest, + require => Class['epel'], + } +} From a4384b6dd3ded96c70ae5252a252d3bc8d4264a3 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 10:30:06 +0200 Subject: [PATCH 095/238] Profile `icingaweb2_dev': include zend_framework refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 250e38465..7ee71c297 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -1,6 +1,7 @@ class icingaweb2_dev { include apache include php + include zend_framework Exec { path => '/bin:/usr/bin' } From 6b03f5851f02469623b6a4254dfe90c279d49a82 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 10:47:01 +0200 Subject: [PATCH 096/238] Enable Yumrepo[epel] refs #6842 --- .vagrant-puppet/modules/epel/manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/epel/manifests/init.pp b/.vagrant-puppet/modules/epel/manifests/init.pp index 65e0a2603..9ec1ba692 100644 --- a/.vagrant-puppet/modules/epel/manifests/init.pp +++ b/.vagrant-puppet/modules/epel/manifests/init.pp @@ -16,7 +16,7 @@ class epel { yumrepo { 'epel': mirrorlist => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=${::architecture}", - enabled => '0', + enabled => '1', gpgcheck => '0', descr => "Extra Packages for Enterprise Linux 6 - ${::architecture}" } From cad539aa59cd9850db27273c8bfa7eb75ed7851a Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 11:17:51 +0200 Subject: [PATCH 097/238] Profile `icingaweb2_dev': install Package[php-pdo] refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 7ee71c297..c5d5073ce 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -3,6 +3,11 @@ class icingaweb2_dev { include php include zend_framework + package { 'php-pdo': + ensure => latest, + notify => Service['apache'], + } + Exec { path => '/bin:/usr/bin' } mysql::database::populate { 'icingaweb': From 6b8c477b30477f797a544511cbfbc5d51e51d6b4 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 11:30:24 +0200 Subject: [PATCH 098/238] Profile `icingaweb2_dev': notify Service[apache] after installing ZendFramework refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index c5d5073ce..62fcdc251 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -1,7 +1,10 @@ class icingaweb2_dev { include apache include php - include zend_framework + + class { 'zend_framework': + notify => Service['apache'], + } package { 'php-pdo': ensure => latest, From 97f88fbe7405ca15840785d75089a6da279fd682 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 11:53:20 +0200 Subject: [PATCH 099/238] Profile `icingaweb2_dev': enable 'monitoring' module via icingacli refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 62fcdc251..1fcacd933 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -1,6 +1,7 @@ class icingaweb2_dev { include apache include php + include icinga_packages class { 'zend_framework': notify => Service['apache'], @@ -11,6 +12,13 @@ class icingaweb2_dev { notify => Service['apache'], } + package { 'icingacli': + ensure => latest, + require => Class['icinga_packages'], + } -> exec { 'enable-monitoring-module': + command => 'icingacli module enable monitoring', + } + Exec { path => '/bin:/usr/bin' } mysql::database::populate { 'icingaweb': From 8ad9c7f10a2e49ae699360cc2c10fc785a4aefdd Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 12:10:18 +0200 Subject: [PATCH 100/238] Rename resource `ido-icinga2' -> `ido' refs #6842 --- .../profiles/icingaweb2_dev/files/etc/icingaweb/resources.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/resources.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/resources.ini index 6b304b934..ac6c6a03c 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/resources.ini +++ b/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/resources.ini @@ -16,7 +16,7 @@ password = icingaweb username = icingaweb dbname = icingaweb -[ido-icinga2] +[ido] type = db db = mysql host = localhost From b0b18d02c2af16c85ce872bc92fdd3f2e90d6cf3 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 15:59:00 +0200 Subject: [PATCH 101/238] cpan: avoid `sudo' refs #6842 --- .vagrant-puppet/modules/cpan/manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/cpan/manifests/init.pp b/.vagrant-puppet/modules/cpan/manifests/init.pp index 4b9ca9d27..30be5b069 100644 --- a/.vagrant-puppet/modules/cpan/manifests/init.pp +++ b/.vagrant-puppet/modules/cpan/manifests/init.pp @@ -43,7 +43,7 @@ define cpan( } exec { "cpan-${name}": - command => "sudo perl -MCPAN -e 'install ${name}'", + command => "perl -MCPAN -e 'install ${name}'", creates => $creates, require => File['/root/.cpan/CPAN/MyConfig.pm'], timeout => $timeout From e7fad2c123f6a7f81b3be6edc7ca517571d8ccaa Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 16:00:46 +0200 Subject: [PATCH 102/238] cpan: disable timeout by default refs #6842 --- .vagrant-puppet/modules/cpan/manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/cpan/manifests/init.pp b/.vagrant-puppet/modules/cpan/manifests/init.pp index 30be5b069..ec54219af 100644 --- a/.vagrant-puppet/modules/cpan/manifests/init.pp +++ b/.vagrant-puppet/modules/cpan/manifests/init.pp @@ -21,7 +21,7 @@ # define cpan( $creates, - $timeout + $timeout = 0 ) { Exec { path => '/usr/bin' } From a6c7fe21ea95115656e96573e34a9d4e4733fb37 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 16:01:31 +0200 Subject: [PATCH 103/238] cmmi: disable timeout by default refs #6842 --- .vagrant-puppet/modules/cmmi/manifests/init.pp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.vagrant-puppet/modules/cmmi/manifests/init.pp b/.vagrant-puppet/modules/cmmi/manifests/init.pp index f83cd53ca..58e1cc129 100644 --- a/.vagrant-puppet/modules/cmmi/manifests/init.pp +++ b/.vagrant-puppet/modules/cmmi/manifests/init.pp @@ -25,7 +25,6 @@ # flags => '--prefix=/opt/example-software', # creates => '/opt/example-software', # make => 'make && make install' -# make_timeout => 600 # } # define cmmi( @@ -34,7 +33,7 @@ define cmmi( $creates, $make, $flags='', - $make_timeout=300, + $make_timeout=0, $configure_command='sh ./configure' ) { From ab71049dae9b3323e4fbb0e7087078b38fa1e190 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 16:01:31 +0200 Subject: [PATCH 104/238] cmmi: add default value for parameter `make' 'make && make install' refs #6842 --- .vagrant-puppet/modules/cmmi/manifests/init.pp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.vagrant-puppet/modules/cmmi/manifests/init.pp b/.vagrant-puppet/modules/cmmi/manifests/init.pp index 58e1cc129..5534be843 100644 --- a/.vagrant-puppet/modules/cmmi/manifests/init.pp +++ b/.vagrant-puppet/modules/cmmi/manifests/init.pp @@ -24,14 +24,13 @@ # output => 'example-software.tar.gz', # flags => '--prefix=/opt/example-software', # creates => '/opt/example-software', -# make => 'make && make install' # } # define cmmi( $url, $output, $creates, - $make, + $make='make && make install', $flags='', $make_timeout=0, $configure_command='sh ./configure' From 22d155b1da319e73b8b698affb9dea78be640def Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 16:51:04 +0200 Subject: [PATCH 105/238] Add module/class `perl' refs #6842 --- .../modules/perl/manifests/init.pp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .vagrant-puppet/modules/perl/manifests/init.pp diff --git a/.vagrant-puppet/modules/perl/manifests/init.pp b/.vagrant-puppet/modules/perl/manifests/init.pp new file mode 100644 index 000000000..8f4a09d55 --- /dev/null +++ b/.vagrant-puppet/modules/perl/manifests/init.pp @@ -0,0 +1,20 @@ +# Class: perl +# +# This class installs perl. +# +# Sample Usage: +# +# include perl +# +class perl { + $perl = 'perl-5.20.0' + $perlDir = '/opt/perl' + + cmmi { $perl: + url => "http://www.cpan.org/src/5.0/${perl}.tar.gz", + output => "${perl}.tar.gz", + creates => $perlDir, + configure_command => 'sh ./Configure', + flags => "-des -Dprefix=${perlDir}", + } +} From 8c00c6d464b5ebe334500cd8690c6277c7af007f Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 16:18:14 +0200 Subject: [PATCH 106/238] Add module/class `tar' refs #6842 --- .vagrant-puppet/modules/tar/manifests/init.pp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .vagrant-puppet/modules/tar/manifests/init.pp diff --git a/.vagrant-puppet/modules/tar/manifests/init.pp b/.vagrant-puppet/modules/tar/manifests/init.pp new file mode 100644 index 000000000..518c53e0c --- /dev/null +++ b/.vagrant-puppet/modules/tar/manifests/init.pp @@ -0,0 +1,13 @@ +# Class: tar +# +# This class installs tar. +# +# Sample Usage: +# +# include tar +# +class tar { + package { 'tar': + ensure => installed, + } +} From 6db2e4e1d18f73c78a381168e1b55871746dbeb0 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 17:04:19 +0200 Subject: [PATCH 107/238] cmmi: require Class[tar] refs #6842 --- .vagrant-puppet/modules/cmmi/manifests/init.pp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/cmmi/manifests/init.pp b/.vagrant-puppet/modules/cmmi/manifests/init.pp index 5534be843..948076a01 100644 --- a/.vagrant-puppet/modules/cmmi/manifests/init.pp +++ b/.vagrant-puppet/modules/cmmi/manifests/init.pp @@ -17,6 +17,8 @@ # # Requires: # +# tar +# # Sample Usage: # # cmmi { 'example-software': @@ -41,6 +43,7 @@ define cmmi( $cwd = '/usr/local/src' include wget + include tar exec { "download-${name}": cwd => $cwd, @@ -58,7 +61,10 @@ define cmmi( --no-same-permissions -xzf ${output} -C ${name}/${tld} \ --strip-components 1", creates => $src, - require => Exec["download-${name}"] + require => [ + Exec["download-${name}"], + Class['tar'] + ], } exec { "configure-${name}": From 0a2fbf4aeecda872f3618f14d794d64601f7b0b6 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 17:21:08 +0200 Subject: [PATCH 108/238] Add module/class `gcc' refs #6842 --- .vagrant-puppet/modules/gcc/manifests/init.pp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .vagrant-puppet/modules/gcc/manifests/init.pp diff --git a/.vagrant-puppet/modules/gcc/manifests/init.pp b/.vagrant-puppet/modules/gcc/manifests/init.pp new file mode 100644 index 000000000..63ab314e6 --- /dev/null +++ b/.vagrant-puppet/modules/gcc/manifests/init.pp @@ -0,0 +1,13 @@ +# Class: gcc +# +# This class installs gcc. +# +# Sample Usage: +# +# include gcc +# +class gcc { + package { 'gcc': + ensure => installed, + } +} From bb716e8a49bbe70377fc21ca9ab7bd0f2bb37ae2 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 17:40:18 +0200 Subject: [PATCH 109/238] cmmi: require Class[gcc] refs #6842 --- .vagrant-puppet/modules/cmmi/manifests/init.pp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/cmmi/manifests/init.pp b/.vagrant-puppet/modules/cmmi/manifests/init.pp index 948076a01..128d00fc6 100644 --- a/.vagrant-puppet/modules/cmmi/manifests/init.pp +++ b/.vagrant-puppet/modules/cmmi/manifests/init.pp @@ -17,7 +17,9 @@ # # Requires: # +# wget # tar +# gcc # # Sample Usage: # @@ -44,6 +46,7 @@ define cmmi( include wget include tar + include gcc exec { "download-${name}": cwd => $cwd, @@ -78,7 +81,10 @@ define cmmi( cwd => $src, command => $make, creates => $creates, - require => Exec["configure-${name}"], + require => [ + Exec["configure-${name}"], + Class['gcc'] + ], timeout => $make_timeout } } From eea9ee8a67cd477ee4cefa8c51bf9db11c6b2020 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 18:02:30 +0200 Subject: [PATCH 110/238] perl: create link '/usr/local/bin/perl' to perl binary refs #6842 --- .vagrant-puppet/modules/perl/manifests/init.pp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.vagrant-puppet/modules/perl/manifests/init.pp b/.vagrant-puppet/modules/perl/manifests/init.pp index 8f4a09d55..c3fcb5fea 100644 --- a/.vagrant-puppet/modules/perl/manifests/init.pp +++ b/.vagrant-puppet/modules/perl/manifests/init.pp @@ -16,5 +16,8 @@ class perl { creates => $perlDir, configure_command => 'sh ./Configure', flags => "-des -Dprefix=${perlDir}", + } -> file { '/usr/local/bin/perl': + ensure => link, + target => "${perlDir}/bin/perl", } } From c29eb0d123263ab04d16e514df3840e52193c3e6 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 11 Sep 2014 18:34:22 +0200 Subject: [PATCH 111/238] cpan: require Class[perl] refs #6842 --- .../modules/cpan/manifests/init.pp | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.vagrant-puppet/modules/cpan/manifests/init.pp b/.vagrant-puppet/modules/cpan/manifests/init.pp index ec54219af..ea7653826 100644 --- a/.vagrant-puppet/modules/cpan/manifests/init.pp +++ b/.vagrant-puppet/modules/cpan/manifests/init.pp @@ -10,7 +10,7 @@ # # Requires: # -# Perl +# perl # # Sample Usage: # @@ -23,12 +23,7 @@ define cpan( $creates, $timeout = 0 ) { - - Exec { path => '/usr/bin' } - - package { 'perl-CPAN': - ensure => installed - } + include perl file { [ '/root/.cpan/', '/root/.cpan/CPAN/' ]: ensure => directory @@ -36,16 +31,17 @@ define cpan( file { '/root/.cpan/CPAN/MyConfig.pm': content => template('cpan/MyConfig.pm.erb'), - require => [ - Package['perl-CPAN'], - File[[ '/root/.cpan/', '/root/.cpan/CPAN/' ]] - ] + require => File[[ '/root/.cpan/', '/root/.cpan/CPAN/' ]], } exec { "cpan-${name}": command => "perl -MCPAN -e 'install ${name}'", creates => $creates, - require => File['/root/.cpan/CPAN/MyConfig.pm'], + path => '/usr/local/bin:/usr/bin', + require => [ + Class['perl'], + File['/root/.cpan/CPAN/MyConfig.pm'] + ], timeout => $timeout } } From fa8584059a79d46fc9fc21b36726f789ace60162 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 12 Sep 2014 10:55:12 +0200 Subject: [PATCH 112/238] Add module/class `git' refs #6842 --- .vagrant-puppet/modules/git/manifests/init.pp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .vagrant-puppet/modules/git/manifests/init.pp diff --git a/.vagrant-puppet/modules/git/manifests/init.pp b/.vagrant-puppet/modules/git/manifests/init.pp new file mode 100644 index 000000000..08cb8635c --- /dev/null +++ b/.vagrant-puppet/modules/git/manifests/init.pp @@ -0,0 +1,13 @@ +# Class: git +# +# This class installs git. +# +# Sample Usage: +# +# include git +# +class git { + package { 'git': + ensure => installed, + } +} From 4a5accea0b958748bc91ae2f0eca471a8a0124d1 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 12 Sep 2014 11:42:09 +0200 Subject: [PATCH 113/238] Add module/class `cmmi_dir' refs #6842 --- .../modules/cmmi_dir/manifests/init.pp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .vagrant-puppet/modules/cmmi_dir/manifests/init.pp diff --git a/.vagrant-puppet/modules/cmmi_dir/manifests/init.pp b/.vagrant-puppet/modules/cmmi_dir/manifests/init.pp new file mode 100644 index 000000000..33d2f7eec --- /dev/null +++ b/.vagrant-puppet/modules/cmmi_dir/manifests/init.pp @@ -0,0 +1,15 @@ +define cmmi_dir ( + $configure='./configure', + $make='make && make install' +) { + Exec { + path => '/usr/bin:/bin', + cwd => "/usr/local/src/${name}", + } + + exec { "configure-${name}": + command => $configure, + } -> exec { "make-${name}": + command => $make, + } +} From 24c3a30dba59094f19580565d2a89ce22fdb9231 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 12 Sep 2014 11:42:09 +0200 Subject: [PATCH 114/238] Add module/class `git_cmmi' refs #6842 --- .../modules/git_cmmi/manifests/init.pp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .vagrant-puppet/modules/git_cmmi/manifests/init.pp diff --git a/.vagrant-puppet/modules/git_cmmi/manifests/init.pp b/.vagrant-puppet/modules/git_cmmi/manifests/init.pp new file mode 100644 index 000000000..b98894f11 --- /dev/null +++ b/.vagrant-puppet/modules/git_cmmi/manifests/init.pp @@ -0,0 +1,17 @@ +define git_cmmi ( + $url, + $configure='./configure', + $make='make && make install' +) { + include git + + exec { "git-clone-${name}": + cwd => '/usr/local/src', + path => '/usr/bin:/bin', + command => "git clone '${url}' '${name}'", + require => Class['git'], + } -> cmmi_dir { $name: + configure => $configure, + make => $make, + } +} From 17db985a37fcbe750db1ed2eb9d96b710f9de4c2 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 12 Sep 2014 13:23:44 +0200 Subject: [PATCH 115/238] Profile `icinga2_dev': include monitoring_plugins and monitoring_test_config refs #6842 --- .vagrant-puppet/profiles/icinga2_dev/manifests/init.pp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp index 94e97f7b2..8f63013ff 100644 --- a/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp @@ -13,6 +13,8 @@ # class icinga2_dev { include icinga2_mysql + include monitoring_plugins + include monitoring_test_config icinga2::config { [ 'conf.d/test-config', 'conf.d/commands', 'constants' ]: From ec9c174139e1f1bcd9bf84faaf49c0c0067bba07 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 12 Sep 2014 18:59:20 +0200 Subject: [PATCH 116/238] icingaweb2::config::general: hardcode '/etc/icingaweb' once less refs #6842 --- .vagrant-puppet/modules/icingaweb2/manifests/config/general.pp | 2 +- .../icingaweb2_dev/files/{etc/icingaweb => }/authentication.ini | 0 .../icingaweb2_dev/files/{etc/icingaweb => }/config.ini | 0 .../files/{etc/icingaweb => }/modules/monitoring/backends.ini | 0 .../files/{etc/icingaweb => }/modules/monitoring/config.ini | 0 .../files/{etc/icingaweb => }/modules/monitoring/instances.ini | 0 .../icingaweb2_dev/files/{etc/icingaweb => }/resources.ini | 0 7 files changed, 1 insertion(+), 1 deletion(-) rename .vagrant-puppet/profiles/icingaweb2_dev/files/{etc/icingaweb => }/authentication.ini (100%) rename .vagrant-puppet/profiles/icingaweb2_dev/files/{etc/icingaweb => }/config.ini (100%) rename .vagrant-puppet/profiles/icingaweb2_dev/files/{etc/icingaweb => }/modules/monitoring/backends.ini (100%) rename .vagrant-puppet/profiles/icingaweb2_dev/files/{etc/icingaweb => }/modules/monitoring/config.ini (100%) rename .vagrant-puppet/profiles/icingaweb2_dev/files/{etc/icingaweb => }/modules/monitoring/instances.ini (100%) rename .vagrant-puppet/profiles/icingaweb2_dev/files/{etc/icingaweb => }/resources.ini (100%) diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp b/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp index 0f5f05eec..4d9f79a36 100644 --- a/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp +++ b/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp @@ -6,7 +6,7 @@ define icingaweb2::config::general ($source, $replace = true) { parent_dirs { $path: } file { $path: - source => "${source}${path}", + source => "${source}/${name}.ini", owner => 'apache', group => 'apache', replace => $replace, diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/authentication.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/authentication.ini similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/authentication.ini rename to .vagrant-puppet/profiles/icingaweb2_dev/files/authentication.ini diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/config.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/config.ini similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/config.ini rename to .vagrant-puppet/profiles/icingaweb2_dev/files/config.ini diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/backends.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/backends.ini rename to .vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/config.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/config.ini similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/config.ini rename to .vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/config.ini diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/instances.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/instances.ini similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/modules/monitoring/instances.ini rename to .vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/instances.ini diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/resources.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/resources.ini similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/files/etc/icingaweb/resources.ini rename to .vagrant-puppet/profiles/icingaweb2_dev/files/resources.ini From 1f547aa1ec2422f6d44b2b3c476cf3815f11c03d Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 12 Sep 2014 19:03:17 +0200 Subject: [PATCH 117/238] Profile `icingaweb2_dev': add user `apache' to group `icingacmd' refs #6842 --- .../profiles/icingaweb2_dev/manifests/init.pp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 1fcacd933..ee9108844 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -19,6 +19,15 @@ class icingaweb2_dev { command => 'icingacli module enable monitoring', } + exec { 'usermod -aG icingacmd apache': + command => '/usr/sbin/usermod -aG icingacmd apache', + require => [ + Package['icingacli'], + User['apache'] + ], + notify => Service['apache'], + } + Exec { path => '/bin:/usr/bin' } mysql::database::populate { 'icingaweb': From f5a232f3a756694062b8a3a465e97129cea8b7cf Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 12 Sep 2014 19:08:01 +0200 Subject: [PATCH 118/238] Update 'resources.ini' refs #6842 --- .../files/etc/icingaweb/resources.ini | 56 ++++++++----------- packages/rpm/etc/icingaweb/resources.ini | 50 ++++++++--------- 2 files changed, 48 insertions(+), 58 deletions(-) diff --git a/.vagrant-puppet/files/etc/icingaweb/resources.ini b/.vagrant-puppet/files/etc/icingaweb/resources.ini index 3935906eb..ac6c6a03c 100644 --- a/.vagrant-puppet/files/etc/icingaweb/resources.ini +++ b/.vagrant-puppet/files/etc/icingaweb/resources.ini @@ -1,34 +1,26 @@ -[internal_db] -type = db -db = mysql -host = localhost -port = 3306 -password = icingaweb -username = icingaweb -dbname = icingaweb +[icingaweb-mysql] +type = db +db = mysql +host = localhost +port = 3306 +password = icingaweb +username = icingaweb +dbname = icingaweb + +[icingaweb-pgsql] +type = db +db = pgsql +host = localhost +port = 5432 +password = icingaweb +username = icingaweb +dbname = icingaweb [ido] -type = db -db = mysql -host = localhost -port = 3306 -password = icinga2 -username = icinga2 -dbname = icinga2 - -[statusdat] -type = statusdat -status_file = /usr/local/icinga-mysql/var/status.dat -object_file = /usr/local/icinga-mysql/var/objects.cache - -[livestatus] -type = livestatus -socket = /usr/local/icinga-mysql/var/rw/live - -[internal_ldap] -type = ldap -hostname = localhost -port = 389 -root_dn = "ou=people, dc=icinga, dc=org" -bind_dn = "cn=admin,cn=config" -bind_pw = admin +type = db +db = mysql +host = localhost +port = 3306 +password = icinga2 +username = icinga2 +dbname = icinga2 diff --git a/packages/rpm/etc/icingaweb/resources.ini b/packages/rpm/etc/icingaweb/resources.ini index 1c1e62eb1..ac6c6a03c 100644 --- a/packages/rpm/etc/icingaweb/resources.ini +++ b/packages/rpm/etc/icingaweb/resources.ini @@ -1,28 +1,26 @@ -[internal_db] -type = db -db = mysql -host = localhost -port = 3306 -password = icingaweb -username = icingaweb -dbname = icingaweb +[icingaweb-mysql] +type = db +db = mysql +host = localhost +port = 3306 +password = icingaweb +username = icingaweb +dbname = icingaweb + +[icingaweb-pgsql] +type = db +db = pgsql +host = localhost +port = 5432 +password = icingaweb +username = icingaweb +dbname = icingaweb [ido] -type = db -db = mysql -host = localhost -port = 3306 -password = icinga -username = icinga -dbname = icinga - -[livestatus] -type = livestatus -socket = /var/run/icinga2/cmd/livestatus - -[logfile] -type = file -filename = "/var/log/icingaweb/icingaweb.log" -fields = "/^(?[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}(\\+[0-9]{2}:[0-9]{2})?) - (?[A-Za-z]+) - (?.*)$/" -; format: PCRE -; +type = db +db = mysql +host = localhost +port = 3306 +password = icinga2 +username = icinga2 +dbname = icinga2 From d09e65b7be73483f2ac98c36c886cae9c78459a7 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 15 Sep 2014 11:16:47 +0200 Subject: [PATCH 119/238] icinga2_mysql: change requirement syntax refs #6842 --- .vagrant-puppet/modules/icinga2_mysql/manifests/init.pp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp b/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp index 1ddc9440e..acef7a5c1 100644 --- a/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp @@ -22,17 +22,13 @@ class icinga2_mysql { ensure => latest, require => Class['icinga_packages'], } - - mysql::database::populate { 'icinga2': + -> mysql::database::populate { 'icinga2': username => 'icinga2', password => 'icinga2', privileges => 'SELECT,INSERT,UPDATE,DELETE', schemafile => '/usr/share/icinga2-ido-mysql/schema/mysql.sql', - require => Package['icinga2-ido-mysql'], } - - icinga2::feature { 'ido-mysql': + -> icinga2::feature { 'ido-mysql': source => 'puppet:///modules/icinga2_mysql', - require => Mysql::Database::Populate['icinga2'], } } From c573123f3fe34e262c3cb8e24ba8adce9f342bd6 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 15 Sep 2014 11:21:03 +0200 Subject: [PATCH 120/238] icinga2: add File[icinga2cfgDir] refs #6842 --- .../modules/icinga2/manifests/init.pp | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/init.pp b/.vagrant-puppet/modules/icinga2/manifests/init.pp index 1ef272e1c..98538b121 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/init.pp @@ -14,21 +14,27 @@ class icinga2 { include icinga_packages - service { 'icinga2': - ensure => running, - enable => true, - require => Package['icinga2'] - } - package { [ - 'icinga2', 'icinga2-doc', 'icinga2-debuginfo' ]: + 'icinga2', 'icinga2-doc', 'icinga2-debuginfo' + ]: ensure => latest, require => Class['icinga_packages'], } - - icinga2::feature { [ 'statusdata', 'command', 'compatlog' ]: } - - user { 'icinga': + -> service { 'icinga2': + ensure => running, + enable => true, + } + -> user { 'icinga': ensure => present, } + -> file { 'icinga2cfgDir': + path => '/etc/icinga2', + ensure => directory, + links => follow, + owner => 'icinga', + group => 'icinga', + mode => 6750, + } + + icinga2::feature { [ 'statusdata', 'command', 'compatlog' ]: } } From 99f2abe651522fee3c69da20d33c7e5ec8c12d1b Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 15 Sep 2014 11:26:14 +0200 Subject: [PATCH 121/238] Add module `monitoring_test_config' refs #6842 --- .../monitoring_test_config/manifests/init.pp | 25 +++++++++++++++++++ .../manifests/populate_plugins.pp | 17 +++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .vagrant-puppet/modules/monitoring_test_config/manifests/init.pp create mode 100644 .vagrant-puppet/modules/monitoring_test_config/manifests/populate_plugins.pp diff --git a/.vagrant-puppet/modules/monitoring_test_config/manifests/init.pp b/.vagrant-puppet/modules/monitoring_test_config/manifests/init.pp new file mode 100644 index 000000000..65ac53ec7 --- /dev/null +++ b/.vagrant-puppet/modules/monitoring_test_config/manifests/init.pp @@ -0,0 +1,25 @@ +class monitoring_test_config { + package { [ + 'perl', + 'perl-Module-Install', + 'perl-CPAN', + 'perl-File-Which', + 'perl-Time-HiRes' + ]: + ensure => latest, + } + -> git_cmmi { 'Monitoring-Generator-TestConfig': + url => 'https://github.com/sni/Monitoring-Generator-TestConfig.git', + configure => 'perl Makefile.PL', + make => 'make && make test && make install', + } + -> exec { 'create_monitoring_test_config': + path => '/usr/local/bin:/usr/bin:/bin', + command => 'install -o root -g root -d /usr/local/share/misc/ && \ +create_monitoring_test_config.pl -l icinga /usr/local/share/misc/monitoring_test_config', + creates => '/usr/local/share/misc/monitoring_test_config', + } + -> monitoring_test_config::populate_plugins { [ + 'test_hostcheck.pl', 'test_servicecheck.pl' + ]: } +} diff --git a/.vagrant-puppet/modules/monitoring_test_config/manifests/populate_plugins.pp b/.vagrant-puppet/modules/monitoring_test_config/manifests/populate_plugins.pp new file mode 100644 index 000000000..347e4b127 --- /dev/null +++ b/.vagrant-puppet/modules/monitoring_test_config/manifests/populate_plugins.pp @@ -0,0 +1,17 @@ +define monitoring_test_config::populate_plugins { + include icinga2 + include monitoring_plugins + include monitoring_test_config + + file { "/usr/lib64/nagios/plugins/${name}": + owner => 'icinga', + group => 'icinga', + source => "/usr/local/share/misc/monitoring_test_config/plugins/${name}", + require => [ + User['icinga'], + Exec['create_monitoring_test_config'], + Class['monitoring_plugins'] + ], + notify => Service['icinga2'], + } +} From 6a2dfb4b17d1a887d681afca6371c9d1f855e44a Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 15 Sep 2014 11:39:27 +0200 Subject: [PATCH 122/238] icinga2::config: require File[icinga2cfgDir] refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/config.pp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/config.pp b/.vagrant-puppet/modules/icinga2/manifests/config.pp index db804bc64..e02d8c851 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/config.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/config.pp @@ -25,16 +25,14 @@ define icinga2::config ($source) { $path = "/etc/icinga2/${name}.conf" - parent_dirs { $path: } - - file { $path: + parent_dirs { $path: + require => File['icinga2cfgDir'], + } + -> file { $path: source => "${source}/${name}.conf", owner => 'icinga', group => 'icinga', notify => Service['icinga2'], - require => [ - Parent_dirs[$path], - User['icinga'] - ], + require => User['icinga'], } } From d45f729ce569cd2a5c18be4f506b6e7c6486d169 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 15 Sep 2014 12:12:21 +0200 Subject: [PATCH 123/238] icinga2::feature: require File[icinga2cfgDir] refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/feature.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/feature.pp b/.vagrant-puppet/modules/icinga2/manifests/feature.pp index ec6b5e91c..089ac3500 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/feature.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/feature.pp @@ -23,12 +23,12 @@ define icinga2::feature ($source = undef) { } } - parent_dirs { $path: } - - file { $path: + parent_dirs { $path: + require => File['icinga2cfgDir'], + } + -> file { $path: ensure => link, target => "${cfgpath}/${target}.conf", - require => Parent_dirs[$path], notify => Service['icinga2'], } } From b6671c84fd47d010d4c96d2b48a80eac11287213 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 15 Sep 2014 12:23:09 +0200 Subject: [PATCH 124/238] Add Class[icingaweb2] w/ File[icingaweb2cfgDir] refs #6842 --- .../modules/icingaweb2/manifests/init.pp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .vagrant-puppet/modules/icingaweb2/manifests/init.pp diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/init.pp b/.vagrant-puppet/modules/icingaweb2/manifests/init.pp new file mode 100644 index 000000000..9b6c5a3a3 --- /dev/null +++ b/.vagrant-puppet/modules/icingaweb2/manifests/init.pp @@ -0,0 +1,13 @@ +class icingaweb2 { + include apache + + file { 'icingaweb2cfgDir': + path => '/etc/icingaweb', + ensure => directory, + links => follow, + owner => 'apache', + group => 'apache', + mode => 6750, + require => Class['apache'], + } +} From d7a0be72e208af6a5653c869db587ed11d8a438f Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 15 Sep 2014 12:26:06 +0200 Subject: [PATCH 125/238] icingaweb2::config::general: require File[icingaweb2cfgDir] (from Class[icingaweb2]) refs #6842 --- .../modules/icingaweb2/manifests/config/general.pp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp b/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp index 4d9f79a36..647f53d0c 100644 --- a/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp +++ b/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp @@ -1,11 +1,13 @@ define icingaweb2::config::general ($source, $replace = true) { include apache + include icingaweb2 $path = "/etc/icingaweb/${name}.ini" - parent_dirs { $path: } - - file { $path: + parent_dirs { $path: + require => File['icingaweb2cfgDir'], + } + -> file { $path: source => "${source}/${name}.ini", owner => 'apache', group => 'apache', From b6de74b1a96278afc50c0bcd52b3b7880e208335 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 15 Sep 2014 13:03:52 +0200 Subject: [PATCH 126/238] icinga2: Service[icinga2]: require User[icinga] refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/init.pp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/init.pp b/.vagrant-puppet/modules/icinga2/manifests/init.pp index 98538b121..0545ba7c5 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/init.pp @@ -23,8 +23,10 @@ class icinga2 { -> service { 'icinga2': ensure => running, enable => true, + require => User['icinga'], } - -> user { 'icinga': + + user { 'icinga': ensure => present, } -> file { 'icinga2cfgDir': From 8fd3b940094acc380dac1d2d59a8522f02535eda Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 15 Sep 2014 13:35:14 +0200 Subject: [PATCH 127/238] icingaweb2_dev: add File[/etc/icingaweb/enabledModules] refs #6842 --- .../profiles/icingaweb2_dev/manifests/init.pp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index ee9108844..36c48f17b 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -2,6 +2,7 @@ class icingaweb2_dev { include apache include php include icinga_packages + include icingaweb2 class { 'zend_framework': notify => Service['apache'], @@ -15,8 +16,21 @@ class icingaweb2_dev { package { 'icingacli': ensure => latest, require => Class['icinga_packages'], - } -> exec { 'enable-monitoring-module': + } + + file { '/etc/icingaweb/enabledModules': + ensure => directory, + owner => 'apache', + group => 'apache', + mode => 6750, + require => [ + Class['apache'], + File['icingaweb2cfgDir'] + ], + } + -> exec { 'enable-monitoring-module': command => 'icingacli module enable monitoring', + require => Package['icingacli'], } exec { 'usermod -aG icingacmd apache': From fbdeb777707c608a38c0e28558383bf36076f124 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 15 Sep 2014 14:00:24 +0200 Subject: [PATCH 128/238] parent_dirs: add parameter $user refs #6842 --- .vagrant-puppet/modules/icinga2/manifests/config.pp | 6 +++++- .vagrant-puppet/modules/icinga2/manifests/feature.pp | 6 +++++- .../modules/icingaweb2/manifests/config/general.pp | 6 +++++- .vagrant-puppet/modules/parent_dirs/manifests/init.pp | 3 ++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.vagrant-puppet/modules/icinga2/manifests/config.pp b/.vagrant-puppet/modules/icinga2/manifests/config.pp index e02d8c851..cbdba06c0 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/config.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/config.pp @@ -26,7 +26,11 @@ define icinga2::config ($source) { $path = "/etc/icinga2/${name}.conf" parent_dirs { $path: - require => File['icinga2cfgDir'], + user => 'icinga', + require => [ + User['icinga'], + File['icinga2cfgDir'] + ], } -> file { $path: source => "${source}/${name}.conf", diff --git a/.vagrant-puppet/modules/icinga2/manifests/feature.pp b/.vagrant-puppet/modules/icinga2/manifests/feature.pp index 089ac3500..cfba05a9f 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/feature.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/feature.pp @@ -24,7 +24,11 @@ define icinga2::feature ($source = undef) { } parent_dirs { $path: - require => File['icinga2cfgDir'], + user => 'icinga', + require => [ + User['icinga'], + File['icinga2cfgDir'] + ], } -> file { $path: ensure => link, diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp b/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp index 647f53d0c..4e86afbfc 100644 --- a/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp +++ b/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp @@ -5,7 +5,11 @@ define icingaweb2::config::general ($source, $replace = true) { $path = "/etc/icingaweb/${name}.ini" parent_dirs { $path: - require => File['icingaweb2cfgDir'], + user => 'apache', + require => [ + Class['apache'], + File['icingaweb2cfgDir'] + ], } -> file { $path: source => "${source}/${name}.ini", diff --git a/.vagrant-puppet/modules/parent_dirs/manifests/init.pp b/.vagrant-puppet/modules/parent_dirs/manifests/init.pp index e7a044dee..a8952e781 100644 --- a/.vagrant-puppet/modules/parent_dirs/manifests/init.pp +++ b/.vagrant-puppet/modules/parent_dirs/manifests/init.pp @@ -1,6 +1,7 @@ -define parent_dirs { +define parent_dirs ($user = 'root') { exec { "parent_dirs-${name}": command => "mkdir -p \"\$(dirname \"\$(readlink -m '${name}')\")\"", path => '/bin:/usr/bin', + user => $user, } } From 5b1377e5dff3f8be7efa70db93aaf20cd8bd48cd Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 15 Sep 2014 14:20:13 +0200 Subject: [PATCH 129/238] Enable module 'monitoring' as user 'apache' refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 36c48f17b..b193c47e4 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -30,7 +30,11 @@ class icingaweb2_dev { } -> exec { 'enable-monitoring-module': command => 'icingacli module enable monitoring', - require => Package['icingacli'], + user => 'apache', + require => [ + Package['icingacli'], + Class['apache'] + ], } exec { 'usermod -aG icingacmd apache': From 616a95550c889c991cc7fcf265c927dc2f983a92 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 15 Sep 2014 14:35:28 +0200 Subject: [PATCH 130/238] Add module/class `icingacli' refs #6842 --- .vagrant-puppet/modules/icingacli/manifests/init.pp | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .vagrant-puppet/modules/icingacli/manifests/init.pp diff --git a/.vagrant-puppet/modules/icingacli/manifests/init.pp b/.vagrant-puppet/modules/icingacli/manifests/init.pp new file mode 100644 index 000000000..7eef7833a --- /dev/null +++ b/.vagrant-puppet/modules/icingacli/manifests/init.pp @@ -0,0 +1,11 @@ +class icingacli { + file { '/usr/local/bin/icingacli': + ensure => link, + target => '/vagrant/bin/icingacli', + } + + file { '/etc/bash_completion.d/icingacli': + ensure => link, + target => '/vagrant/etc/bash_completion.d/icingacli', + } +} From 72d74c113230acf35dd1b0eefee859e1d808ab32 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 15 Sep 2014 14:42:54 +0200 Subject: [PATCH 131/238] Replace Package[icingacli] w/ Class[icingacli] refs #6842 --- .../profiles/icingaweb2_dev/manifests/init.pp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index b193c47e4..36b6aa26e 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -1,8 +1,8 @@ class icingaweb2_dev { include apache include php - include icinga_packages include icingaweb2 + include icingacli class { 'zend_framework': notify => Service['apache'], @@ -13,10 +13,7 @@ class icingaweb2_dev { notify => Service['apache'], } - package { 'icingacli': - ensure => latest, - require => Class['icinga_packages'], - } + Exec { path => '/usr/local/bin:/usr/bin:/bin' } file { '/etc/icingaweb/enabledModules': ensure => directory, @@ -31,23 +28,18 @@ class icingaweb2_dev { -> exec { 'enable-monitoring-module': command => 'icingacli module enable monitoring', user => 'apache', - require => [ - Package['icingacli'], - Class['apache'] - ], + require => Class[[ 'icingacli', 'apache' ]], } exec { 'usermod -aG icingacmd apache': command => '/usr/sbin/usermod -aG icingacmd apache', require => [ - Package['icingacli'], + Class['icingacli'], User['apache'] ], notify => Service['apache'], } - Exec { path => '/bin:/usr/bin' } - mysql::database::populate { 'icingaweb': username => 'icingaweb', password => 'icingaweb', From 8135ccaa95a83f0a38e0e53cad1ef147d50e9f09 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 15 Sep 2014 16:17:04 +0200 Subject: [PATCH 132/238] icingaweb2_dev: change log file path to '/var/log/icingaweb.log' refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/files/config.ini | 2 +- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/config.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/config.ini index 0ec657436..5d8a44574 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/files/config.ini +++ b/.vagrant-puppet/profiles/icingaweb2_dev/files/config.ini @@ -3,7 +3,7 @@ enable = true ; Writing to a Stream type = "file" ; Write data to the following file -target = "/vagrant/var/log/icingaweb.log" +target = "/var/log/icingaweb.log" ; Write data to a PHP stream ;target = "php://output" diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 36b6aa26e..5c2a9ea0c 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -40,6 +40,13 @@ class icingaweb2_dev { notify => Service['apache'], } + file { '/var/log/icingaweb.log': + ensure => file, + owner => 'apache', + group => 'apache', + require => Class['apache'], + } + mysql::database::populate { 'icingaweb': username => 'icingaweb', password => 'icingaweb', From eef13ea667fc2a8c6c818ffbfe434d92b2e3f7f6 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 15 Sep 2014 16:17:04 +0200 Subject: [PATCH 133/238] icingaweb2_dev: add Group[icingacmd] refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 5c2a9ea0c..cb0085bd5 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -31,7 +31,10 @@ class icingaweb2_dev { require => Class[[ 'icingacli', 'apache' ]], } - exec { 'usermod -aG icingacmd apache': + group { 'icingacmd': + ensure => present, + } + -> exec { 'usermod -aG icingacmd apache': command => '/usr/sbin/usermod -aG icingacmd apache', require => [ Class['icingacli'], From d87058c555a9445fb2ddbb0b257f0528175323d3 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 30 Sep 2014 10:59:30 +0200 Subject: [PATCH 134/238] Profile `icingaweb2_dev': add Exec[iptables-allow-http] refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index cb0085bd5..55f3edfb6 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -93,4 +93,12 @@ class icingaweb2_dev { icingaweb2::config::module { [ 'backends', 'config', 'instances' ]: source => 'puppet:///modules/icingaweb2_dev', } + + package { 'iptables': + ensure => latest + } + -> exec { 'iptables-allow-http': + unless => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables', + command => '/sbin/iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && /sbin/iptables-save > /etc/sysconfig/iptables' + } } From 7c6672fc36a2b3cba9ccea5bd2b38ffecb33da70 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 30 Sep 2014 12:04:48 +0200 Subject: [PATCH 135/238] Enable Service[apache] refs #6842 --- .vagrant-puppet/modules/apache/manifests/init.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/.vagrant-puppet/modules/apache/manifests/init.pp b/.vagrant-puppet/modules/apache/manifests/init.pp index ed60b838f..917c7578f 100644 --- a/.vagrant-puppet/modules/apache/manifests/init.pp +++ b/.vagrant-puppet/modules/apache/manifests/init.pp @@ -30,6 +30,7 @@ class apache { service { $apache: ensure => running, + enable => true, alias => 'apache', require => Package['apache'], } From 3c10d471cd3a18de1f168d6a69399daa3c5ec6f0 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 20 Oct 2014 15:56:00 +0200 Subject: [PATCH 136/238] Update `icingaweb2_dev' profile's file 'config.ini' refs #6842 --- .../profiles/icingaweb2_dev/files/config.ini | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/config.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/config.ini index 5d8a44574..296915abe 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/files/config.ini +++ b/.vagrant-puppet/profiles/icingaweb2_dev/files/config.ini @@ -1,25 +1,26 @@ [logging] -enable = true ; Writing to a Stream -type = "file" +log = "file" ; Write data to the following file -target = "/var/log/icingaweb.log" +file = "/var/log/icingaweb.log" ; Write data to a PHP stream -;target = "php://output" +;file = "php://output" ; Writing to the System Log -;type = "syslog" +;log = "syslog" ; Prefix all syslog messages generated with the string "icingaweb" -;application = "icingaweb" -;facility = "LOG_USER" +;application = "icingaweb" +;facility = "LOG_USER" -level = 3 -; The default level is DEBUG, which means that only events of this level and -; above will be tracked. Level numbers descend in order of importance where -; ERROR (0) is the most important level and DEBUG (3) is the least important -; level: +level = ERROR +; The default level is ERROR, which means that only events of this level (and +; above) will be tracked. Level names descend in order of importance where +; ERROR is the most important level and DEBUG is the least important level: ; -; ERROR = 0 - Error: error conditions -; WARNING = 1 - Warning: warning conditions -; INFO = 2 - Informational: informational messages -; DEBUG = 3 - Debug: debug messages +; ERROR - Error: error conditions +; WARNING - Warning: warning conditions +; INFO - Informational: informational messages +; DEBUG - Debug: debug messages + +[preferences] +type = "ini" From 81d49db56608866b39ca6257c594a1563cba72dc Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 20 Oct 2014 16:12:14 +0200 Subject: [PATCH 137/238] icingaweb2_dev: provide Package[php-ldap] refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 55f3edfb6..c0db2f7df 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -8,7 +8,7 @@ class icingaweb2_dev { notify => Service['apache'], } - package { 'php-pdo': + package { [ 'php-pdo', 'php-ldap' ]: ensure => latest, notify => Service['apache'], } From 82226066c61e4a9ef5c416fee3e72ea0c37eb3bc Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 21 Oct 2014 12:19:32 +0200 Subject: [PATCH 138/238] Set php.ini's date.timezone = "UTC" refs #6842 --- .vagrant-puppet/modules/php/manifests/init.pp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.vagrant-puppet/modules/php/manifests/init.pp b/.vagrant-puppet/modules/php/manifests/init.pp index 1a8e31746..efb0a9946 100644 --- a/.vagrant-puppet/modules/php/manifests/init.pp +++ b/.vagrant-puppet/modules/php/manifests/init.pp @@ -23,6 +23,10 @@ class php { require => Package['apache'], notify => Service['apache'] } + -> exec { 'php-timezone': + command => 'sed -re $\'s#^;?(date\\.timezone =).*$#\\1 "UTC"#\' -i /etc/php.ini', + notify => Service['apache'], + } file { '/etc/php.d/error_reporting.ini': content => template('php/error_reporting.ini.erb'), From a4c4f50113c1b04d63b730813e02035abd7a7bae Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 21 Oct 2014 12:22:17 +0200 Subject: [PATCH 139/238] icingaweb2_dev: iptables: descend index of insertion refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index c0db2f7df..3d8e0ac83 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -99,6 +99,6 @@ class icingaweb2_dev { } -> exec { 'iptables-allow-http': unless => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables', - command => '/sbin/iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && /sbin/iptables-save > /etc/sysconfig/iptables' + command => '/sbin/iptables -I INPUT 1 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && /sbin/iptables-save > /etc/sysconfig/iptables' } } From ba368f0af5c49f93ef562f9d11c580e26466f8ae Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 30 Oct 2014 14:02:48 +0100 Subject: [PATCH 140/238] Change Icinga Web 2's cfg dir's mode 6750 -> 6755 refs #6842 --- .vagrant-puppet/modules/icingaweb2/manifests/init.pp | 2 +- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/init.pp b/.vagrant-puppet/modules/icingaweb2/manifests/init.pp index 9b6c5a3a3..cc2fd588a 100644 --- a/.vagrant-puppet/modules/icingaweb2/manifests/init.pp +++ b/.vagrant-puppet/modules/icingaweb2/manifests/init.pp @@ -7,7 +7,7 @@ class icingaweb2 { links => follow, owner => 'apache', group => 'apache', - mode => 6750, + mode => 6755, require => Class['apache'], } } diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 3d8e0ac83..0075e41b2 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -19,7 +19,7 @@ class icingaweb2_dev { ensure => directory, owner => 'apache', group => 'apache', - mode => 6750, + mode => 6755, require => [ Class['apache'], File['icingaweb2cfgDir'] From 9471cede3f7b278cf6f8a8f5224b5804ad8e43e4 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 30 Oct 2014 16:57:17 +0100 Subject: [PATCH 141/238] icingaweb2_dev: add Package[php-phpunit-PHPUnit] refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 0075e41b2..22ac43e74 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -101,4 +101,8 @@ class icingaweb2_dev { unless => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables', command => '/sbin/iptables -I INPUT 1 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && /sbin/iptables-save > /etc/sysconfig/iptables' } + + package { 'php-phpunit-PHPUnit': + ensure => latest + } } From 38c97587a4fd9254268739b52940e8f71cabef5e Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 30 Oct 2014 17:03:09 +0100 Subject: [PATCH 142/238] icingaweb2_dev: enable `test' module refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 22ac43e74..2d953c75e 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -30,6 +30,10 @@ class icingaweb2_dev { user => 'apache', require => Class[[ 'icingacli', 'apache' ]], } + -> exec { 'enable-test-module': + command => 'icingacli module enable test', + user => 'apache' + } group { 'icingacmd': ensure => present, From 64445ae887335824b8eaec78fd910fa253c0215e Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Thu, 30 Oct 2014 17:25:41 +0100 Subject: [PATCH 143/238] icingaweb2_dev: add Package[icinga-gui] refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 2d953c75e..e3271d989 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -8,7 +8,7 @@ class icingaweb2_dev { notify => Service['apache'], } - package { [ 'php-pdo', 'php-ldap' ]: + package { [ 'php-pdo', 'php-ldap', 'php-phpunit-PHPUnit', 'icinga-gui' ]: ensure => latest, notify => Service['apache'], } @@ -105,8 +105,4 @@ class icingaweb2_dev { unless => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables', command => '/sbin/iptables -I INPUT 1 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && /sbin/iptables-save > /etc/sysconfig/iptables' } - - package { 'php-phpunit-PHPUnit': - ensure => latest - } } From 30ee6c9411b3d17ec1330d065cd6a77c8f5c6398 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 24 Nov 2014 14:42:07 +0100 Subject: [PATCH 144/238] Ensure that every package's latest version is installed refs #6842 --- .vagrant-puppet/modules/apache/manifests/init.pp | 2 +- .vagrant-puppet/modules/gcc/manifests/init.pp | 2 +- .vagrant-puppet/modules/git/manifests/init.pp | 2 +- .../modules/monitoring_plugins/manifests/init.pp | 2 +- .vagrant-puppet/modules/mysql/manifests/init.pp | 9 ++++----- .vagrant-puppet/modules/openldap/manifests/init.pp | 2 +- .vagrant-puppet/modules/pear/manifests/init.pp | 2 +- .vagrant-puppet/modules/pgsql/manifests/init.pp | 9 ++++----- .vagrant-puppet/modules/php/manifests/init.pp | 2 +- .vagrant-puppet/modules/tar/manifests/init.pp | 2 +- .vagrant-puppet/modules/wget/manifests/init.pp | 2 +- 11 files changed, 17 insertions(+), 19 deletions(-) diff --git a/.vagrant-puppet/modules/apache/manifests/init.pp b/.vagrant-puppet/modules/apache/manifests/init.pp index 917c7578f..b3465757f 100644 --- a/.vagrant-puppet/modules/apache/manifests/init.pp +++ b/.vagrant-puppet/modules/apache/manifests/init.pp @@ -24,7 +24,7 @@ class apache { } package { $apache: - ensure => installed, + ensure => latest, alias => 'apache', } diff --git a/.vagrant-puppet/modules/gcc/manifests/init.pp b/.vagrant-puppet/modules/gcc/manifests/init.pp index 63ab314e6..f11538e2d 100644 --- a/.vagrant-puppet/modules/gcc/manifests/init.pp +++ b/.vagrant-puppet/modules/gcc/manifests/init.pp @@ -8,6 +8,6 @@ # class gcc { package { 'gcc': - ensure => installed, + ensure => latest, } } diff --git a/.vagrant-puppet/modules/git/manifests/init.pp b/.vagrant-puppet/modules/git/manifests/init.pp index 08cb8635c..9143e9f69 100644 --- a/.vagrant-puppet/modules/git/manifests/init.pp +++ b/.vagrant-puppet/modules/git/manifests/init.pp @@ -8,6 +8,6 @@ # class git { package { 'git': - ensure => installed, + ensure => latest, } } diff --git a/.vagrant-puppet/modules/monitoring_plugins/manifests/init.pp b/.vagrant-puppet/modules/monitoring_plugins/manifests/init.pp index 23b9f19d4..64d080d11 100644 --- a/.vagrant-puppet/modules/monitoring_plugins/manifests/init.pp +++ b/.vagrant-puppet/modules/monitoring_plugins/manifests/init.pp @@ -3,7 +3,7 @@ class monitoring_plugins { # nagios plugins from epel package { 'nagios-plugins-all': - ensure => installed, + ensure => latest, require => Class['epel'] } } diff --git a/.vagrant-puppet/modules/mysql/manifests/init.pp b/.vagrant-puppet/modules/mysql/manifests/init.pp index b96b6ac5d..a235a540c 100644 --- a/.vagrant-puppet/modules/mysql/manifests/init.pp +++ b/.vagrant-puppet/modules/mysql/manifests/init.pp @@ -16,11 +16,10 @@ class mysql { Exec { path => '/usr/bin' } - package { - 'mysql': - ensure => installed; - 'mysql-server': - ensure => installed; + package { [ + 'mysql', 'mysql-server' + ]: + ensure => latest, } service { 'mysqld': diff --git a/.vagrant-puppet/modules/openldap/manifests/init.pp b/.vagrant-puppet/modules/openldap/manifests/init.pp index 187a5f57b..069c4a157 100644 --- a/.vagrant-puppet/modules/openldap/manifests/init.pp +++ b/.vagrant-puppet/modules/openldap/manifests/init.pp @@ -15,7 +15,7 @@ class openldap { package { ['openldap-servers', 'openldap-clients']: - ensure => installed + ensure => latest, } service { 'slapd': diff --git a/.vagrant-puppet/modules/pear/manifests/init.pp b/.vagrant-puppet/modules/pear/manifests/init.pp index 0c748f2bc..59f204457 100644 --- a/.vagrant-puppet/modules/pear/manifests/init.pp +++ b/.vagrant-puppet/modules/pear/manifests/init.pp @@ -21,7 +21,7 @@ class pear { include php package { 'php-pear': - ensure => installed, + ensure => latest, require => Class['php'] } diff --git a/.vagrant-puppet/modules/pgsql/manifests/init.pp b/.vagrant-puppet/modules/pgsql/manifests/init.pp index 36e12bb11..4b48cf895 100644 --- a/.vagrant-puppet/modules/pgsql/manifests/init.pp +++ b/.vagrant-puppet/modules/pgsql/manifests/init.pp @@ -17,11 +17,10 @@ class pgsql { Exec { path => '/sbin:/bin:/usr/bin' } - package { - 'postgresql': - ensure => installed; - 'postgresql-server': - ensure => installed; + package { [ + 'postgresql', 'postgresql-server' + ]: + ensure => latest, } exec { 'initdb': diff --git a/.vagrant-puppet/modules/php/manifests/init.pp b/.vagrant-puppet/modules/php/manifests/init.pp index efb0a9946..2c9c33619 100644 --- a/.vagrant-puppet/modules/php/manifests/init.pp +++ b/.vagrant-puppet/modules/php/manifests/init.pp @@ -19,7 +19,7 @@ class php { include apache package { 'php': - ensure => installed, + ensure => latest, require => Package['apache'], notify => Service['apache'] } diff --git a/.vagrant-puppet/modules/tar/manifests/init.pp b/.vagrant-puppet/modules/tar/manifests/init.pp index 518c53e0c..acf85eab1 100644 --- a/.vagrant-puppet/modules/tar/manifests/init.pp +++ b/.vagrant-puppet/modules/tar/manifests/init.pp @@ -8,6 +8,6 @@ # class tar { package { 'tar': - ensure => installed, + ensure => latest, } } diff --git a/.vagrant-puppet/modules/wget/manifests/init.pp b/.vagrant-puppet/modules/wget/manifests/init.pp index 560e10b2f..ad1efd399 100644 --- a/.vagrant-puppet/modules/wget/manifests/init.pp +++ b/.vagrant-puppet/modules/wget/manifests/init.pp @@ -15,6 +15,6 @@ class wget { package { 'wget': - ensure => installed, + ensure => latest, } } From 607b0fc0c4c46b717b3d138eddad42ca357ba1ff Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Mon, 24 Nov 2014 14:44:17 +0100 Subject: [PATCH 145/238] icingaweb2_dev: include and require Class[icinga_packages] refs #6842 --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index e3271d989..aa2d1317f 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -3,6 +3,7 @@ class icingaweb2_dev { include php include icingaweb2 include icingacli + include icinga_packages class { 'zend_framework': notify => Service['apache'], @@ -11,6 +12,7 @@ class icingaweb2_dev { package { [ 'php-pdo', 'php-ldap', 'php-phpunit-PHPUnit', 'icinga-gui' ]: ensure => latest, notify => Service['apache'], + require => Class['icinga_packages'], } Exec { path => '/usr/local/bin:/usr/bin:/bin' } From c982ef4f9afeb2a9c400ff87cbdb74f1dd74d16c Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 30 Sep 2014 11:41:34 +0200 Subject: [PATCH 146/238] Add successor for '.vagrant-puppet/manifests/default.pp' refs #7321 --- .vagrant-puppet/manifests/successor.pp | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .vagrant-puppet/manifests/successor.pp diff --git a/.vagrant-puppet/manifests/successor.pp b/.vagrant-puppet/manifests/successor.pp new file mode 100644 index 000000000..80abad8ef --- /dev/null +++ b/.vagrant-puppet/manifests/successor.pp @@ -0,0 +1,2 @@ +include icinga2_dev +include icingaweb2_dev From a1ccd01776bd7647e5d7ed9dedc67f158b66afae Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 25 Nov 2014 11:48:12 +0100 Subject: [PATCH 147/238] Rename default.pp -> default.pp.old --- .vagrant-puppet/manifests/{default.pp => default.pp.old} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .vagrant-puppet/manifests/{default.pp => default.pp.old} (100%) diff --git a/.vagrant-puppet/manifests/default.pp b/.vagrant-puppet/manifests/default.pp.old similarity index 100% rename from .vagrant-puppet/manifests/default.pp rename to .vagrant-puppet/manifests/default.pp.old From de8dc64b69de6117562e0500fddcf662ac0aab80 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 25 Nov 2014 11:49:59 +0100 Subject: [PATCH 148/238] Rename successor.pp -> default.pp --- .vagrant-puppet/manifests/{successor.pp => default.pp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .vagrant-puppet/manifests/{successor.pp => default.pp} (100%) diff --git a/.vagrant-puppet/manifests/successor.pp b/.vagrant-puppet/manifests/default.pp similarity index 100% rename from .vagrant-puppet/manifests/successor.pp rename to .vagrant-puppet/manifests/default.pp From ba7fa85cff530c38163f2c554a66f06258dfac37 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 25 Nov 2014 12:17:00 +0100 Subject: [PATCH 149/238] Vagrantfile: complete puppet.module_path --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index f01fd7360..34c9e97f1 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -99,7 +99,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # puppet.manifest_file = "init.pp" # end config.vm.provision :puppet do |puppet| - puppet.module_path = ".vagrant-puppet/modules" + puppet.module_path = [ ".vagrant-puppet/modules", ".vagrant-puppet/profiles" ] puppet.manifests_path = ".vagrant-puppet/manifests" # puppet.options = "-v -d" end From edd8eced5d8746d4a25fb5dd91b4a2007709344a Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 25 Nov 2014 12:55:51 +0100 Subject: [PATCH 150/238] icingaweb2_dev: update SQL schema file paths --- .../profiles/icingaweb2_dev/manifests/init.pp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index aa2d1317f..c65568993 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -60,26 +60,13 @@ class icingaweb2_dev { username => 'icingaweb', password => 'icingaweb', privileges => 'ALL', - schemafile => '/vagrant/etc/schema/accounts.mysql.sql', + schemafile => '/vagrant/etc/schema/mysql.schema.sql', } pgsql::database::populate { 'icingaweb': username => 'icingaweb', password => 'icingaweb', - schemafile => '/vagrant/etc/schema/accounts.pgsql.sql', - } - - exec { 'populate-icingaweb-mysql-db-preferences': - unless => 'mysql -uicingaweb -picingaweb icingaweb -e "SELECT * FROM preference;" &> /dev/null', - command => 'mysql -uicingaweb -picingaweb icingaweb < /vagrant/etc/schema/preferences.mysql.sql', - require => Mysql::Database::Populate['icingaweb'], - } - - exec { 'populate-icingweb-pgsql-db-preferences': - unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM preference;" &> /dev/null', - command => 'psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/preferences.pgsql.sql', - user => 'postgres', - require => Pgsql::Database::Populate['icingaweb'], + schemafile => '/vagrant/etc/schema/pgsql.schema.sql', } file { '/etc/httpd/conf.d/icingaweb.conf': From c737f1816299935617d4c6f64a1945e19feec077 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 25 Nov 2014 15:07:43 +0100 Subject: [PATCH 151/238] Don't install jQuery --- .vagrant-puppet/manifests/finalize.sh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.vagrant-puppet/manifests/finalize.sh b/.vagrant-puppet/manifests/finalize.sh index 3b1418575..615953d8c 100644 --- a/.vagrant-puppet/manifests/finalize.sh +++ b/.vagrant-puppet/manifests/finalize.sh @@ -2,14 +2,6 @@ set -e -installJquery () { - # The npm module jquery won't install via puppet because of an mysterious error - # when node-gyp rebuilding the dependent contextify module - if [ ! -d /usr/lib/node_modules/jquery ]; then - npm install --silent -g jquery - fi -} - startServicesWithNonLSBCompliantExitStatusCodes () { # Unfortunately the ido2db init script is not LSB compliant and hence not started via puppet service ido2db-mysql start || true @@ -26,7 +18,6 @@ mountIcinga2webVarLog () { fi } -installJquery startServicesWithNonLSBCompliantExitStatusCodes mountIcinga2webVarLog From 31a49a7c95926c3fe7036e5b43459a54c4c08028 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 25 Nov 2014 15:24:32 +0100 Subject: [PATCH 152/238] Don't start ido2db-*sql --- .vagrant-puppet/manifests/finalize.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.vagrant-puppet/manifests/finalize.sh b/.vagrant-puppet/manifests/finalize.sh index 615953d8c..069bb7734 100644 --- a/.vagrant-puppet/manifests/finalize.sh +++ b/.vagrant-puppet/manifests/finalize.sh @@ -2,12 +2,6 @@ set -e -startServicesWithNonLSBCompliantExitStatusCodes () { - # Unfortunately the ido2db init script is not LSB compliant and hence not started via puppet - service ido2db-mysql start || true - service ido2db-pgsql start || true -} - mountIcinga2webVarLog () { if ! $(/bin/mount | /bin/grep -q "/vagrant/var/log"); then # Remount /vagrant/var/log/ with appropriate permissions since the group apache is missing initially @@ -18,7 +12,6 @@ mountIcinga2webVarLog () { fi } -startServicesWithNonLSBCompliantExitStatusCodes mountIcinga2webVarLog exit 0 From dbf8527fc9ae8bfb5ade9971c17e1d43236b2401 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 25 Nov 2014 15:42:15 +0100 Subject: [PATCH 153/238] git_cmmi: don't clone a git repo more than once --- .vagrant-puppet/modules/git_cmmi/manifests/init.pp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/git_cmmi/manifests/init.pp b/.vagrant-puppet/modules/git_cmmi/manifests/init.pp index b98894f11..2c5302486 100644 --- a/.vagrant-puppet/modules/git_cmmi/manifests/init.pp +++ b/.vagrant-puppet/modules/git_cmmi/manifests/init.pp @@ -5,9 +5,12 @@ define git_cmmi ( ) { include git + $srcDir = '/usr/local/src' + exec { "git-clone-${name}": - cwd => '/usr/local/src', + cwd => $srcDir, path => '/usr/bin:/bin', + unless => "test -d '${srcDir}/${name}/.git'", command => "git clone '${url}' '${name}'", require => Class['git'], } -> cmmi_dir { $name: From 8959fa36026d8acf0ed39887aa1a2e068d93bae0 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 25 Nov 2014 16:15:37 +0100 Subject: [PATCH 154/238] icingaweb2_dev: add resource for PgSQL --- .../files/modules/monitoring/backends.ini | 8 ++++++-- .../profiles/icingaweb2_dev/files/resources.ini | 11 ++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini index 8b305d50c..df24fe289 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini +++ b/.vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini @@ -1,6 +1,10 @@ -[localdb] +[local-mysql] type = ido -resource = ido +resource = ido-mysql + +[local-pgsql] +type = ido +resource = ido-pgsql [locallive] disabled = 1 diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/resources.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/resources.ini index ac6c6a03c..4b60b46b9 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/files/resources.ini +++ b/.vagrant-puppet/profiles/icingaweb2_dev/files/resources.ini @@ -16,7 +16,7 @@ password = icingaweb username = icingaweb dbname = icingaweb -[ido] +[ido-mysql] type = db db = mysql host = localhost @@ -24,3 +24,12 @@ port = 3306 password = icinga2 username = icinga2 dbname = icinga2 + +[ido-pgsql] +type = db +db = pgsql +host = localhost +port = 5432 +password = icinga2 +username = icinga2 +dbname = icinga2 From 2cf7563f2e5e5ff435d74ddd603f58e1e85d0683 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 25 Nov 2014 16:25:11 +0100 Subject: [PATCH 155/238] icingaweb2_dev: drop backend `localfile' --- .../icingaweb2_dev/files/modules/monitoring/backends.ini | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini index df24fe289..c4ff23f8c 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini +++ b/.vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini @@ -11,11 +11,6 @@ disabled = 1 type = livestatus resource = livestatus -[localfile] -disabled = 1 -type = statusdat -resource = statusdat - ;[localfailsafe] ;enabled=false ;type = combo From 94869bff5ec8535bb0614ee819a5da35edd057ed Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 25 Nov 2014 16:29:14 +0100 Subject: [PATCH 156/238] Add module `icinga2_pgsql' --- .../files}/features-available/ido-pgsql.conf | 0 .../modules/icinga2_pgsql/manifests/init.pp | 17 +++++++++++++++++ 2 files changed, 17 insertions(+) rename .vagrant-puppet/{files/etc/icinga2 => modules/icinga2_pgsql/files}/features-available/ido-pgsql.conf (100%) create mode 100644 .vagrant-puppet/modules/icinga2_pgsql/manifests/init.pp diff --git a/.vagrant-puppet/files/etc/icinga2/features-available/ido-pgsql.conf b/.vagrant-puppet/modules/icinga2_pgsql/files/features-available/ido-pgsql.conf similarity index 100% rename from .vagrant-puppet/files/etc/icinga2/features-available/ido-pgsql.conf rename to .vagrant-puppet/modules/icinga2_pgsql/files/features-available/ido-pgsql.conf diff --git a/.vagrant-puppet/modules/icinga2_pgsql/manifests/init.pp b/.vagrant-puppet/modules/icinga2_pgsql/manifests/init.pp new file mode 100644 index 000000000..2326449af --- /dev/null +++ b/.vagrant-puppet/modules/icinga2_pgsql/manifests/init.pp @@ -0,0 +1,17 @@ +class icinga2_pgsql { + include icinga2 + include icinga_packages + + package { 'icinga2-ido-pgsql': + ensure => latest, + require => Class['icinga_packages'], + } + -> pgsql::database::populate { 'icinga2': + username => 'icinga2', + password => 'icinga2', + schemafile => '/usr/share/icinga2-ido-pgsql/schema/pgsql.sql', + } + -> icinga2::feature { 'ido-pgsql': + source => 'puppet:///modules/icinga2_pgsql', + } +} From 13059aa23662ff66cc60eb5c4ba663e95709ad65 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 25 Nov 2014 16:29:14 +0100 Subject: [PATCH 157/238] icinga2_dev: use module `icinga2_pgsql' --- .vagrant-puppet/profiles/icinga2_dev/manifests/init.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp index 8f63013ff..484042b64 100644 --- a/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp @@ -13,6 +13,7 @@ # class icinga2_dev { include icinga2_mysql + include icinga2_pgsql include monitoring_plugins include monitoring_test_config From 777ced392fc20635317d65be8b50b9a18611ff61 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 25 Nov 2014 17:46:29 +0100 Subject: [PATCH 158/238] icingaweb2_dev: change default log level to `DEBUG' --- .vagrant-puppet/profiles/icingaweb2_dev/files/config.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/config.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/config.ini index 296915abe..0b0d03106 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/files/config.ini +++ b/.vagrant-puppet/profiles/icingaweb2_dev/files/config.ini @@ -12,7 +12,7 @@ file = "/var/log/icingaweb.log" ;application = "icingaweb" ;facility = "LOG_USER" -level = ERROR +level = DEBUG ; The default level is ERROR, which means that only events of this level (and ; above) will be tracked. Level names descend in order of importance where ; ERROR is the most important level and DEBUG is the least important level: From ef2758125b4ce15f507f823b88093dc86d3342bd Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 25 Nov 2014 17:46:29 +0100 Subject: [PATCH 159/238] icingaweb2_dev: populate openldap --- .../icingaweb2_dev/files/openldap}/db.ldif | 0 .../icingaweb2_dev/files/openldap}/dit.ldif | 0 .../icingaweb2_dev/files/openldap}/users.ldif | 0 .../profiles/icingaweb2_dev/manifests/init.pp | 26 +++++++++++++++++++ 4 files changed, 26 insertions(+) rename .vagrant-puppet/{modules/openldap/files => profiles/icingaweb2_dev/files/openldap}/db.ldif (100%) rename .vagrant-puppet/{modules/openldap/files => profiles/icingaweb2_dev/files/openldap}/dit.ldif (100%) rename .vagrant-puppet/{modules/openldap/files => profiles/icingaweb2_dev/files/openldap}/users.ldif (100%) diff --git a/.vagrant-puppet/modules/openldap/files/db.ldif b/.vagrant-puppet/profiles/icingaweb2_dev/files/openldap/db.ldif similarity index 100% rename from .vagrant-puppet/modules/openldap/files/db.ldif rename to .vagrant-puppet/profiles/icingaweb2_dev/files/openldap/db.ldif diff --git a/.vagrant-puppet/modules/openldap/files/dit.ldif b/.vagrant-puppet/profiles/icingaweb2_dev/files/openldap/dit.ldif similarity index 100% rename from .vagrant-puppet/modules/openldap/files/dit.ldif rename to .vagrant-puppet/profiles/icingaweb2_dev/files/openldap/dit.ldif diff --git a/.vagrant-puppet/modules/openldap/files/users.ldif b/.vagrant-puppet/profiles/icingaweb2_dev/files/openldap/users.ldif similarity index 100% rename from .vagrant-puppet/modules/openldap/files/users.ldif rename to .vagrant-puppet/profiles/icingaweb2_dev/files/openldap/users.ldif diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index c65568993..1d9435c56 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -4,6 +4,7 @@ class icingaweb2_dev { include icingaweb2 include icingacli include icinga_packages + include openldap class { 'zend_framework': notify => Service['apache'], @@ -94,4 +95,29 @@ class icingaweb2_dev { unless => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables', command => '/sbin/iptables -I INPUT 1 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && /sbin/iptables-save > /etc/sysconfig/iptables' } + + define openldap_file { + file { "openldap/${name}.ldif": + path => "/usr/share/openldap-servers/${name}.ldif", + source => "puppet:///modules/icingaweb2_dev/openldap/${name}.ldif", + require => Class['openldap'], + } + } + + openldap_file { [ 'db', 'dit', 'users' ]: } + + exec { 'populate-openldap': + # TODO: Split the command and use unless instead of trying to populate openldap everytime + command => 'sudo ldapadd -c -Y EXTERNAL -H ldapi:/// -f /usr/share/openldap-servers/db.ldif || true && \ + sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/dit.ldif || true && \ + sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/users.ldif || true', + require => [ + Service['slapd'], + File[[ + 'openldap/db.ldif', + 'openldap/dit.ldif', + 'openldap/users.ldif' + ]] + ], + } } From 0bec42930b3b4b45bda7b5696a3464ba7df938ab Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Tue, 25 Nov 2014 18:11:25 +0100 Subject: [PATCH 160/238] icingaweb2_dev: enable LDAP authentication --- .../profiles/icingaweb2_dev/files/authentication.ini | 6 ++++++ .../profiles/icingaweb2_dev/files/resources.ini | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/authentication.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/authentication.ini index 2e78afb1b..96ae63c81 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/files/authentication.ini +++ b/.vagrant-puppet/profiles/icingaweb2_dev/files/authentication.ini @@ -11,3 +11,9 @@ resource = icingaweb-mysql [icingaweb-pgsql] backend = db resource = icingaweb-pgsql + +[internal_ldap_authentication] +backend = ldap +resource = internal_ldap +user_class = inetOrgPerson +user_name_attribute = uid diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/resources.ini b/.vagrant-puppet/profiles/icingaweb2_dev/files/resources.ini index 4b60b46b9..e76afab41 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/files/resources.ini +++ b/.vagrant-puppet/profiles/icingaweb2_dev/files/resources.ini @@ -33,3 +33,11 @@ port = 5432 password = icinga2 username = icinga2 dbname = icinga2 + +[internal_ldap] +type = ldap +hostname = localhost +port = 389 +root_dn = "ou=people, dc=icinga, dc=org" +bind_dn = "cn=admin,cn=config" +bind_pw = admin From 9e23ca09204b46c3d6370e1548942a0f9e861007 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 26 Nov 2014 12:32:22 +0100 Subject: [PATCH 161/238] icingaweb2_dev: add default user `icingaadmin' --- .../profiles/icingaweb2_dev/manifests/init.pp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index 1d9435c56..cea92abe2 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -57,18 +57,30 @@ class icingaweb2_dev { require => Class['apache'], } + $icingaadminSelect = "as CNT from icingaweb_user where name = \'icingaadmin\'\" |grep -qwe \'cnt=0\'" + $icingaadminInsert = "\"INSERT INTO icingaweb_user (name, active, password_hash) VALUES (\'icingaadmin\', 1, \'\\\$1\\\$JMdnEc9M\\\$FW7yapAjv0atS43NkapGo/\');\"" + mysql::database::populate { 'icingaweb': username => 'icingaweb', password => 'icingaweb', privileges => 'ALL', schemafile => '/vagrant/etc/schema/mysql.schema.sql', } + -> exec { 'mysql-icingaadmin': + onlyif => "mysql -uicingaweb -picingaweb icingaweb -e \"select CONCAT(\'cnt=\', COUNT(name)) ${icingaadminSelect}", + command => "mysql -uicingaweb -picingaweb icingaweb -e ${icingaadminInsert}", + } pgsql::database::populate { 'icingaweb': username => 'icingaweb', password => 'icingaweb', schemafile => '/vagrant/etc/schema/pgsql.schema.sql', } + -> exec { 'pgsql-icingaadmin': + onlyif => "psql -U icingaweb -w -d icingaweb -c \"select 'cnt=' || COUNT(name) ${icingaadminSelect}", + command => "psql -U icingaweb -w -d icingaweb -c ${icingaadminInsert}", + environment => 'PGPASSWORD=icingaweb', + } file { '/etc/httpd/conf.d/icingaweb.conf': source => 'puppet:////vagrant/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf', From fb6b2a72733d74bc4677f05d411b85ded2397ec0 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 26 Nov 2014 14:03:04 +0100 Subject: [PATCH 162/238] icingaweb2_dev: install Mockery --- .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index cea92abe2..e0015b69d 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -132,4 +132,8 @@ class icingaweb2_dev { ]] ], } + + package { 'php-deepend-Mockery': + ensure => latest, + } } From 196b6a4875f6034886f46414621cdb9ef4164682 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 9 Dec 2014 15:38:13 +0100 Subject: [PATCH 163/238] Ensure that Zend is loaded when showing status information in the CLI fixes #7869 --- library/Icinga/Application/ApplicationBootstrap.php | 2 +- modules/monitoring/application/clicommands/ListCommand.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Application/ApplicationBootstrap.php b/library/Icinga/Application/ApplicationBootstrap.php index 7f1667e5b..6de3081ba 100644 --- a/library/Icinga/Application/ApplicationBootstrap.php +++ b/library/Icinga/Application/ApplicationBootstrap.php @@ -351,7 +351,7 @@ abstract class ApplicationBootstrap * * @return $this */ - protected function setupZendAutoloader() + public function setupZendAutoloader() { require_once 'Zend/Loader/Autoloader.php'; diff --git a/modules/monitoring/application/clicommands/ListCommand.php b/modules/monitoring/application/clicommands/ListCommand.php index e6b86f4ef..a4f1d05f1 100644 --- a/modules/monitoring/application/clicommands/ListCommand.php +++ b/modules/monitoring/application/clicommands/ListCommand.php @@ -25,6 +25,7 @@ class ListCommand extends Command public function init() { + $this->app->setupZendAutoloader(); $this->backend = Backend::createBackend($this->params->shift('backend')); $this->dumpSql = $this->params->shift('showsql'); } From aea29fba6236554bab612dee7dd86ac9f4743d24 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 10 Dec 2014 10:33:48 +0100 Subject: [PATCH 164/238] puppet: Remove pear module because it's not used refs #6842 --- .../modules/pear/manifests/init.pp | 43 ---------------- .../modules/pear/manifests/package.pp | 50 ------------------- 2 files changed, 93 deletions(-) delete mode 100644 .vagrant-puppet/modules/pear/manifests/init.pp delete mode 100644 .vagrant-puppet/modules/pear/manifests/package.pp diff --git a/.vagrant-puppet/modules/pear/manifests/init.pp b/.vagrant-puppet/modules/pear/manifests/init.pp deleted file mode 100644 index 59f204457..000000000 --- a/.vagrant-puppet/modules/pear/manifests/init.pp +++ /dev/null @@ -1,43 +0,0 @@ -# Class: pear -# -# This class installs pear. -# -# Parameters: -# -# Actions: -# -# Requires: -# -# php -# -# Sample Usage: -# -# include pear -# -class pear { - - Exec { path => '/usr/bin:/bin' } - - include php - - package { 'php-pear': - ensure => latest, - require => Class['php'] - } - - exec { 'pear upgrade': - command => 'pear upgrade', - require => Package['php-pear'] - } - - exec { 'pear update-channels': - command => 'pear update-channels', - require => Package['php-pear'] - } - - exec { 'pear auto discover channels': - command => 'pear config-set auto_discover 1', - unless => 'pear config-get auto_discover | grep 1', - require => Package['php-pear'] - } -} diff --git a/.vagrant-puppet/modules/pear/manifests/package.pp b/.vagrant-puppet/modules/pear/manifests/package.pp deleted file mode 100644 index 17de50ecf..000000000 --- a/.vagrant-puppet/modules/pear/manifests/package.pp +++ /dev/null @@ -1,50 +0,0 @@ -# Define: pear::package -# -# Install additional PEAR packages -# -# Parameters: -# -# Actions: -# -# Requires: -# -# pear -# -# Sample Usage: -# -# pear::package { 'phpunit': } -# -define pear::package( - $channel -) { - - Exec { path => '/usr/bin' } - - include pear - - if $::require { - $require_ = [Class['pear'], $::require] - } else { - $require_ = Class['pear'] - } - - if $channel { - exec { "pear discover ${channel}": - command => "sudo pear channel-discover ${channel}", - unless => "pear channel-info ${channel}", - require => $require_, - before => Exec["pear install ${name}"] - } - } - - exec { "pear install ${name}": - command => "pear install --alldeps ${name}", - unless => "pear list ${name}", - require => $require_ - } - - exec { "pear upgrade ${name}": - command => "pear upgrade ${name}", - require => Exec["pear install ${name}"] - } -} From 8b59276ea80ed983c3644bdbfc22aaf2bcd410fb Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 10 Dec 2014 15:10:42 +0100 Subject: [PATCH 165/238] puppet: Remove icingaweb2's init.pp The module icingaweb2 is reserved for installing Icinga Web 2 from package by including the class icingaweb2. --- .../modules/icingaweb2/manifests/init.pp | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 .vagrant-puppet/modules/icingaweb2/manifests/init.pp diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/init.pp b/.vagrant-puppet/modules/icingaweb2/manifests/init.pp deleted file mode 100644 index cc2fd588a..000000000 --- a/.vagrant-puppet/modules/icingaweb2/manifests/init.pp +++ /dev/null @@ -1,13 +0,0 @@ -class icingaweb2 { - include apache - - file { 'icingaweb2cfgDir': - path => '/etc/icingaweb', - ensure => directory, - links => follow, - owner => 'apache', - group => 'apache', - mode => 6755, - require => Class['apache'], - } -} From 83b1cdeb3b1e172c99dafc78770d5199ef243157 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 10 Dec 2014 15:11:57 +0100 Subject: [PATCH 166/238] puppet/apache: Make the Apache user a virtual resource This is required for appending the Apache user to groups later w/o hassle. --- .vagrant-puppet/modules/apache/manifests/init.pp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.vagrant-puppet/modules/apache/manifests/init.pp b/.vagrant-puppet/modules/apache/manifests/init.pp index b3465757f..e96150f12 100644 --- a/.vagrant-puppet/modules/apache/manifests/init.pp +++ b/.vagrant-puppet/modules/apache/manifests/init.pp @@ -35,7 +35,9 @@ class apache { require => Package['apache'], } - user { $user: + @user { $user: alias => 'apache', } + + User <| alias == apache |> } From 06fe3bc2180650457ea67a4ab427dbd106d98157 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 10 Dec 2014 15:14:56 +0100 Subject: [PATCH 167/238] puppet: Add class icingaweb2::config icingaweb2::config creates Icinga Web 2's configuration directories using the config path defined by hiera. --- .../modules/icingaweb2/manifests/config.pp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .vagrant-puppet/modules/icingaweb2/manifests/config.pp diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config.pp b/.vagrant-puppet/modules/icingaweb2/manifests/config.pp new file mode 100644 index 000000000..c2005cf18 --- /dev/null +++ b/.vagrant-puppet/modules/icingaweb2/manifests/config.pp @@ -0,0 +1,14 @@ +class icingaweb2::config ( + $config = hiera('icingaweb2::config') +) { + group { 'icingaweb': + ensure => present, + } + + file { [ "${config}", "${config}/enabledModules", "${config}/modules" ]: + ensure => directory, + owner => 'root', + group => 'icingaweb', + mode => '2770', + } +} From 9446117517b9da75d6f14798fadb5e6e82c9f058 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 10 Dec 2014 15:15:56 +0100 Subject: [PATCH 168/238] git: Fix .gitignore include --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3cc377b8d..df08870cd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ # Except those related to git and vagrant !.git* -!.vagrant-puppet/* +!.vagrant-puppet* # Exclude application log files var/log/* From 513fbe6461cd5bf8e4f4f9f341ebd098cf35d2d5 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 10 Dec 2014 15:16:19 +0100 Subject: [PATCH 169/238] puppet: Let icingaweb2::config::general() use the config path defined by hiera --- .../icingaweb2/manifests/config/general.pp | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp b/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp index 4e86afbfc..ba958ba80 100644 --- a/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp +++ b/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp @@ -1,21 +1,15 @@ -define icingaweb2::config::general ($source, $replace = true) { - include apache - include icingaweb2 +define icingaweb2::config::general ( + $source, + $config = hiera('icingaweb2::config'), + $replace = true +) { + include icingaweb2::config - $path = "/etc/icingaweb/${name}.ini" - - parent_dirs { $path: - user => 'apache', - require => [ - Class['apache'], - File['icingaweb2cfgDir'] - ], - } - -> file { $path: - source => "${source}/${name}.ini", - owner => 'apache', - group => 'apache', - replace => $replace, - require => Class['apache'], + file { "${config}/${name}.ini": + source => "${source}/${name}.ini", + owner => 'root', + group => 'icingaweb', + mode => 0660, + replace => $replace, } } From bf68ecfa8cb8fdb855214624d69a85c8d4433156 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 10 Dec 2014 15:17:15 +0100 Subject: [PATCH 170/238] puppet: Let icingaweb2::config::module() use the config path defined by hiera --- .../icingaweb2/manifests/config/module.pp | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config/module.pp b/.vagrant-puppet/modules/icingaweb2/manifests/config/module.pp index fe5b6c0cc..69e5abd6b 100644 --- a/.vagrant-puppet/modules/icingaweb2/manifests/config/module.pp +++ b/.vagrant-puppet/modules/icingaweb2/manifests/config/module.pp @@ -1,6 +1,25 @@ -define icingaweb2::config::module ($source, $module = 'monitoring', $replace = true) { - icingaweb2::config::general { "modules/${module}/${name}": - source => $source, - replace => $replace, +define icingaweb2::config::module ( + $module, + $source, + $config = hiera('icingaweb2::config'), + $replace = true +) { + include icingaweb2::config + + if ! defined(File["${config}/modules/${module}"]) { + file { "${config}/modules/${module}": + ensure => directory, + owner => 'root', + group => 'icingaweb', + mode => '2770', + } + } + + file { "${config}/modules/${module}/${name}.ini": + source => "${source}/modules/${module}/${name}.ini", + owner => 'root', + group => 'icingaweb', + mode => 0660, + replace => $replace, } } From cccab1d3e9186f966176f5e4110d20d2dbe22443 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 10 Dec 2014 15:17:37 +0100 Subject: [PATCH 171/238] puppet: Add note to parent_dirs that it has to removed --- .vagrant-puppet/modules/parent_dirs/manifests/init.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/.vagrant-puppet/modules/parent_dirs/manifests/init.pp b/.vagrant-puppet/modules/parent_dirs/manifests/init.pp index a8952e781..e5e4e38d7 100644 --- a/.vagrant-puppet/modules/parent_dirs/manifests/init.pp +++ b/.vagrant-puppet/modules/parent_dirs/manifests/init.pp @@ -1,3 +1,4 @@ +# TODO(el): Remove this. It's always executed and hackish define parent_dirs ($user = 'root') { exec { "parent_dirs-${name}": command => "mkdir -p \"\$(dirname \"\$(readlink -m '${name}')\")\"", From a087bc8c00d1b5203f0d6b691e1355c3a4bb597b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 10 Dec 2014 15:20:45 +0100 Subject: [PATCH 172/238] puppet: Add note to php-timezone that it's always executed and that it should be a resource --- .vagrant-puppet/modules/php/manifests/init.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/.vagrant-puppet/modules/php/manifests/init.pp b/.vagrant-puppet/modules/php/manifests/init.pp index 2c9c33619..dd6df83b3 100644 --- a/.vagrant-puppet/modules/php/manifests/init.pp +++ b/.vagrant-puppet/modules/php/manifests/init.pp @@ -23,6 +23,7 @@ class php { require => Package['apache'], notify => Service['apache'] } + # TODO(el): Always executed. Should be a resource -> exec { 'php-timezone': command => 'sed -re $\'s#^;?(date\\.timezone =).*$#\\1 "UTC"#\' -i /etc/php.ini', notify => Service['apache'], From 429b16b74edc0f5028229acf15e9054f82db8212 Mon Sep 17 00:00:00 2001 From: ayoubabid Date: Mon, 8 Dec 2014 17:31:17 +0100 Subject: [PATCH 173/238] Update LocalInstanceForm.php Wrong path to icinga2 command Signed-off-by: Eric Lippmann --- .../application/forms/Config/Instance/LocalInstanceForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php index ac1139268..daabe7e02 100644 --- a/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/LocalInstanceForm.php @@ -29,7 +29,7 @@ class LocalInstanceForm extends Form array( 'required' => true, 'label' => mt('monitoring', 'Command File'), - 'value' => '/usr/local/icinga/var/rw/icinga.cmd', + 'value' => '/var/run/icinga2/cmd/icinga2.cmd', 'description' => mt('monitoring', 'Path to the local Icinga command file') ) ); From e0bec56d2330c0a54a9d81891d8d3359531c90c1 Mon Sep 17 00:00:00 2001 From: ayoubabid Date: Mon, 8 Dec 2014 17:32:52 +0100 Subject: [PATCH 174/238] Update RemoteInstanceForm.php Wrong path to icinga2 command. Signed-off-by: Eric Lippmann --- .../application/forms/Config/Instance/RemoteInstanceForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php index c93436ab2..7c55f655a 100644 --- a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php @@ -63,7 +63,7 @@ class RemoteInstanceForm extends Form array( 'required' => true, 'label' => mt('monitoring', 'Command File'), - 'value' => '/usr/local/icinga/var/rw/icinga.cmd', + 'value' => '/var/run/icinga2/cmd/icinga2.cmd', 'description' => mt('monitoring', 'Path to the Icinga command file on the remote Icinga instance') ) ) From dc0f396fbfadd9b7d3eafb82e3cd6d60fdcff9fe Mon Sep 17 00:00:00 2001 From: Tom Ford Date: Fri, 28 Nov 2014 14:50:03 +0000 Subject: [PATCH 175/238] Check LDAP username in case insensitive way Signed-off-by: Eric Lippmann refs #7991 --- library/Icinga/Authentication/Backend/LdapUserBackend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Icinga/Authentication/Backend/LdapUserBackend.php b/library/Icinga/Authentication/Backend/LdapUserBackend.php index 519dd3c48..a9ffba0c5 100644 --- a/library/Icinga/Authentication/Backend/LdapUserBackend.php +++ b/library/Icinga/Authentication/Backend/LdapUserBackend.php @@ -150,7 +150,7 @@ class LdapUserBackend extends UserBackend public function hasUser(User $user) { $username = $user->getUsername(); - return $this->conn->fetchOne($this->selectUser($username)) === $username; + return strtolower($this->conn->fetchOne($this->selectUser($username))) === strtolower($username); } /** From 89c4bb4f53274773818849de2c8cac551668c9e9 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 10 Dec 2014 16:01:54 +0100 Subject: [PATCH 176/238] puppet: Use hiera in icingaweb2_dev --- .../profiles/icingaweb2_dev/manifests/init.pp | 74 +++++++++---------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp index e0015b69d..638809881 100644 --- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -1,15 +1,22 @@ -class icingaweb2_dev { +class icingaweb2_dev ( + $log = hiera('icingaweb2::log'), + $db_user = hiera('icingaweb2::db_user'), + $db_pass = hiera('icingaweb2::db_pass'), + $db_name = hiera('icingaweb2::db_name'), +) { include apache include php - include icingaweb2 + include icingaweb2::config include icingacli include icinga_packages include openldap + # TODO(el): Only include zend_framework. Apache does not have to be notified class { 'zend_framework': notify => Service['apache'], } + # TODO(el): icinga-gui is not a icingaweb2_dev package package { [ 'php-pdo', 'php-ldap', 'php-phpunit-PHPUnit', 'icinga-gui' ]: ensure => latest, notify => Service['apache'], @@ -18,16 +25,8 @@ class icingaweb2_dev { Exec { path => '/usr/local/bin:/usr/bin:/bin' } - file { '/etc/icingaweb/enabledModules': - ensure => directory, - owner => 'apache', - group => 'apache', - mode => 6755, - require => [ - Class['apache'], - File['icingaweb2cfgDir'] - ], - } + # TODO(el): Enabling/disabling modules should be a resource + User <| alias == apache |> { groups +> 'icingaweb' } -> exec { 'enable-monitoring-module': command => 'icingacli module enable monitoring', user => 'apache', @@ -38,48 +37,43 @@ class icingaweb2_dev { user => 'apache' } + # TODO(el): 'icingacmd' is NOT a icingaweb2_dev group group { 'icingacmd': ensure => present, } - -> exec { 'usermod -aG icingacmd apache': - command => '/usr/sbin/usermod -aG icingacmd apache', - require => [ - Class['icingacli'], - User['apache'] - ], - notify => Service['apache'], - } - file { '/var/log/icingaweb.log': - ensure => file, - owner => 'apache', - group => 'apache', - require => Class['apache'], + User <| alias == apache |> { groups +> 'icingacmd' } + + file { "${log}": + ensure => directory, + owner => 'root', + group => 'icingaweb', + mode => '2775' } $icingaadminSelect = "as CNT from icingaweb_user where name = \'icingaadmin\'\" |grep -qwe \'cnt=0\'" $icingaadminInsert = "\"INSERT INTO icingaweb_user (name, active, password_hash) VALUES (\'icingaadmin\', 1, \'\\\$1\\\$JMdnEc9M\\\$FW7yapAjv0atS43NkapGo/\');\"" - mysql::database::populate { 'icingaweb': - username => 'icingaweb', - password => 'icingaweb', + mysql::database::populate { "${db_name}": + username => "${db_user}", + password => "${db_pass}", privileges => 'ALL', schemafile => '/vagrant/etc/schema/mysql.schema.sql', } -> exec { 'mysql-icingaadmin': - onlyif => "mysql -uicingaweb -picingaweb icingaweb -e \"select CONCAT(\'cnt=\', COUNT(name)) ${icingaadminSelect}", - command => "mysql -uicingaweb -picingaweb icingaweb -e ${icingaadminInsert}", + onlyif => "mysql -u${db_user} -p${db_pass} ${db_name} -e \"select CONCAT(\'cnt=\', COUNT(name)) ${icingaadminSelect}", + command => "mysql -u${db_user} -p${db_pass} ${db_name} -e ${icingaadminInsert}", } - pgsql::database::populate { 'icingaweb': - username => 'icingaweb', - password => 'icingaweb', + pgsql::database::populate { "${db_name}": + username => "${db_user}", + password => "${db_pass}", schemafile => '/vagrant/etc/schema/pgsql.schema.sql', } -> exec { 'pgsql-icingaadmin': - onlyif => "psql -U icingaweb -w -d icingaweb -c \"select 'cnt=' || COUNT(name) ${icingaadminSelect}", - command => "psql -U icingaweb -w -d icingaweb -c ${icingaadminInsert}", - environment => 'PGPASSWORD=icingaweb', + onlyif => "psql -U ${db_user} -w -d ${db_name} -c \"select 'cnt=' || COUNT(name) ${icingaadminSelect}", + command => "psql -U ${db_user} -w -d ${db_name} -c ${icingaadminInsert}", + environment => "PGPASSWORD=${db_pass}", } file { '/etc/httpd/conf.d/icingaweb.conf': @@ -97,17 +91,20 @@ class icingaweb2_dev { } icingaweb2::config::module { [ 'backends', 'config', 'instances' ]: + module => 'monitoring', source => 'puppet:///modules/icingaweb2_dev', } + # TODO(el): Should be a resource package { 'iptables': ensure => latest } -> exec { 'iptables-allow-http': - unless => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables', + unless => 'grep -qe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables', command => '/sbin/iptables -I INPUT 1 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && /sbin/iptables-save > /etc/sysconfig/iptables' } + # TODO(el): Don't define inside a class define openldap_file { file { "openldap/${name}.ldif": path => "/usr/share/openldap-servers/${name}.ldif", @@ -119,7 +116,7 @@ class icingaweb2_dev { openldap_file { [ 'db', 'dit', 'users' ]: } exec { 'populate-openldap': - # TODO: Split the command and use unless instead of trying to populate openldap everytime + # TODO(el): Split the command and use unless instead of trying to populate openldap everytime command => 'sudo ldapadd -c -Y EXTERNAL -H ldapi:/// -f /usr/share/openldap-servers/db.ldif || true && \ sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/dit.ldif || true && \ sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/users.ldif || true', @@ -133,6 +130,7 @@ class icingaweb2_dev { ], } + # TODO(el): Should be a module package { 'php-deepend-Mockery': ensure => latest, } From 4e8595f0c5d373368ced3ade71c8410b8a5d5205 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 10 Dec 2014 16:02:54 +0100 Subject: [PATCH 177/238] puppet: Rename .vagrant-puppet to .puppet --- .../files/etc/httpd/conf.d/icingaweb.conf | 0 .../files/etc/icingaweb/authentication.ini | 0 .../files/etc/icingaweb/modules/monitoring/backends.ini | 0 .../files/etc/icingaweb/modules/monitoring/instances.ini | 0 {.vagrant-puppet => .puppet}/files/etc/icingaweb/resources.ini | 0 .../files/etc/init.d/icinga_command_proxy | 0 {.vagrant-puppet => .puppet}/files/etc/motd | 0 {.vagrant-puppet => .puppet}/files/etc/profile.d/env.sh | 0 .../files/usr/local/bin/icinga_command_proxy | 0 .../files/var/www/html/icingaweb/index.php | 0 {.vagrant-puppet => .puppet}/manifests/default.pp | 0 {.vagrant-puppet => .puppet}/manifests/default.pp.old | 0 {.vagrant-puppet => .puppet}/manifests/finalize.sh | 0 {.vagrant-puppet => .puppet}/modules/apache/manifests/init.pp | 0 {.vagrant-puppet => .puppet}/modules/casperjs/manifests/init.pp | 0 {.vagrant-puppet => .puppet}/modules/cmmi/manifests/init.pp | 0 {.vagrant-puppet => .puppet}/modules/cmmi_dir/manifests/init.pp | 0 {.vagrant-puppet => .puppet}/modules/configure/manifests/init.pp | 0 {.vagrant-puppet => .puppet}/modules/cpan/manifests/init.pp | 0 .../modules/cpan/templates/MyConfig.pm.erb | 0 {.vagrant-puppet => .puppet}/modules/epel/manifests/init.pp | 0 {.vagrant-puppet => .puppet}/modules/gcc/manifests/init.pp | 0 {.vagrant-puppet => .puppet}/modules/git/manifests/init.pp | 0 {.vagrant-puppet => .puppet}/modules/git_cmmi/manifests/init.pp | 0 .../modules/icinga/templates/ido2db-mysql.cfg.erb | 0 .../modules/icinga/templates/ido2db-pgsql.cfg.erb | 0 {.vagrant-puppet => .puppet}/modules/icinga2/manifests/config.pp | 0 {.vagrant-puppet => .puppet}/modules/icinga2/manifests/feature.pp | 0 {.vagrant-puppet => .puppet}/modules/icinga2/manifests/init.pp | 0 .../modules/icinga2_mysql/files/features-available/ido-mysql.conf | 0 .../modules/icinga2_mysql/manifests/init.pp | 0 .../modules/icinga2_pgsql/files/features-available/ido-pgsql.conf | 0 .../modules/icinga2_pgsql/manifests/init.pp | 0 .../modules/icinga_packages/manifests/init.pp | 0 {.vagrant-puppet => .puppet}/modules/icingacli/manifests/init.pp | 0 .../modules/icingaweb2/manifests/config.pp | 0 .../modules/icingaweb2/manifests/config/general.pp | 0 .../modules/icingaweb2/manifests/config/module.pp | 0 .../modules/mk-livestatus/templates/mk-livestatus.cfg.erb | 0 .../modules/monitoring_plugins/manifests/init.pp | 0 .../modules/monitoring_test_config/manifests/init.pp | 0 .../modules/monitoring_test_config/manifests/populate_plugins.pp | 0 .../modules/mysql/manifests/database/create.pp | 0 .../modules/mysql/manifests/database/populate.pp | 0 {.vagrant-puppet => .puppet}/modules/mysql/manifests/init.pp | 0 {.vagrant-puppet => .puppet}/modules/mysql/templates/my.cnf.erb | 0 {.vagrant-puppet => .puppet}/modules/openldap/manifests/init.pp | 0 .../modules/parent_dirs/manifests/init.pp | 0 {.vagrant-puppet => .puppet}/modules/perl/manifests/init.pp | 0 .../modules/pgsql/manifests/database/create.pp | 0 .../modules/pgsql/manifests/database/populate.pp | 0 {.vagrant-puppet => .puppet}/modules/pgsql/manifests/init.pp | 0 .../modules/pgsql/templates/pg_hba.conf.erb | 0 {.vagrant-puppet => .puppet}/modules/phantomjs/manifests/init.pp | 0 {.vagrant-puppet => .puppet}/modules/php/manifests/extension.pp | 0 {.vagrant-puppet => .puppet}/modules/php/manifests/init.pp | 0 .../modules/php/templates/error_reporting.ini.erb | 0 .../modules/php/templates/xdebug_settings.ini.erb | 0 {.vagrant-puppet => .puppet}/modules/tar/manifests/init.pp | 0 {.vagrant-puppet => .puppet}/modules/wget/manifests/init.pp | 0 .../modules/zend_framework/manifests/init.pp | 0 .../profiles/icinga2_dev/files/conf.d/commands.conf | 0 .../profiles/icinga2_dev/files/conf.d/test-config.conf | 0 .../profiles/icinga2_dev/files/constants.conf | 0 .../profiles/icinga2_dev/manifests/init.pp | 0 .../profiles/icinga_mysql/manifests/init.pp | 0 .../profiles/icinga_pgsql/manifests/init.pp | 0 .../profiles/icingaweb2_dev/files/authentication.ini | 0 .../profiles/icingaweb2_dev/files/config.ini | 0 .../profiles/icingaweb2_dev/files/modules/monitoring/backends.ini | 0 .../profiles/icingaweb2_dev/files/modules/monitoring/config.ini | 0 .../icingaweb2_dev/files/modules/monitoring/instances.ini | 0 .../profiles/icingaweb2_dev/files/openldap/db.ldif | 0 .../profiles/icingaweb2_dev/files/openldap/dit.ldif | 0 .../profiles/icingaweb2_dev/files/openldap/users.ldif | 0 .../profiles/icingaweb2_dev/files/resources.ini | 0 .../profiles/icingaweb2_dev/manifests/init.pp | 0 {.vagrant-puppet => .puppet}/profiles/nodejs/manifests/init.pp | 0 78 files changed, 0 insertions(+), 0 deletions(-) rename {.vagrant-puppet => .puppet}/files/etc/httpd/conf.d/icingaweb.conf (100%) rename {.vagrant-puppet => .puppet}/files/etc/icingaweb/authentication.ini (100%) rename {.vagrant-puppet => .puppet}/files/etc/icingaweb/modules/monitoring/backends.ini (100%) rename {.vagrant-puppet => .puppet}/files/etc/icingaweb/modules/monitoring/instances.ini (100%) rename {.vagrant-puppet => .puppet}/files/etc/icingaweb/resources.ini (100%) rename {.vagrant-puppet => .puppet}/files/etc/init.d/icinga_command_proxy (100%) rename {.vagrant-puppet => .puppet}/files/etc/motd (100%) rename {.vagrant-puppet => .puppet}/files/etc/profile.d/env.sh (100%) rename {.vagrant-puppet => .puppet}/files/usr/local/bin/icinga_command_proxy (100%) rename {.vagrant-puppet => .puppet}/files/var/www/html/icingaweb/index.php (100%) rename {.vagrant-puppet => .puppet}/manifests/default.pp (100%) rename {.vagrant-puppet => .puppet}/manifests/default.pp.old (100%) rename {.vagrant-puppet => .puppet}/manifests/finalize.sh (100%) rename {.vagrant-puppet => .puppet}/modules/apache/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/casperjs/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/cmmi/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/cmmi_dir/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/configure/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/cpan/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/cpan/templates/MyConfig.pm.erb (100%) rename {.vagrant-puppet => .puppet}/modules/epel/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/gcc/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/git/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/git_cmmi/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/icinga/templates/ido2db-mysql.cfg.erb (100%) rename {.vagrant-puppet => .puppet}/modules/icinga/templates/ido2db-pgsql.cfg.erb (100%) rename {.vagrant-puppet => .puppet}/modules/icinga2/manifests/config.pp (100%) rename {.vagrant-puppet => .puppet}/modules/icinga2/manifests/feature.pp (100%) rename {.vagrant-puppet => .puppet}/modules/icinga2/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/icinga2_mysql/files/features-available/ido-mysql.conf (100%) rename {.vagrant-puppet => .puppet}/modules/icinga2_mysql/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/icinga2_pgsql/files/features-available/ido-pgsql.conf (100%) rename {.vagrant-puppet => .puppet}/modules/icinga2_pgsql/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/icinga_packages/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/icingacli/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/icingaweb2/manifests/config.pp (100%) rename {.vagrant-puppet => .puppet}/modules/icingaweb2/manifests/config/general.pp (100%) rename {.vagrant-puppet => .puppet}/modules/icingaweb2/manifests/config/module.pp (100%) rename {.vagrant-puppet => .puppet}/modules/mk-livestatus/templates/mk-livestatus.cfg.erb (100%) rename {.vagrant-puppet => .puppet}/modules/monitoring_plugins/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/monitoring_test_config/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/monitoring_test_config/manifests/populate_plugins.pp (100%) rename {.vagrant-puppet => .puppet}/modules/mysql/manifests/database/create.pp (100%) rename {.vagrant-puppet => .puppet}/modules/mysql/manifests/database/populate.pp (100%) rename {.vagrant-puppet => .puppet}/modules/mysql/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/mysql/templates/my.cnf.erb (100%) rename {.vagrant-puppet => .puppet}/modules/openldap/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/parent_dirs/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/perl/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/pgsql/manifests/database/create.pp (100%) rename {.vagrant-puppet => .puppet}/modules/pgsql/manifests/database/populate.pp (100%) rename {.vagrant-puppet => .puppet}/modules/pgsql/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/pgsql/templates/pg_hba.conf.erb (100%) rename {.vagrant-puppet => .puppet}/modules/phantomjs/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/php/manifests/extension.pp (100%) rename {.vagrant-puppet => .puppet}/modules/php/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/php/templates/error_reporting.ini.erb (100%) rename {.vagrant-puppet => .puppet}/modules/php/templates/xdebug_settings.ini.erb (100%) rename {.vagrant-puppet => .puppet}/modules/tar/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/wget/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/modules/zend_framework/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/profiles/icinga2_dev/files/conf.d/commands.conf (100%) rename {.vagrant-puppet => .puppet}/profiles/icinga2_dev/files/conf.d/test-config.conf (100%) rename {.vagrant-puppet => .puppet}/profiles/icinga2_dev/files/constants.conf (100%) rename {.vagrant-puppet => .puppet}/profiles/icinga2_dev/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/profiles/icinga_mysql/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/profiles/icinga_pgsql/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/profiles/icingaweb2_dev/files/authentication.ini (100%) rename {.vagrant-puppet => .puppet}/profiles/icingaweb2_dev/files/config.ini (100%) rename {.vagrant-puppet => .puppet}/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini (100%) rename {.vagrant-puppet => .puppet}/profiles/icingaweb2_dev/files/modules/monitoring/config.ini (100%) rename {.vagrant-puppet => .puppet}/profiles/icingaweb2_dev/files/modules/monitoring/instances.ini (100%) rename {.vagrant-puppet => .puppet}/profiles/icingaweb2_dev/files/openldap/db.ldif (100%) rename {.vagrant-puppet => .puppet}/profiles/icingaweb2_dev/files/openldap/dit.ldif (100%) rename {.vagrant-puppet => .puppet}/profiles/icingaweb2_dev/files/openldap/users.ldif (100%) rename {.vagrant-puppet => .puppet}/profiles/icingaweb2_dev/files/resources.ini (100%) rename {.vagrant-puppet => .puppet}/profiles/icingaweb2_dev/manifests/init.pp (100%) rename {.vagrant-puppet => .puppet}/profiles/nodejs/manifests/init.pp (100%) diff --git a/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf b/.puppet/files/etc/httpd/conf.d/icingaweb.conf similarity index 100% rename from .vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf rename to .puppet/files/etc/httpd/conf.d/icingaweb.conf diff --git a/.vagrant-puppet/files/etc/icingaweb/authentication.ini b/.puppet/files/etc/icingaweb/authentication.ini similarity index 100% rename from .vagrant-puppet/files/etc/icingaweb/authentication.ini rename to .puppet/files/etc/icingaweb/authentication.ini diff --git a/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/backends.ini b/.puppet/files/etc/icingaweb/modules/monitoring/backends.ini similarity index 100% rename from .vagrant-puppet/files/etc/icingaweb/modules/monitoring/backends.ini rename to .puppet/files/etc/icingaweb/modules/monitoring/backends.ini diff --git a/.vagrant-puppet/files/etc/icingaweb/modules/monitoring/instances.ini b/.puppet/files/etc/icingaweb/modules/monitoring/instances.ini similarity index 100% rename from .vagrant-puppet/files/etc/icingaweb/modules/monitoring/instances.ini rename to .puppet/files/etc/icingaweb/modules/monitoring/instances.ini diff --git a/.vagrant-puppet/files/etc/icingaweb/resources.ini b/.puppet/files/etc/icingaweb/resources.ini similarity index 100% rename from .vagrant-puppet/files/etc/icingaweb/resources.ini rename to .puppet/files/etc/icingaweb/resources.ini diff --git a/.vagrant-puppet/files/etc/init.d/icinga_command_proxy b/.puppet/files/etc/init.d/icinga_command_proxy similarity index 100% rename from .vagrant-puppet/files/etc/init.d/icinga_command_proxy rename to .puppet/files/etc/init.d/icinga_command_proxy diff --git a/.vagrant-puppet/files/etc/motd b/.puppet/files/etc/motd similarity index 100% rename from .vagrant-puppet/files/etc/motd rename to .puppet/files/etc/motd diff --git a/.vagrant-puppet/files/etc/profile.d/env.sh b/.puppet/files/etc/profile.d/env.sh similarity index 100% rename from .vagrant-puppet/files/etc/profile.d/env.sh rename to .puppet/files/etc/profile.d/env.sh diff --git a/.vagrant-puppet/files/usr/local/bin/icinga_command_proxy b/.puppet/files/usr/local/bin/icinga_command_proxy similarity index 100% rename from .vagrant-puppet/files/usr/local/bin/icinga_command_proxy rename to .puppet/files/usr/local/bin/icinga_command_proxy diff --git a/.vagrant-puppet/files/var/www/html/icingaweb/index.php b/.puppet/files/var/www/html/icingaweb/index.php similarity index 100% rename from .vagrant-puppet/files/var/www/html/icingaweb/index.php rename to .puppet/files/var/www/html/icingaweb/index.php diff --git a/.vagrant-puppet/manifests/default.pp b/.puppet/manifests/default.pp similarity index 100% rename from .vagrant-puppet/manifests/default.pp rename to .puppet/manifests/default.pp diff --git a/.vagrant-puppet/manifests/default.pp.old b/.puppet/manifests/default.pp.old similarity index 100% rename from .vagrant-puppet/manifests/default.pp.old rename to .puppet/manifests/default.pp.old diff --git a/.vagrant-puppet/manifests/finalize.sh b/.puppet/manifests/finalize.sh similarity index 100% rename from .vagrant-puppet/manifests/finalize.sh rename to .puppet/manifests/finalize.sh diff --git a/.vagrant-puppet/modules/apache/manifests/init.pp b/.puppet/modules/apache/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/apache/manifests/init.pp rename to .puppet/modules/apache/manifests/init.pp diff --git a/.vagrant-puppet/modules/casperjs/manifests/init.pp b/.puppet/modules/casperjs/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/casperjs/manifests/init.pp rename to .puppet/modules/casperjs/manifests/init.pp diff --git a/.vagrant-puppet/modules/cmmi/manifests/init.pp b/.puppet/modules/cmmi/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/cmmi/manifests/init.pp rename to .puppet/modules/cmmi/manifests/init.pp diff --git a/.vagrant-puppet/modules/cmmi_dir/manifests/init.pp b/.puppet/modules/cmmi_dir/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/cmmi_dir/manifests/init.pp rename to .puppet/modules/cmmi_dir/manifests/init.pp diff --git a/.vagrant-puppet/modules/configure/manifests/init.pp b/.puppet/modules/configure/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/configure/manifests/init.pp rename to .puppet/modules/configure/manifests/init.pp diff --git a/.vagrant-puppet/modules/cpan/manifests/init.pp b/.puppet/modules/cpan/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/cpan/manifests/init.pp rename to .puppet/modules/cpan/manifests/init.pp diff --git a/.vagrant-puppet/modules/cpan/templates/MyConfig.pm.erb b/.puppet/modules/cpan/templates/MyConfig.pm.erb similarity index 100% rename from .vagrant-puppet/modules/cpan/templates/MyConfig.pm.erb rename to .puppet/modules/cpan/templates/MyConfig.pm.erb diff --git a/.vagrant-puppet/modules/epel/manifests/init.pp b/.puppet/modules/epel/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/epel/manifests/init.pp rename to .puppet/modules/epel/manifests/init.pp diff --git a/.vagrant-puppet/modules/gcc/manifests/init.pp b/.puppet/modules/gcc/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/gcc/manifests/init.pp rename to .puppet/modules/gcc/manifests/init.pp diff --git a/.vagrant-puppet/modules/git/manifests/init.pp b/.puppet/modules/git/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/git/manifests/init.pp rename to .puppet/modules/git/manifests/init.pp diff --git a/.vagrant-puppet/modules/git_cmmi/manifests/init.pp b/.puppet/modules/git_cmmi/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/git_cmmi/manifests/init.pp rename to .puppet/modules/git_cmmi/manifests/init.pp diff --git a/.vagrant-puppet/modules/icinga/templates/ido2db-mysql.cfg.erb b/.puppet/modules/icinga/templates/ido2db-mysql.cfg.erb similarity index 100% rename from .vagrant-puppet/modules/icinga/templates/ido2db-mysql.cfg.erb rename to .puppet/modules/icinga/templates/ido2db-mysql.cfg.erb diff --git a/.vagrant-puppet/modules/icinga/templates/ido2db-pgsql.cfg.erb b/.puppet/modules/icinga/templates/ido2db-pgsql.cfg.erb similarity index 100% rename from .vagrant-puppet/modules/icinga/templates/ido2db-pgsql.cfg.erb rename to .puppet/modules/icinga/templates/ido2db-pgsql.cfg.erb diff --git a/.vagrant-puppet/modules/icinga2/manifests/config.pp b/.puppet/modules/icinga2/manifests/config.pp similarity index 100% rename from .vagrant-puppet/modules/icinga2/manifests/config.pp rename to .puppet/modules/icinga2/manifests/config.pp diff --git a/.vagrant-puppet/modules/icinga2/manifests/feature.pp b/.puppet/modules/icinga2/manifests/feature.pp similarity index 100% rename from .vagrant-puppet/modules/icinga2/manifests/feature.pp rename to .puppet/modules/icinga2/manifests/feature.pp diff --git a/.vagrant-puppet/modules/icinga2/manifests/init.pp b/.puppet/modules/icinga2/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/icinga2/manifests/init.pp rename to .puppet/modules/icinga2/manifests/init.pp diff --git a/.vagrant-puppet/modules/icinga2_mysql/files/features-available/ido-mysql.conf b/.puppet/modules/icinga2_mysql/files/features-available/ido-mysql.conf similarity index 100% rename from .vagrant-puppet/modules/icinga2_mysql/files/features-available/ido-mysql.conf rename to .puppet/modules/icinga2_mysql/files/features-available/ido-mysql.conf diff --git a/.vagrant-puppet/modules/icinga2_mysql/manifests/init.pp b/.puppet/modules/icinga2_mysql/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/icinga2_mysql/manifests/init.pp rename to .puppet/modules/icinga2_mysql/manifests/init.pp diff --git a/.vagrant-puppet/modules/icinga2_pgsql/files/features-available/ido-pgsql.conf b/.puppet/modules/icinga2_pgsql/files/features-available/ido-pgsql.conf similarity index 100% rename from .vagrant-puppet/modules/icinga2_pgsql/files/features-available/ido-pgsql.conf rename to .puppet/modules/icinga2_pgsql/files/features-available/ido-pgsql.conf diff --git a/.vagrant-puppet/modules/icinga2_pgsql/manifests/init.pp b/.puppet/modules/icinga2_pgsql/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/icinga2_pgsql/manifests/init.pp rename to .puppet/modules/icinga2_pgsql/manifests/init.pp diff --git a/.vagrant-puppet/modules/icinga_packages/manifests/init.pp b/.puppet/modules/icinga_packages/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/icinga_packages/manifests/init.pp rename to .puppet/modules/icinga_packages/manifests/init.pp diff --git a/.vagrant-puppet/modules/icingacli/manifests/init.pp b/.puppet/modules/icingacli/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/icingacli/manifests/init.pp rename to .puppet/modules/icingacli/manifests/init.pp diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config.pp b/.puppet/modules/icingaweb2/manifests/config.pp similarity index 100% rename from .vagrant-puppet/modules/icingaweb2/manifests/config.pp rename to .puppet/modules/icingaweb2/manifests/config.pp diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config/general.pp b/.puppet/modules/icingaweb2/manifests/config/general.pp similarity index 100% rename from .vagrant-puppet/modules/icingaweb2/manifests/config/general.pp rename to .puppet/modules/icingaweb2/manifests/config/general.pp diff --git a/.vagrant-puppet/modules/icingaweb2/manifests/config/module.pp b/.puppet/modules/icingaweb2/manifests/config/module.pp similarity index 100% rename from .vagrant-puppet/modules/icingaweb2/manifests/config/module.pp rename to .puppet/modules/icingaweb2/manifests/config/module.pp diff --git a/.vagrant-puppet/modules/mk-livestatus/templates/mk-livestatus.cfg.erb b/.puppet/modules/mk-livestatus/templates/mk-livestatus.cfg.erb similarity index 100% rename from .vagrant-puppet/modules/mk-livestatus/templates/mk-livestatus.cfg.erb rename to .puppet/modules/mk-livestatus/templates/mk-livestatus.cfg.erb diff --git a/.vagrant-puppet/modules/monitoring_plugins/manifests/init.pp b/.puppet/modules/monitoring_plugins/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/monitoring_plugins/manifests/init.pp rename to .puppet/modules/monitoring_plugins/manifests/init.pp diff --git a/.vagrant-puppet/modules/monitoring_test_config/manifests/init.pp b/.puppet/modules/monitoring_test_config/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/monitoring_test_config/manifests/init.pp rename to .puppet/modules/monitoring_test_config/manifests/init.pp diff --git a/.vagrant-puppet/modules/monitoring_test_config/manifests/populate_plugins.pp b/.puppet/modules/monitoring_test_config/manifests/populate_plugins.pp similarity index 100% rename from .vagrant-puppet/modules/monitoring_test_config/manifests/populate_plugins.pp rename to .puppet/modules/monitoring_test_config/manifests/populate_plugins.pp diff --git a/.vagrant-puppet/modules/mysql/manifests/database/create.pp b/.puppet/modules/mysql/manifests/database/create.pp similarity index 100% rename from .vagrant-puppet/modules/mysql/manifests/database/create.pp rename to .puppet/modules/mysql/manifests/database/create.pp diff --git a/.vagrant-puppet/modules/mysql/manifests/database/populate.pp b/.puppet/modules/mysql/manifests/database/populate.pp similarity index 100% rename from .vagrant-puppet/modules/mysql/manifests/database/populate.pp rename to .puppet/modules/mysql/manifests/database/populate.pp diff --git a/.vagrant-puppet/modules/mysql/manifests/init.pp b/.puppet/modules/mysql/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/mysql/manifests/init.pp rename to .puppet/modules/mysql/manifests/init.pp diff --git a/.vagrant-puppet/modules/mysql/templates/my.cnf.erb b/.puppet/modules/mysql/templates/my.cnf.erb similarity index 100% rename from .vagrant-puppet/modules/mysql/templates/my.cnf.erb rename to .puppet/modules/mysql/templates/my.cnf.erb diff --git a/.vagrant-puppet/modules/openldap/manifests/init.pp b/.puppet/modules/openldap/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/openldap/manifests/init.pp rename to .puppet/modules/openldap/manifests/init.pp diff --git a/.vagrant-puppet/modules/parent_dirs/manifests/init.pp b/.puppet/modules/parent_dirs/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/parent_dirs/manifests/init.pp rename to .puppet/modules/parent_dirs/manifests/init.pp diff --git a/.vagrant-puppet/modules/perl/manifests/init.pp b/.puppet/modules/perl/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/perl/manifests/init.pp rename to .puppet/modules/perl/manifests/init.pp diff --git a/.vagrant-puppet/modules/pgsql/manifests/database/create.pp b/.puppet/modules/pgsql/manifests/database/create.pp similarity index 100% rename from .vagrant-puppet/modules/pgsql/manifests/database/create.pp rename to .puppet/modules/pgsql/manifests/database/create.pp diff --git a/.vagrant-puppet/modules/pgsql/manifests/database/populate.pp b/.puppet/modules/pgsql/manifests/database/populate.pp similarity index 100% rename from .vagrant-puppet/modules/pgsql/manifests/database/populate.pp rename to .puppet/modules/pgsql/manifests/database/populate.pp diff --git a/.vagrant-puppet/modules/pgsql/manifests/init.pp b/.puppet/modules/pgsql/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/pgsql/manifests/init.pp rename to .puppet/modules/pgsql/manifests/init.pp diff --git a/.vagrant-puppet/modules/pgsql/templates/pg_hba.conf.erb b/.puppet/modules/pgsql/templates/pg_hba.conf.erb similarity index 100% rename from .vagrant-puppet/modules/pgsql/templates/pg_hba.conf.erb rename to .puppet/modules/pgsql/templates/pg_hba.conf.erb diff --git a/.vagrant-puppet/modules/phantomjs/manifests/init.pp b/.puppet/modules/phantomjs/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/phantomjs/manifests/init.pp rename to .puppet/modules/phantomjs/manifests/init.pp diff --git a/.vagrant-puppet/modules/php/manifests/extension.pp b/.puppet/modules/php/manifests/extension.pp similarity index 100% rename from .vagrant-puppet/modules/php/manifests/extension.pp rename to .puppet/modules/php/manifests/extension.pp diff --git a/.vagrant-puppet/modules/php/manifests/init.pp b/.puppet/modules/php/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/php/manifests/init.pp rename to .puppet/modules/php/manifests/init.pp diff --git a/.vagrant-puppet/modules/php/templates/error_reporting.ini.erb b/.puppet/modules/php/templates/error_reporting.ini.erb similarity index 100% rename from .vagrant-puppet/modules/php/templates/error_reporting.ini.erb rename to .puppet/modules/php/templates/error_reporting.ini.erb diff --git a/.vagrant-puppet/modules/php/templates/xdebug_settings.ini.erb b/.puppet/modules/php/templates/xdebug_settings.ini.erb similarity index 100% rename from .vagrant-puppet/modules/php/templates/xdebug_settings.ini.erb rename to .puppet/modules/php/templates/xdebug_settings.ini.erb diff --git a/.vagrant-puppet/modules/tar/manifests/init.pp b/.puppet/modules/tar/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/tar/manifests/init.pp rename to .puppet/modules/tar/manifests/init.pp diff --git a/.vagrant-puppet/modules/wget/manifests/init.pp b/.puppet/modules/wget/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/wget/manifests/init.pp rename to .puppet/modules/wget/manifests/init.pp diff --git a/.vagrant-puppet/modules/zend_framework/manifests/init.pp b/.puppet/modules/zend_framework/manifests/init.pp similarity index 100% rename from .vagrant-puppet/modules/zend_framework/manifests/init.pp rename to .puppet/modules/zend_framework/manifests/init.pp diff --git a/.vagrant-puppet/profiles/icinga2_dev/files/conf.d/commands.conf b/.puppet/profiles/icinga2_dev/files/conf.d/commands.conf similarity index 100% rename from .vagrant-puppet/profiles/icinga2_dev/files/conf.d/commands.conf rename to .puppet/profiles/icinga2_dev/files/conf.d/commands.conf diff --git a/.vagrant-puppet/profiles/icinga2_dev/files/conf.d/test-config.conf b/.puppet/profiles/icinga2_dev/files/conf.d/test-config.conf similarity index 100% rename from .vagrant-puppet/profiles/icinga2_dev/files/conf.d/test-config.conf rename to .puppet/profiles/icinga2_dev/files/conf.d/test-config.conf diff --git a/.vagrant-puppet/profiles/icinga2_dev/files/constants.conf b/.puppet/profiles/icinga2_dev/files/constants.conf similarity index 100% rename from .vagrant-puppet/profiles/icinga2_dev/files/constants.conf rename to .puppet/profiles/icinga2_dev/files/constants.conf diff --git a/.vagrant-puppet/profiles/icinga2_dev/manifests/init.pp b/.puppet/profiles/icinga2_dev/manifests/init.pp similarity index 100% rename from .vagrant-puppet/profiles/icinga2_dev/manifests/init.pp rename to .puppet/profiles/icinga2_dev/manifests/init.pp diff --git a/.vagrant-puppet/profiles/icinga_mysql/manifests/init.pp b/.puppet/profiles/icinga_mysql/manifests/init.pp similarity index 100% rename from .vagrant-puppet/profiles/icinga_mysql/manifests/init.pp rename to .puppet/profiles/icinga_mysql/manifests/init.pp diff --git a/.vagrant-puppet/profiles/icinga_pgsql/manifests/init.pp b/.puppet/profiles/icinga_pgsql/manifests/init.pp similarity index 100% rename from .vagrant-puppet/profiles/icinga_pgsql/manifests/init.pp rename to .puppet/profiles/icinga_pgsql/manifests/init.pp diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/authentication.ini b/.puppet/profiles/icingaweb2_dev/files/authentication.ini similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/files/authentication.ini rename to .puppet/profiles/icingaweb2_dev/files/authentication.ini diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/config.ini b/.puppet/profiles/icingaweb2_dev/files/config.ini similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/files/config.ini rename to .puppet/profiles/icingaweb2_dev/files/config.ini diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini b/.puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini rename to .puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/config.ini b/.puppet/profiles/icingaweb2_dev/files/modules/monitoring/config.ini similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/config.ini rename to .puppet/profiles/icingaweb2_dev/files/modules/monitoring/config.ini diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/instances.ini b/.puppet/profiles/icingaweb2_dev/files/modules/monitoring/instances.ini similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/files/modules/monitoring/instances.ini rename to .puppet/profiles/icingaweb2_dev/files/modules/monitoring/instances.ini diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/openldap/db.ldif b/.puppet/profiles/icingaweb2_dev/files/openldap/db.ldif similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/files/openldap/db.ldif rename to .puppet/profiles/icingaweb2_dev/files/openldap/db.ldif diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/openldap/dit.ldif b/.puppet/profiles/icingaweb2_dev/files/openldap/dit.ldif similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/files/openldap/dit.ldif rename to .puppet/profiles/icingaweb2_dev/files/openldap/dit.ldif diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/openldap/users.ldif b/.puppet/profiles/icingaweb2_dev/files/openldap/users.ldif similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/files/openldap/users.ldif rename to .puppet/profiles/icingaweb2_dev/files/openldap/users.ldif diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/files/resources.ini b/.puppet/profiles/icingaweb2_dev/files/resources.ini similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/files/resources.ini rename to .puppet/profiles/icingaweb2_dev/files/resources.ini diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.puppet/profiles/icingaweb2_dev/manifests/init.pp similarity index 100% rename from .vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp rename to .puppet/profiles/icingaweb2_dev/manifests/init.pp diff --git a/.vagrant-puppet/profiles/nodejs/manifests/init.pp b/.puppet/profiles/nodejs/manifests/init.pp similarity index 100% rename from .vagrant-puppet/profiles/nodejs/manifests/init.pp rename to .puppet/profiles/nodejs/manifests/init.pp From 9b6c90bf985e0bededeaef72bbb0826c46b35528 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 10 Dec 2014 16:03:47 +0100 Subject: [PATCH 178/238] git: Fix .puppet path --- .gitattributes | 2 +- .gitignore | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index 35002d0cb..40b06093e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,4 +2,4 @@ .git* export-ignore # Normalize puppet manifests' line endings to LF on checkin and prevent conversion to CRLF when the files are checked out -.vagrant-puppet/* eol=lf +.puppet* eol=lf diff --git a/.gitignore b/.gitignore index df08870cd..6c60b5fbb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ # Except those related to git and vagrant !.git* -!.vagrant-puppet* +!.puppet* # Exclude application log files var/log/* From 73f9328f12a4f3c41c138e77ad2e92a588f1ca59 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 11 Dec 2014 10:54:58 +0100 Subject: [PATCH 179/238] Highlight hovered state rows even if there is no href fixes #8024 --- public/css/icinga/monitoring-colors.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/css/icinga/monitoring-colors.less b/public/css/icinga/monitoring-colors.less index 52154c24e..538d82a3a 100644 --- a/public/css/icinga/monitoring-colors.less +++ b/public/css/icinga/monitoring-colors.less @@ -194,7 +194,7 @@ tr.state.handled td.state { } /* HOVER colors */ -tr[href]:hover { +tr.state:hover, tr[href]:hover { color: black; background-color: #eee; } From 8779e802913e7e90b8658984aa4f6a6a4686611e Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 11 Dec 2014 10:56:47 +0100 Subject: [PATCH 180/238] Add a link to a service's event when showing the host's history --- .../application/views/scripts/show/history.phtml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/scripts/show/history.phtml b/modules/monitoring/application/views/scripts/show/history.phtml index dfc1cbf0e..c28c59762 100644 --- a/modules/monitoring/application/views/scripts/show/history.phtml +++ b/modules/monitoring/application/views/scripts/show/history.phtml @@ -13,6 +13,7 @@ getType() === 'host'; function contactsLink($match, $view) { $links = array(); foreach (preg_split('/,\s/', $match[1]) as $contact) { @@ -132,7 +133,13 @@ $output = $this->tickets ? preg_replace_callback( ?> - escape($event->service_description) . ' ' . $this->translate('on') . ' ' . $this->escape($event->host_name); ?> + qlink( + $this->escape($event->service_description), + 'monitoring/show/service', + array( + 'host' => $event->host_name, + 'service' => $event->service_description) + ) : $this->escape($event->service_description); ?> translate('on') . ' ' . $this->escape($event->host_name); ?> escape($event->host_name); ?> From 60feed55b759422e5729c9c49ce948cbaed50570 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 11 Dec 2014 13:15:33 +0100 Subject: [PATCH 181/238] Update Icinga 2 config for 2.3 refs #7883 --- .../files/etc/icinga2/conf.d/test-config.conf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf b/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf index 2dde681bf..a0abd4c20 100644 --- a/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf +++ b/.vagrant-puppet/files/etc/icinga2/conf.d/test-config.conf @@ -47,7 +47,7 @@ object HostGroup "all-hosts" { local host_types = ["ok", "random", "down", "up", "unreachable", "pending"] -__for (host_type in host_types) { +for (host_type in host_types) { object HostGroup "all-" + host_type use (host_type) { display_name = "All " + host_type + " hosts" assign where host.vars.check_type == host_type @@ -57,7 +57,7 @@ __for (host_type in host_types) { local service_types = ["ok", "warning", "critical", "unknown", "flapping", "pending"] // Servicegroups -__for (service_type in service_types) { +for (service_type in service_types) { object ServiceGroup "service-" + service_type use (service_type) { display_name = "All " + service_type + " services" assign where service.vars.check_type == service_type @@ -68,7 +68,7 @@ __for (service_type in service_types) { // Services // --------------------------------------------------------------------------------------------------------------------- -__function createService(service_type, num) { +function createService(service_type, num) { apply Service "service-" + service_type + "-" + string(num + 1) use (service_type) { import "generic-service" @@ -80,8 +80,8 @@ __function createService(service_type, num) { } } -__for (num in range(4)) { - __for (service_type in service_types) { +for (num in range(4)) { + for (service_type in service_types) { createService(service_type, num) } } @@ -90,7 +90,7 @@ __for (num in range(4)) { // Hosts // --------------------------------------------------------------------------------------------------------------------- -__function createHost(checkType, checkConfig, num, checkEnabled) { +function createHost(checkType, checkConfig, num, checkEnabled) { object Host "test-" + checkType + "-" + string(num + 1) use (checkEnabled, checkType, checkConfig) { import "generic-host" address = "127.0.0.1" @@ -101,7 +101,7 @@ __function createHost(checkType, checkConfig, num, checkEnabled) { } } -__for (num in range(10)) { +for (num in range(10)) { createHost("ok", [ "ok" ], num, true) createHost("random", [ "random", "flapping" ], num, true) createHost("down", [ "warning", "critical" ], num, true) From ddc121d1ccab73e991273a77936c2af690ec3716 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 11 Dec 2014 15:52:23 +0100 Subject: [PATCH 182/238] Add ProcessCheckResultCommandForm refs #6854 --- .../controllers/HostController.php | 10 ++ .../controllers/HostsController.php | 11 ++ .../controllers/ServiceController.php | 10 ++ .../controllers/ServicesController.php | 13 ++ .../Object/ProcessCheckResultCommandForm.php | 123 ++++++++++++++++++ .../views/scripts/hosts/show.phtml | 7 + .../views/scripts/services/show.phtml | 7 + .../scripts/show/components/command.phtml | 16 ++- 8 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php diff --git a/modules/monitoring/application/controllers/HostController.php b/modules/monitoring/application/controllers/HostController.php index 0a4a727ed..184e05a4c 100644 --- a/modules/monitoring/application/controllers/HostController.php +++ b/modules/monitoring/application/controllers/HostController.php @@ -2,6 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} +use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\AcknowledgeProblemCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\AddCommentCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleHostCheckCommandForm; @@ -76,4 +77,13 @@ class Monitoring_HostController extends MonitoredObjectController $this->view->title = $this->translate('Schedule Host Downtime'); $this->handleCommandForm(new ScheduleHostDowntimeCommandForm()); } + + /** + * Submit a passive host check result + */ + public function processCheckResultAction() + { + $this->view->title = $this->translate('Submit Passive Host Check Result'); + $this->handleCommandForm(new ProcessCheckResultCommandForm()); + } } diff --git a/modules/monitoring/application/controllers/HostsController.php b/modules/monitoring/application/controllers/HostsController.php index fe34c1d6f..4aa090572 100644 --- a/modules/monitoring/application/controllers/HostsController.php +++ b/modules/monitoring/application/controllers/HostsController.php @@ -4,6 +4,7 @@ use Icinga\Data\Filter\Filter; use Icinga\Module\Monitoring\Controller; +use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\AcknowledgeProblemCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\CheckNowCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ObjectsCommandForm; @@ -103,6 +104,7 @@ class Monitoring_HostsController extends Controller $this->view->listAllLink = Url::fromRequest()->setPath('monitoring/list/hosts'); $this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/hosts/reschedule-check'); $this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/hosts/schedule-downtime'); + $this->view->processCheckResultAllLink = Url::fromRequest()->setPath('monitoring/hosts/process-check-result'); $this->view->hostStates = $hostStates; $this->view->objects = $this->hostList; $this->view->unhandledObjects = $unhandledObjects; @@ -161,4 +163,13 @@ class Monitoring_HostsController extends Controller $this->view->title = $this->translate('Schedule Host Downtimes'); $this->handleCommandForm(new ScheduleHostDowntimeCommandForm()); } + + /** + * Submit passive host check results + */ + public function processCheckResultAction() + { + $this->view->title = $this->translate('Submit Passive Host Check Results'); + $this->handleCommandForm(new ProcessCheckResultCommandForm()); + } } diff --git a/modules/monitoring/application/controllers/ServiceController.php b/modules/monitoring/application/controllers/ServiceController.php index c6d0e4e2f..70aa9e519 100644 --- a/modules/monitoring/application/controllers/ServiceController.php +++ b/modules/monitoring/application/controllers/ServiceController.php @@ -2,6 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} +use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\AcknowledgeProblemCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\AddCommentCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleServiceCheckCommandForm; @@ -76,4 +77,13 @@ class Monitoring_ServiceController extends MonitoredObjectController $this->view->title = $this->translate('Schedule Service Downtime'); $this->handleCommandForm(new ScheduleServiceDowntimeCommandForm()); } + + /** + * Submit a passive service check result + */ + public function processCheckResultAction() + { + $this->view->title = $this->translate('Submit Passive Service Check Result'); + $this->handleCommandForm(new ProcessCheckResultCommandForm()); + } } diff --git a/modules/monitoring/application/controllers/ServicesController.php b/modules/monitoring/application/controllers/ServicesController.php index 56813180d..bbe2024d7 100644 --- a/modules/monitoring/application/controllers/ServicesController.php +++ b/modules/monitoring/application/controllers/ServicesController.php @@ -4,6 +4,7 @@ use Icinga\Data\Filter\Filter; use Icinga\Module\Monitoring\Controller; +use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\AcknowledgeProblemCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\CheckNowCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ObjectsCommandForm; @@ -117,6 +118,9 @@ class Monitoring_ServicesController extends Controller $this->view->listAllLink = Url::fromRequest()->setPath('monitoring/list/services'); $this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/services/reschedule-check'); $this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/services/schedule-downtime'); + $this->view->processCheckResultAllLink = Url::fromRequest()->setPath( + 'monitoring/services/process-check-result' + ); $this->view->hostStates = $hostStates; $this->view->serviceStates = $serviceStates; $this->view->objects = $this->serviceList; @@ -181,4 +185,13 @@ class Monitoring_ServicesController extends Controller $this->view->title = $this->translate('Schedule Service Downtimes'); $this->handleCommandForm(new ScheduleServiceDowntimeCommandForm()); } + + /** + * Submit passive service check results + */ + public function processCheckResultAction() + { + $this->view->title = $this->translate('Submit Passive Service Check Results'); + $this->handleCommandForm(new ProcessCheckResultCommandForm()); + } } diff --git a/modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php b/modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php new file mode 100644 index 000000000..48ee00ab3 --- /dev/null +++ b/modules/monitoring/application/forms/Command/Object/ProcessCheckResultCommandForm.php @@ -0,0 +1,123 @@ +objects) + ); + } + + /** + * (non-PHPDoc) + * @see \Icinga\Module\Monitoring\Forms\Command\CommandForm::getHelp() For the method documentation. + */ + public function getHelp() + { + return mt( + 'monitoring', + 'This command is used to submit passive host or service check results.' + ); + } + + /** + * (non-PHPDoc) + * @see \Icinga\Web\Form::createElements() For the method documentation. + */ + public function createElements(array $formData) + { + foreach ($this->getObjects() as $object) { + /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */ + // Nasty, but as getObjects() returns everything but an object with a real + // iterator interface this is the only way to fetch just the first element + break; + } + + $this->addElement( + 'select', + 'status', + array( + 'required' => true, + 'label' => mt('monitoring', 'Status'), + 'description' => mt('monitoring', 'The state this check result should report'), + 'multiOptions' => $object->getType() === $object::TYPE_HOST ? array( + ProcessCheckResultCommand::HOST_UP => mt('monitoring', 'UP', 'icinga.state'), + ProcessCheckResultCommand::HOST_DOWN => mt('monitoring', 'DOWN', 'icinga.state'), + ProcessCheckResultCommand::HOST_UNREACHABLE => mt('monitoring', 'UNREACHABLE', 'icinga.state') + ) : array( + ProcessCheckResultCommand::SERVICE_OK => mt('monitoring', 'OK', 'icinga.state'), + ProcessCheckResultCommand::SERVICE_WARNING => mt('monitoring', 'WARNING', 'icinga.state'), + ProcessCheckResultCommand::SERVICE_CRITICAL => mt('monitoring', 'CRITICAL', 'icinga.state'), + ProcessCheckResultCommand::SERVICE_UNKNOWN => mt('monitoring', 'UNKNOWN', 'icinga.state') + ) + ) + ); + $this->addElement( + 'text', + 'output', + array( + 'required' => true, + 'label' => mt('monitoring', 'Output'), + 'description' => mt('monitoring', 'The plugin output of this check result') + ) + ); + $this->addElement( + 'text', + 'perfdata', + array( + 'allowEmpty' => true, + 'label' => mt('monitoring', 'Performance Data'), + 'description' => mt( + 'monitoring', + 'The performance data of this check result. Leave empty' + . ' if this check result has no performance data' + ) + ) + ); + } + + /** + * (non-PHPDoc) + * @see \Icinga\Web\Form::onSuccess() For the method documentation. + */ + public function onSuccess() + { + foreach ($this->objects as $object) { + /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */ + $command = new ProcessCheckResultCommand(); + $command->setObject($object); + $command->setStatus($this->getValue('status')); + $command->setOutput($this->getValue('output')); + + if ($perfdata = $this->getValue('perfdata')) { + $command->setPerformanceData($perfdata); + } + + $this->getTransport($this->request)->send($command); + } + + Notification::success(mtp( + 'monitoring', + 'Processing check result..', + 'Processing check results..', + count($this->objects) + )); + + return true; + } +} diff --git a/modules/monitoring/application/views/scripts/hosts/show.phtml b/modules/monitoring/application/views/scripts/hosts/show.phtml index 6adc300d8..6ab717635 100644 --- a/modules/monitoring/application/views/scripts/hosts/show.phtml +++ b/modules/monitoring/application/views/scripts/hosts/show.phtml @@ -47,6 +47,13 @@
+ +

+ +

translate('Command') ?> - escape($command) ?> + + escape($command) ?> + passive_checks_enabled): ?> + getType() === $object::TYPE_HOST): ?> + icon('reply'); ?> translate('Process check result'); ?> + + icon('reply'); ?> translate('Process check result'); ?> + + Date: Thu, 11 Dec 2014 15:53:12 +0100 Subject: [PATCH 183/238] Fix wrong command being rendered for passive service check results refs #6854 --- .../Command/Renderer/IcingaCommandFileCommandRenderer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/Command/Renderer/IcingaCommandFileCommandRenderer.php b/modules/monitoring/library/Monitoring/Command/Renderer/IcingaCommandFileCommandRenderer.php index d2dca183c..2843974ea 100644 --- a/modules/monitoring/library/Monitoring/Command/Renderer/IcingaCommandFileCommandRenderer.php +++ b/modules/monitoring/library/Monitoring/Command/Renderer/IcingaCommandFileCommandRenderer.php @@ -126,7 +126,7 @@ class IcingaCommandFileCommandRenderer implements IcingaCommandRendererInterface } else { /** @var \Icinga\Module\Monitoring\Object\Service $object */ $commandString = sprintf( - 'PROCESS_SVC_CHECK_RESULT;%s;%s', + 'PROCESS_SERVICE_CHECK_RESULT;%s;%s', $object->getHost()->getName(), $object->getName() ); From cee68877a9e4938e2f9c4ee82274319d49273a78 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 11 Dec 2014 15:56:23 +0100 Subject: [PATCH 184/238] ProcessCheckResultCommand: Indicate a incompatibility with icinga2 Should be solved by checking the backend's version on runtime --- .../Monitoring/Command/Object/ProcessCheckResultCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/Command/Object/ProcessCheckResultCommand.php b/modules/monitoring/library/Monitoring/Command/Object/ProcessCheckResultCommand.php index 9866aeb52..8e3155de5 100644 --- a/modules/monitoring/library/Monitoring/Command/Object/ProcessCheckResultCommand.php +++ b/modules/monitoring/library/Monitoring/Command/Object/ProcessCheckResultCommand.php @@ -34,7 +34,7 @@ class ProcessCheckResultCommand extends ObjectCommand /** * Host unreachable */ - const HOST_UNREACHABLE = 2; + const HOST_UNREACHABLE = 2; // TODO: Icinga 2.x does not support submitting results with this state, yet /** * Service ok From e63252cb049816e0fd0960f1159293f5c1649c13 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 11 Dec 2014 18:00:36 +0100 Subject: [PATCH 185/238] Fix that the RuntimeVariables helper cant handle missing information fixes #7905 --- .../views/helpers/RuntimeVariables.php | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/modules/monitoring/application/views/helpers/RuntimeVariables.php b/modules/monitoring/application/views/helpers/RuntimeVariables.php index fa9b639a8..556bd43ad 100644 --- a/modules/monitoring/application/views/helpers/RuntimeVariables.php +++ b/modules/monitoring/application/views/helpers/RuntimeVariables.php @@ -27,12 +27,24 @@ class Zend_View_Helper_RuntimeVariables extends Zend_View_Helper_Abstract public function create(stdClass $result) { $out = new stdClass(); - $out->total_hosts = $result->total_hosts; - $out->total_scheduled_hosts = $result->total_scheduled_hosts; - $out->total_services = $result->total_services; - $out->total_scheduled_services = $result->total_scheduled_services; - $out->average_services_per_host = $result->total_services / $result->total_hosts; - $out->average_scheduled_services_per_host = $result->total_scheduled_services / $result->total_scheduled_hosts; + $out->total_hosts = isset($result->total_hosts) + ? $result->total_hosts + : 0; + $out->total_scheduled_hosts = isset($result->total_scheduled_hosts) + ? $result->total_scheduled_hosts + : 0; + $out->total_services = isset($result->total_services) + ? $result->total_services + : 0; + $out->total_scheduled_services = isset($result->total_scheduled_services) + ? $result->total_scheduled_services + : 0; + $out->average_services_per_host = $out->total_hosts > 0 + ? $out->total_services / $out->total_hosts + : 0; + $out->average_scheduled_services_per_host = $out->total_scheduled_hosts > 0 + ? $out->total_scheduled_services / $out->total_scheduled_hosts + : 0; return $out; } From 87664ffef9414e4344e7037de53a9ac9784be5f8 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 12 Dec 2014 10:38:21 +0100 Subject: [PATCH 186/238] Use the Host and Service object class helpers instead of MonitoringState This also ensures that all state names that are shown to the user are properly translated. refs #7996 --- .../application/views/helpers/MonitoringState.php | 9 ++++++--- .../application/views/scripts/list/hosts.phtml | 6 ++++-- .../views/scripts/list/servicegrid.phtml | 7 ++++++- .../application/views/scripts/list/services.phtml | 10 ++++++---- .../views/scripts/show/components/header.phtml | 13 ++++++++++--- 5 files changed, 32 insertions(+), 13 deletions(-) diff --git a/modules/monitoring/application/views/helpers/MonitoringState.php b/modules/monitoring/application/views/helpers/MonitoringState.php index 4db1a7a91..13bd93ea7 100644 --- a/modules/monitoring/application/views/helpers/MonitoringState.php +++ b/modules/monitoring/application/views/helpers/MonitoringState.php @@ -3,7 +3,7 @@ // {{{ICINGA_LICENSE_HEADER}}} /** - * @deprecated Crap. + * @deprecated Most of these helpers are currently only used in the MultiController, which is probably obsolete */ class Zend_View_Helper_MonitoringState extends Zend_View_Helper_Abstract { @@ -11,7 +11,7 @@ class Zend_View_Helper_MonitoringState extends Zend_View_Helper_Abstract private $hoststates = array('up', 'down', 'unreachable', 99 => 'pending', null => 'pending'); /** - * @deprecated The host or service object must know it's possible states. + * @deprecated Not used anywhere. */ public function monitoringState($object, $type = 'service') { @@ -22,6 +22,9 @@ class Zend_View_Helper_MonitoringState extends Zend_View_Helper_Abstract } } + /** + * @deprecated Not used anywhere. + */ public function monitoringStateById($id, $type = 'service') { if ($type === 'service') { @@ -91,7 +94,7 @@ class Zend_View_Helper_MonitoringState extends Zend_View_Helper_Abstract } /** - * @deprecated Not translated. + * @deprecated Not used anywhere. */ public function getStateTitle($object, $type) { diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 588d39712..7f3e73b0b 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -1,4 +1,6 @@ getHelper('MonitoringState'); if ($this->compact): ?> @@ -79,8 +81,8 @@ if ($hosts->count() === 0) { ?> - - monitoringState($host, 'host')) ?>
+ + host_state, true)); ?>
host_state !== 99): ?> prefixedTimeSince($host->host_last_state_change, true) ?> host_state > 0 && (int) $host->host_state_type === 0): ?> diff --git a/modules/monitoring/application/views/scripts/list/servicegrid.phtml b/modules/monitoring/application/views/scripts/list/servicegrid.phtml index 19aef5d64..dd9be0394 100644 --- a/modules/monitoring/application/views/scripts/list/servicegrid.phtml +++ b/modules/monitoring/application/views/scripts/list/servicegrid.phtml @@ -1,3 +1,8 @@ + compact): ?>
tabs; ?> @@ -63,7 +68,7 @@ $hostFilter = '(host_name=' . implode('|host_name=', array_keys($pivotData)) . ' + )); ?>" title="escape($service->service_output); ?>" class="state_service_state); ?> service_handled ? 'handled' : ''; ?>"> · diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 2ea125527..2922abff5 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -1,4 +1,7 @@ getHelper('MonitoringState'); $selfUrl = 'monitoring/list/services'; @@ -54,9 +57,8 @@ foreach ($services as $service): $serviceStateName = strtolower($this->util()->getServiceStateName($service->service_state)); ?> - - translate(strtoupper($helper->monitoringState($service, 'service'))) ?>
- + + service_state, true)); ?>
compact): ?>prefixedTimeSince($service->service_last_state_change); ?>timeSince($service->service_last_state_change); ?> service_state > 0 && (int) $service->service_state_type === 0): ?>
@@ -106,7 +108,7 @@ foreach ($services as $service): service_display_name ?>showHost): ?> on host_name; ?> host_state != 0): ?> - (monitoringState($service, 'host')); ?>) + (host_state, true)); ?>)

escape(substr(strip_tags($service->service_output), 0, 10000)); ?>

diff --git a/modules/monitoring/application/views/scripts/show/components/header.phtml b/modules/monitoring/application/views/scripts/show/components/header.phtml index a2c835e4a..c44602260 100644 --- a/modules/monitoring/application/views/scripts/show/components/header.phtml +++ b/modules/monitoring/application/views/scripts/show/components/header.phtml @@ -1,9 +1,16 @@ -getType() === $object::TYPE_SERVICE ?> +getType() === $object::TYPE_SERVICE; + +?> compact): ?> - + - + diff --git a/modules/monitoring/application/views/scripts/list/eventhistory.phtml b/modules/monitoring/application/views/scripts/list/eventhistory.phtml index c765b41be..a9516aab1 100644 --- a/modules/monitoring/application/views/scripts/list/eventhistory.phtml +++ b/modules/monitoring/application/views/scripts/list/eventhistory.phtml @@ -1,3 +1,10 @@ + + compact): ?>
tabs ?> @@ -62,22 +69,22 @@ case 'hard_state': $icon = $isService ? 'service' : 'host'; $msg = '[ ' . $event->attempt . '/' . $event->max_attempts . ' ] ' . $event->output; - $stateName = ( + $stateName = $isService ? Service::getStateText($event->state) : Host::getStateText($event->state); + $title = strtoupper( $isService - ? strtolower($this->util()->getServiceStateName($event->state)) - : strtolower($this->util()->getHostStateName($event->state)) + ? Service::getStateText($event->state, true) + : Host::getStateText($event->state, true) ); - $title = strtoupper($stateName); // TODO: Should be translatable! break; case 'soft_state': $icon = 'lightbulb'; $msg = '[ ' . $event->attempt . '/' . $event->max_attempts . ' ] ' . $event->output; - $stateName = ( + $stateName = $isService ? Service::getStateText($event->state) : Host::getStateText($event->state); + $title = strtoupper( $isService - ? strtolower($this->util()->getServiceStateName($event->state)) - : strtolower($this->util()->getHostStateName($event->state)) + ? Service::getStateText($event->state, true) + : Host::getStateText($event->state, true) ); - $title = strtoupper($stateName); // TODO: Should be translatable! break; case 'dt_start': $icon = 'starttime'; diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 7f3e73b0b..debef375c 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -43,7 +43,7 @@ if ($hosts->count() === 0) {
util()->getHostStateName($host->host_state)); + $hostStateName = Host::getStateText($host->host_state); $hostLink = $this->href('monitoring/host/show', array('host' => $host->host_name)); $icons = array(); diff --git a/modules/monitoring/application/views/scripts/list/notifications.phtml b/modules/monitoring/application/views/scripts/list/notifications.phtml index 365d32f56..845effbc5 100644 --- a/modules/monitoring/application/views/scripts/list/notifications.phtml +++ b/modules/monitoring/application/views/scripts/list/notifications.phtml @@ -1,3 +1,10 @@ + + compact): ?>
tabs ?> @@ -36,13 +43,13 @@ foreach ($notifications as $notification): 'host' => $notification->host, 'service' => $notification->service )); - $stateName = strtolower($this->util()->getServiceStateName($notification->notification_state)); + $stateName = Service::getStateText($notification->notification_state); } else { $isService = false; $href = $this->href('monitoring/show/host', array( 'host' => $notification->host )); - $stateName = strtolower($this->util()->getHostStateName($notification->notification_state)); + $stateName = Host::getStateText($notification->notification_state); } ?>
diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 2922abff5..bb2953e73 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -54,7 +54,7 @@ foreach ($services as $service): 'host' => $service->host_name, ) ); - $serviceStateName = strtolower($this->util()->getServiceStateName($service->service_state)); + $serviceStateName = Service::getStateText($service->service_state); ?>
> translate($this->util()->getHostStateName($object->host_state)) ?>
prefixedTimeSince($object->host_last_state_change, true) ?> @@ -15,7 +22,7 @@
translate($this->util()->getServiceStateName($object->service_state)) ?>
prefixedTimeSince($object->service_last_state_change, true) ?> From 7987fb3f5a9f4f8728d15038b6682b078bc4097f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 12 Dec 2014 12:22:20 +0100 Subject: [PATCH 187/238] Use the Host and Service object class helpers instead of the Util view helper This also ensures that all state names that are shown to the user are properly translated. refs #7996 --- application/views/helpers/Util.php | 60 ------------------- .../views/scripts/list/downtimes.phtml | 11 +++- .../views/scripts/list/eventhistory.phtml | 23 ++++--- .../views/scripts/list/hosts.phtml | 2 +- .../views/scripts/list/notifications.phtml | 11 +++- .../views/scripts/list/services.phtml | 2 +- .../scripts/show/components/header.phtml | 4 +- .../views/scripts/show/history.phtml | 33 +++++----- 8 files changed, 55 insertions(+), 91 deletions(-) diff --git a/application/views/helpers/Util.php b/application/views/helpers/Util.php index ccc3e8e1c..f3e41244f 100644 --- a/application/views/helpers/Util.php +++ b/application/views/helpers/Util.php @@ -63,64 +63,4 @@ class Zend_View_Helper_Util extends Zend_View_Helper_Abstract } return date('H:i d.m.Y', $timestamp); } - - /** - * @deprecated Not used. This is monitoring module stuff. - */ - public static function getHostStateClassName($state) - { - $class = 'unknown'; - switch ($state) { - case null: - $class = 'error'; - break; - case 0: - $class = 'ok'; - break; - case 1: - case 2: - $class = 'error'; - break; - } - return $class; - } - - /** - * @deprecated Crap. This is monitoring module stuff. - */ - public static function getHostStateName($state) - { - $states = array( - 0 => 'UP', - 1 => 'DOWN', - 2 => 'UNREACHABLE', - 3 => 'UNKNOWN', - 4 => 'PENDING', // fake - 99 => 'PENDING' // fake - ); - if (isset($states[$state])) { - return $states[$state]; - } - return sprintf('OUT OF BOUNDS (%s)', var_export($state, 1)); - } - - /** - * @deprecated Crap. This is monitoring module stuff. - */ - public static function getServiceStateName($state) - { - if ($state === null) { $state = 3; } // really? - $states = array( - 0 => 'OK', - 1 => 'WARNING', - 2 => 'CRITICAL', - 3 => 'UNKNOWN', - 4 => 'PENDING', // fake - 99 => 'PENDING' // fake - ); - if (isset($states[$state])) { - return $states[$state]; - } - return sprintf('OUT OF BOUND (%d)' . $state, (int) $state); - } } diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml index a1aba403d..37b34fe5e 100644 --- a/modules/monitoring/application/views/scripts/list/downtimes.phtml +++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml @@ -1,3 +1,10 @@ + + compact): ?>
tabs->render($this); ?> @@ -24,9 +31,9 @@ service)) { - $stateName = strtolower($this->util()->getServiceStateName($downtime->service_state)); + $stateName = Service::getStateText($downtime->service_state); } else { - $stateName = strtolower($this->util()->getHostStateName($downtime->host_state)); + $stateName = Host::getStateText($downtime->host_state); } ?>
diff --git a/modules/monitoring/application/views/scripts/show/components/header.phtml b/modules/monitoring/application/views/scripts/show/components/header.phtml index c44602260..ccf7d2d5e 100644 --- a/modules/monitoring/application/views/scripts/show/components/header.phtml +++ b/modules/monitoring/application/views/scripts/show/components/header.phtml @@ -12,7 +12,7 @@ $showService = $object->getType() === $object::TYPE_SERVICE;
> - translate($this->util()->getHostStateName($object->host_state)) ?>
+ host_state, true)); ?>
prefixedTimeSince($object->host_last_state_change, true) ?>
escape($object->host_name) ?>getType() === $object::TYPE_SERVICE;
- translate($this->util()->getServiceStateName($object->service_state)) ?>
+ service_state, true)); ?>
prefixedTimeSince($object->service_last_state_change, true) ?>
translate('Service') ?>: escape($object->service_description) ?> diff --git a/modules/monitoring/application/views/scripts/show/history.phtml b/modules/monitoring/application/views/scripts/show/history.phtml index c28c59762..5b922d4a0 100644 --- a/modules/monitoring/application/views/scripts/show/history.phtml +++ b/modules/monitoring/application/views/scripts/show/history.phtml @@ -1,3 +1,10 @@ + +
render('show/components/header.phtml'); ?>

translate('This Object\'s Event History'); ?>

@@ -33,11 +40,7 @@ function contactsLink($match, $view) { case 'notify': $icon = 'notification'; $title = $this->translate('Notification'); - $stateClass = ( - $isService - ? strtolower($this->util()->getServiceStateName($event->state)) - : strtolower($this->util()->getHostStateName($event->state)) - ); + $stateClass = $isService ? Service::getStateText($event->state) : Host::getStateText($event->state); $msg = preg_replace_callback( '/^\[([^\]]+)\]/', @@ -87,23 +90,23 @@ function contactsLink($match, $view) { break; case 'hard_state': $msg = '[ ' . $event->attempt . '/' . $event->max_attempts . ' ] ' . $this->escape($event->output); - $stateClass = ( - $isService - ? strtolower($this->util()->getServiceStateName($event->state)) - : strtolower($this->util()->getHostStateName($event->state)) - ); + $stateClass = $isService ? Service::getStateText($event->state) : Host::getStateText($event->state); $icon = 'attention-alt'; - $title = strtoupper($stateClass); // TODO: Should be translatable! + $title = strtoupper( + $isService + ? Service::getStateText($event->state) + : Host::getStateText($event->state) + ); break; case 'soft_state': $icon = 'spinner'; $msg = '[ ' . $event->attempt . '/' . $event->max_attempts . ' ] ' . $this->escape($event->output); - $stateClass = ( + $stateClass = $isService ? Service::getStateText($event->state) : Host::getStateText($event->state); + $title = strtoupper( $isService - ? strtolower($this->util()->getServiceStateName($event->state)) - : strtolower($this->util()->getHostStateName($event->state)) + ? Service::getStateText($event->state) + : Host::getStateText($event->state) ); - $title = strtoupper($stateClass); // TODO: Should be translatable! break; case 'dt_start': $icon = 'downtime_start'; From b307fe27913a8cf587c9fd498810f4da43c7fa75 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 12 Dec 2014 12:44:31 +0100 Subject: [PATCH 188/238] Reorder use statements to be in alphabetical order --- modules/monitoring/application/controllers/HostController.php | 2 +- modules/monitoring/application/controllers/HostsController.php | 2 +- .../monitoring/application/controllers/ServiceController.php | 2 +- .../monitoring/application/controllers/ServicesController.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/application/controllers/HostController.php b/modules/monitoring/application/controllers/HostController.php index 184e05a4c..ab62c3756 100644 --- a/modules/monitoring/application/controllers/HostController.php +++ b/modules/monitoring/application/controllers/HostController.php @@ -2,9 +2,9 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\AcknowledgeProblemCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\AddCommentCommandForm; +use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleHostCheckCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleHostDowntimeCommandForm; use Icinga\Module\Monitoring\Object\Host; diff --git a/modules/monitoring/application/controllers/HostsController.php b/modules/monitoring/application/controllers/HostsController.php index 4aa090572..4944cc237 100644 --- a/modules/monitoring/application/controllers/HostsController.php +++ b/modules/monitoring/application/controllers/HostsController.php @@ -4,10 +4,10 @@ use Icinga\Data\Filter\Filter; use Icinga\Module\Monitoring\Controller; -use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\AcknowledgeProblemCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\CheckNowCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ObjectsCommandForm; +use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\RemoveAcknowledgementCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleHostCheckCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleHostDowntimeCommandForm; diff --git a/modules/monitoring/application/controllers/ServiceController.php b/modules/monitoring/application/controllers/ServiceController.php index 70aa9e519..06417cc6e 100644 --- a/modules/monitoring/application/controllers/ServiceController.php +++ b/modules/monitoring/application/controllers/ServiceController.php @@ -2,9 +2,9 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\AcknowledgeProblemCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\AddCommentCommandForm; +use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleServiceCheckCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleServiceDowntimeCommandForm; use Icinga\Module\Monitoring\Object\Service; diff --git a/modules/monitoring/application/controllers/ServicesController.php b/modules/monitoring/application/controllers/ServicesController.php index bbe2024d7..cdf86f460 100644 --- a/modules/monitoring/application/controllers/ServicesController.php +++ b/modules/monitoring/application/controllers/ServicesController.php @@ -4,10 +4,10 @@ use Icinga\Data\Filter\Filter; use Icinga\Module\Monitoring\Controller; -use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\AcknowledgeProblemCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\CheckNowCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ObjectsCommandForm; +use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\RemoveAcknowledgementCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleServiceCheckCommandForm; use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleServiceDowntimeCommandForm; From 275976cecc688d95611429f5ffb457ad0ac24869 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 09:57:16 +0100 Subject: [PATCH 189/238] puppet: Let icingaweb2::config::general use templates refs #6842 --- .puppet/modules/icingaweb2/manifests/config/general.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.puppet/modules/icingaweb2/manifests/config/general.pp b/.puppet/modules/icingaweb2/manifests/config/general.pp index ba958ba80..c2daec83f 100644 --- a/.puppet/modules/icingaweb2/manifests/config/general.pp +++ b/.puppet/modules/icingaweb2/manifests/config/general.pp @@ -6,7 +6,7 @@ define icingaweb2::config::general ( include icingaweb2::config file { "${config}/${name}.ini": - source => "${source}/${name}.ini", + content => template("${source}/${name}.ini.erb"), owner => 'root', group => 'icingaweb', mode => 0660, From 023b3c5e6487724c1b5ebd76c6365849be8d9cb5 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 09:57:54 +0100 Subject: [PATCH 190/238] puppet: Move config.ini to icingaweb2_dev's templates directory refs #6842 --- .../profiles/icingaweb2_dev/files/config.ini | 26 ------------------- .../icingaweb2_dev/templates/config.ini.erb | 7 +++++ 2 files changed, 7 insertions(+), 26 deletions(-) delete mode 100644 .puppet/profiles/icingaweb2_dev/files/config.ini create mode 100644 .puppet/profiles/icingaweb2_dev/templates/config.ini.erb diff --git a/.puppet/profiles/icingaweb2_dev/files/config.ini b/.puppet/profiles/icingaweb2_dev/files/config.ini deleted file mode 100644 index 0b0d03106..000000000 --- a/.puppet/profiles/icingaweb2_dev/files/config.ini +++ /dev/null @@ -1,26 +0,0 @@ -[logging] -; Writing to a Stream -log = "file" -; Write data to the following file -file = "/var/log/icingaweb.log" -; Write data to a PHP stream -;file = "php://output" - -; Writing to the System Log -;log = "syslog" -; Prefix all syslog messages generated with the string "icingaweb" -;application = "icingaweb" -;facility = "LOG_USER" - -level = DEBUG -; The default level is ERROR, which means that only events of this level (and -; above) will be tracked. Level names descend in order of importance where -; ERROR is the most important level and DEBUG is the least important level: -; -; ERROR - Error: error conditions -; WARNING - Warning: warning conditions -; INFO - Informational: informational messages -; DEBUG - Debug: debug messages - -[preferences] -type = "ini" diff --git a/.puppet/profiles/icingaweb2_dev/templates/config.ini.erb b/.puppet/profiles/icingaweb2_dev/templates/config.ini.erb new file mode 100644 index 000000000..597cd2b9b --- /dev/null +++ b/.puppet/profiles/icingaweb2_dev/templates/config.ini.erb @@ -0,0 +1,7 @@ +[logging] +log = "file" +file = "/var/log/<%= @log %>/icingaweb.log" +level = DEBUG + +[preferences] +type = "ini" From 581e009669d161c2a609cb71036c97104fd38ece Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 09:59:21 +0100 Subject: [PATCH 191/238] puppet: Move authentication.ini to icingaweb2_dev's template directory refs #6842 --- .../authentication.ini => templates/authentication.ini.erb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .puppet/profiles/icingaweb2_dev/{files/authentication.ini => templates/authentication.ini.erb} (100%) diff --git a/.puppet/profiles/icingaweb2_dev/files/authentication.ini b/.puppet/profiles/icingaweb2_dev/templates/authentication.ini.erb similarity index 100% rename from .puppet/profiles/icingaweb2_dev/files/authentication.ini rename to .puppet/profiles/icingaweb2_dev/templates/authentication.ini.erb From cee5fb5f476edfe2f38fe343b855a9233f1388b8 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 10:04:29 +0100 Subject: [PATCH 192/238] puppet: Move resources.ini to icingaweb2_dev's template directory refs #6842 --- .../{files/resources.ini => templates/resources.ini.erb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .puppet/profiles/icingaweb2_dev/{files/resources.ini => templates/resources.ini.erb} (100%) diff --git a/.puppet/profiles/icingaweb2_dev/files/resources.ini b/.puppet/profiles/icingaweb2_dev/templates/resources.ini.erb similarity index 100% rename from .puppet/profiles/icingaweb2_dev/files/resources.ini rename to .puppet/profiles/icingaweb2_dev/templates/resources.ini.erb From cdbb7e237f0186dcca27ff64fe8920781f4bd42a Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 10:10:19 +0100 Subject: [PATCH 193/238] puppet: Move icingaweb.comf to icingaweb2_dev's template directory refs #6842 --- .../conf.d => profiles/icingaweb2_dev/templates}/icingaweb.conf | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .puppet/{files/etc/httpd/conf.d => profiles/icingaweb2_dev/templates}/icingaweb.conf (100%) diff --git a/.puppet/files/etc/httpd/conf.d/icingaweb.conf b/.puppet/profiles/icingaweb2_dev/templates/icingaweb.conf similarity index 100% rename from .puppet/files/etc/httpd/conf.d/icingaweb.conf rename to .puppet/profiles/icingaweb2_dev/templates/icingaweb.conf From 099fefd3f39eb131cc60fb1e1f0a02908ad1257b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 10:11:00 +0100 Subject: [PATCH 194/238] puppet: Rename icingaweb.conf to icingaweb.conf.erb refs #6842 --- .../templates/{icingaweb.conf => icingaweb.conf.erb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .puppet/profiles/icingaweb2_dev/templates/{icingaweb.conf => icingaweb.conf.erb} (100%) diff --git a/.puppet/profiles/icingaweb2_dev/templates/icingaweb.conf b/.puppet/profiles/icingaweb2_dev/templates/icingaweb.conf.erb similarity index 100% rename from .puppet/profiles/icingaweb2_dev/templates/icingaweb.conf rename to .puppet/profiles/icingaweb2_dev/templates/icingaweb.conf.erb From b7c555ab38356cb18408129b1c4f90b69f691e2f Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 10:26:40 +0100 Subject: [PATCH 195/238] puppet: Use the config templates refs #6842 --- .puppet/profiles/icingaweb2_dev/manifests/init.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.puppet/profiles/icingaweb2_dev/manifests/init.pp b/.puppet/profiles/icingaweb2_dev/manifests/init.pp index 638809881..8a873fdb2 100644 --- a/.puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -82,11 +82,11 @@ class icingaweb2_dev ( } icingaweb2::config::general { 'authentication': - source => 'puppet:///modules/icingaweb2_dev', + source => $name, } - icingaweb2::config::general { [ 'resources', 'config' ]: - source => 'puppet:///modules/icingaweb2_dev', + icingaweb2::config::general { [ 'config', 'resources' ]: + source => $name, replace => false, } From efa790923a18d60242a973034eb3b76850b5121f Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 10:51:21 +0100 Subject: [PATCH 196/238] puppet: Fix names of the monitoring module's backends refs #6842 --- .../files/modules/monitoring/backends.ini | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini b/.puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini index c4ff23f8c..55f8e3115 100644 --- a/.puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini +++ b/.puppet/profiles/icingaweb2_dev/files/modules/monitoring/backends.ini @@ -1,17 +1,12 @@ -[local-mysql] +[ido-mysql] type = ido resource = ido-mysql -[local-pgsql] +[ido-pgsql] type = ido resource = ido-pgsql -[locallive] +[livestatus] disabled = 1 type = livestatus resource = livestatus - -;[localfailsafe] -;enabled=false -;type = combo -;backends = localdb, locallive, localfile From 4ea178edeb06e4b13e0c980a5847ebbf90e81b31 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 10:51:59 +0100 Subject: [PATCH 197/238] puppet: Use the icingweb.conf template refs #6842 --- .puppet/profiles/icingaweb2_dev/manifests/init.pp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.puppet/profiles/icingaweb2_dev/manifests/init.pp b/.puppet/profiles/icingaweb2_dev/manifests/init.pp index 8a873fdb2..c330d772b 100644 --- a/.puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -1,5 +1,7 @@ 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'), @@ -77,7 +79,7 @@ class icingaweb2_dev ( } file { '/etc/httpd/conf.d/icingaweb.conf': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf', + content => template("$name/icingaweb.conf.erb"), notify => Service['apache'], } From 15d2414310bf8ee7f06a6d89d1545eaf24343ace Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 10:52:36 +0100 Subject: [PATCH 198/238] puppet: Rename interal_ldap to local-ldap in authentication.ini refs #6842 --- .../icingaweb2_dev/templates/authentication.ini.erb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.puppet/profiles/icingaweb2_dev/templates/authentication.ini.erb b/.puppet/profiles/icingaweb2_dev/templates/authentication.ini.erb index 96ae63c81..f28395e18 100644 --- a/.puppet/profiles/icingaweb2_dev/templates/authentication.ini.erb +++ b/.puppet/profiles/icingaweb2_dev/templates/authentication.ini.erb @@ -1,8 +1,5 @@ [autologin] backend = autologin -; -; If you want to strip the domain -; strip_username_regexp = /\@[^$]+$/ [icingaweb-mysql] backend = db @@ -12,8 +9,8 @@ resource = icingaweb-mysql backend = db resource = icingaweb-pgsql -[internal_ldap_authentication] -backend = ldap -resource = internal_ldap -user_class = inetOrgPerson +[local-ldap] +backend = ldap +resource = local-ldap +user_class = inetOrgPerson user_name_attribute = uid From 33e25fd145c16411ed7ea3aeae9bbb9dc1723d7c Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 10:53:11 +0100 Subject: [PATCH 199/238] puppet: Use hiera variables in the icingaweb.conf template refs #6842 --- .../profiles/icingaweb2_dev/templates/icingaweb.conf.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.puppet/profiles/icingaweb2_dev/templates/icingaweb.conf.erb b/.puppet/profiles/icingaweb2_dev/templates/icingaweb.conf.erb index 0b45bea1f..d19dbe9ee 100644 --- a/.puppet/profiles/icingaweb2_dev/templates/icingaweb.conf.erb +++ b/.puppet/profiles/icingaweb2_dev/templates/icingaweb.conf.erb @@ -1,4 +1,4 @@ -Alias /icingaweb /vagrant/public +Alias /<%= @web_path %> /vagrant/public Options FollowSymLinks @@ -6,12 +6,12 @@ Alias /icingaweb /vagrant/public Order allow,deny Allow from all - # SetEnv ICINGAWEB_CONFIGDIR /etc/icingaweb + # SetEnv ICINGAWEB_CONFIGDIR <%= @config %> EnableSendfile Off RewriteEngine on - RewriteBase /icingaweb/ + RewriteBase /<%= @web_path %>/ RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d From 6974b18755f244229114e8b248f439d3ec930bbe Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 10:54:56 +0100 Subject: [PATCH 200/238] puppet: Use hiera variables in the resources.ini template refs #6842 --- .../icingaweb2_dev/templates/resources.ini.erb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.puppet/profiles/icingaweb2_dev/templates/resources.ini.erb b/.puppet/profiles/icingaweb2_dev/templates/resources.ini.erb index e76afab41..8066a47a5 100644 --- a/.puppet/profiles/icingaweb2_dev/templates/resources.ini.erb +++ b/.puppet/profiles/icingaweb2_dev/templates/resources.ini.erb @@ -3,18 +3,18 @@ type = db db = mysql host = localhost port = 3306 -password = icingaweb -username = icingaweb -dbname = icingaweb +username = <%= @db_user %> +password = <%= @db_pass %> +dbname = <%= @db_name %> [icingaweb-pgsql] type = db db = pgsql host = localhost port = 5432 -password = icingaweb -username = icingaweb -dbname = icingaweb +username = <%= @db_user %> +password = <%= @db_pass %> +dbname = <%= @db_name %> [ido-mysql] type = db @@ -34,10 +34,10 @@ password = icinga2 username = icinga2 dbname = icinga2 -[internal_ldap] +[local-ldap] type = ldap hostname = localhost port = 389 -root_dn = "ou=people, dc=icinga, dc=org" +root_dn = "ou=people,dc=icinga,dc=org" bind_dn = "cn=admin,cn=config" bind_pw = admin From ec06239d805460975e2fd9f2b8192876e40dc559 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 10:55:17 +0100 Subject: [PATCH 201/238] puppet: Name the Icinga Web 2 log file according to the hiera variable refs #6842 --- .puppet/profiles/icingaweb2_dev/templates/config.ini.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.puppet/profiles/icingaweb2_dev/templates/config.ini.erb b/.puppet/profiles/icingaweb2_dev/templates/config.ini.erb index 597cd2b9b..899fc831f 100644 --- a/.puppet/profiles/icingaweb2_dev/templates/config.ini.erb +++ b/.puppet/profiles/icingaweb2_dev/templates/config.ini.erb @@ -1,6 +1,6 @@ [logging] log = "file" -file = "/var/log/<%= @log %>/icingaweb.log" +file = "/var/log/<%= @log %>/<%= @log %>.log" level = DEBUG [preferences] From e786a7ad013a5a572b2b759f168a1fc599e3055f Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 10:57:46 +0100 Subject: [PATCH 202/238] puppet: Remove top level Icinga Web 2 configuration files The icingaweb2_dev profile provides those configuration files. refs #6842 --- .../files/etc/icingaweb/authentication.ini | 15 ----------- .../icingaweb/modules/monitoring/backends.ini | 19 -------------- .../modules/monitoring/instances.ini | 2 -- .puppet/files/etc/icingaweb/resources.ini | 26 ------------------- 4 files changed, 62 deletions(-) delete mode 100644 .puppet/files/etc/icingaweb/authentication.ini delete mode 100644 .puppet/files/etc/icingaweb/modules/monitoring/backends.ini delete mode 100644 .puppet/files/etc/icingaweb/modules/monitoring/instances.ini delete mode 100644 .puppet/files/etc/icingaweb/resources.ini diff --git a/.puppet/files/etc/icingaweb/authentication.ini b/.puppet/files/etc/icingaweb/authentication.ini deleted file mode 100644 index 3da806df1..000000000 --- a/.puppet/files/etc/icingaweb/authentication.ini +++ /dev/null @@ -1,15 +0,0 @@ -[autologin] -backend = autologin -; -; If you want to strip the domain -; strip_username_regexp = /\@[^$]+$/ - -[internal_ldap_authentication] -backend = ldap -resource = internal_ldap -user_class = inetOrgPerson -user_name_attribute = uid - -[internal_db_authentication] -backend = db -resource = internal_db diff --git a/.puppet/files/etc/icingaweb/modules/monitoring/backends.ini b/.puppet/files/etc/icingaweb/modules/monitoring/backends.ini deleted file mode 100644 index 6805f2e8b..000000000 --- a/.puppet/files/etc/icingaweb/modules/monitoring/backends.ini +++ /dev/null @@ -1,19 +0,0 @@ -[localdb] - -type = ido -resource = "ido" - -[locallive] -disabled = "1" -type = livestatus -resource = livestatus - -[localfile] -disabled = "1" -type = statusdat -resource = statusdat - -;[localfailsafe] -;enabled=false -;type = combo -;backends = localdb, locallive, localfile diff --git a/.puppet/files/etc/icingaweb/modules/monitoring/instances.ini b/.puppet/files/etc/icingaweb/modules/monitoring/instances.ini deleted file mode 100644 index 037baa8b9..000000000 --- a/.puppet/files/etc/icingaweb/modules/monitoring/instances.ini +++ /dev/null @@ -1,2 +0,0 @@ -[icinga] -path = "/var/run/icinga2/cmd/icinga2.cmd" diff --git a/.puppet/files/etc/icingaweb/resources.ini b/.puppet/files/etc/icingaweb/resources.ini deleted file mode 100644 index ac6c6a03c..000000000 --- a/.puppet/files/etc/icingaweb/resources.ini +++ /dev/null @@ -1,26 +0,0 @@ -[icingaweb-mysql] -type = db -db = mysql -host = localhost -port = 3306 -password = icingaweb -username = icingaweb -dbname = icingaweb - -[icingaweb-pgsql] -type = db -db = pgsql -host = localhost -port = 5432 -password = icingaweb -username = icingaweb -dbname = icingaweb - -[ido] -type = db -db = mysql -host = localhost -port = 3306 -password = icinga2 -username = icinga2 -dbname = icinga2 From cfe2242cdae401cafcd2e6146bd9c20a81c5d407 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 11:18:39 +0100 Subject: [PATCH 203/238] puppet: Add site.pp in favor of default.pp refs #6842 --- .puppet/manifests/site.pp | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .puppet/manifests/site.pp diff --git a/.puppet/manifests/site.pp b/.puppet/manifests/site.pp new file mode 100644 index 000000000..2f4ac8eb9 --- /dev/null +++ b/.puppet/manifests/site.pp @@ -0,0 +1,4 @@ +node 'localhost' { + include icinga2_dev + include icingaweb2_dev +} From 088455a164257d4a3ec307030dd25c0c87fa835b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 11:31:34 +0100 Subject: [PATCH 204/238] puppet: Add module motd in favor of top level motd refs #6842 --- .puppet/files/etc/motd | 16 ---------------- .puppet/modules/motd/files/motd | 19 +++++++++++++++++++ .puppet/modules/motd/manifests/init.pp | 7 +++++++ 3 files changed, 26 insertions(+), 16 deletions(-) delete mode 100644 .puppet/files/etc/motd create mode 100644 .puppet/modules/motd/files/motd create mode 100644 .puppet/modules/motd/manifests/init.pp diff --git a/.puppet/files/etc/motd b/.puppet/files/etc/motd deleted file mode 100644 index 7e6677c20..000000000 --- a/.puppet/files/etc/motd +++ /dev/null @@ -1,16 +0,0 @@ - ______ ___ -/\__ _\ __ /'___`\ -\/_/\ \/ ___ /\_\ ___ __ __ /\_\ /\ \ - \ \ \ /'___\/\ \ /' _ `\ /'_ `\ /'__`\ \/_/// /__ - \_\ \__/\ \__/\ \ \/\ \/\ \/\ \L\ \/\ \L\.\_ // /_\ \ - /\_____\ \____\\ \_\ \_\ \_\ \____ \ \__/.\_\ /\______/ - \/_____/\/____/ \/_/\/_/\/_/\/___L\ \/__/\/_/ \/_____/ - /\____/ - \_/__/ - __ __ __ -/\ \ __/\ \ /\ \ -\ \ \/\ \ \ \ __\ \ \____ - \ \ \ \ \ \ \ /'__`\ \ '__`\ - \ \ \_/ \_\ \/\ __/\ \ \L\ \ - \ `\___x___/\ \____\\ \_,__/ - '\/__//__/ \/____/ \/___/ diff --git a/.puppet/modules/motd/files/motd b/.puppet/modules/motd/files/motd new file mode 100644 index 000000000..3e32ee517 --- /dev/null +++ b/.puppet/modules/motd/files/motd @@ -0,0 +1,19 @@ +88 88 +88 "" +88 +88 ,adPPYba, 88 8b,dPPYba, ,adPPYb,d8 ,adPPYYba, +88 a8" "" 88 88P' `"8a a8" `Y88 "" `Y8 +88 8b 88 88 88 8b 88 ,adPPPPP88 +88 "8a, ,aa 88 88 88 "8a, ,d88 88, ,88 +88 `"Ybbd8"' 88 88 88 `"YbbdP"Y8 `"8bbdP"Y8 + aa, ,88 + "Y8bbdP" + +I8, 8 ,8I 88 ad888888b, +`8b d8b d8' 88 d8" "88 + "8, ,8"8, ,8" 88 a8P + Y8 8P Y8 8P ,adPPYba, 88,dPPYba, ,d8P" + `8b d8' `8b d8' a8P_____88 88P' "8a a8P" + `8a a8' `8a a8' 8PP""""""" 88 d8 a8P' + `8a8' `8a8' "8b, ,aa 88b, ,a8" d8" + `8' `8' `"Ybbd8"' 8Y"Ybbd8"' 88888888888 diff --git a/.puppet/modules/motd/manifests/init.pp b/.puppet/modules/motd/manifests/init.pp new file mode 100644 index 000000000..acb744daf --- /dev/null +++ b/.puppet/modules/motd/manifests/init.pp @@ -0,0 +1,7 @@ +class motd { + file { '/etc/motd': + source => 'puppet:///modules/motd/motd', + owner => root, + group => root, + } +} From efe7044cc27d6c4de5176d4b9f936ac18aa9ed25 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 11:32:02 +0100 Subject: [PATCH 205/238] puppet: Include motd refs #6842 --- .puppet/manifests/site.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/.puppet/manifests/site.pp b/.puppet/manifests/site.pp index 2f4ac8eb9..57545eb12 100644 --- a/.puppet/manifests/site.pp +++ b/.puppet/manifests/site.pp @@ -1,4 +1,5 @@ node 'localhost' { include icinga2_dev include icingaweb2_dev + include motd } From fb32fba00b9e17db048231b7883916964a425b88 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 11:33:36 +0100 Subject: [PATCH 206/238] puppet: Remove top level index.php for Icinga Web 2 This file is no longer in use. refs #6842 --- .puppet/files/var/www/html/icingaweb/index.php | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .puppet/files/var/www/html/icingaweb/index.php diff --git a/.puppet/files/var/www/html/icingaweb/index.php b/.puppet/files/var/www/html/icingaweb/index.php deleted file mode 100644 index 9e452ac70..000000000 --- a/.puppet/files/var/www/html/icingaweb/index.php +++ /dev/null @@ -1,5 +0,0 @@ - Date: Mon, 15 Dec 2014 11:43:33 +0100 Subject: [PATCH 207/238] puppet: Add TODO refs #6842 --- .puppet/TODO.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .puppet/TODO.md diff --git a/.puppet/TODO.md b/.puppet/TODO.md new file mode 100644 index 000000000..71953f54c --- /dev/null +++ b/.puppet/TODO.md @@ -0,0 +1,20 @@ +Fix steps that are always provisioned: + +==> default: Notice: /Stage[main]/Icinga2/Icinga2::Feature[statusdata]/Parent_dirs[/etc/icinga2/features-enabled/statusdata.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/statusdata.conf]/returns: executed successfully +==> default: Notice: /Stage[main]/Icinga2_dev/Icinga2::Config[constants]/Parent_dirs[/etc/icinga2/constants.conf]/Exec[parent_dirs-/etc/icinga2/constants.conf]/returns: executed successfully +==> default: Notice: /Stage[main]/Icinga2_dev/Icinga2::Config[conf.d/commands]/Parent_dirs[/etc/icinga2/conf.d/commands.conf]/Exec[parent_dirs-/etc/icinga2/conf.d/commands.conf]/returns: executed successfully +==> default: Notice: /Stage[main]/Icinga2/Icinga2::Feature[command]/Parent_dirs[/etc/icinga2/features-enabled/command.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/command.conf]/returns: executed successfully +==> default: Notice: /Stage[main]/Icingaweb2_dev/Pgsql::Database::Populate[icingaweb]/Exec[populate-icingaweb-pgsql-db]/returns: executed successfully +==> default: Notice: /Stage[main]/Php/Exec[php-timezone]/returns: executed successfully +==> default: Notice: /Stage[main]/Icinga2_dev/Icinga2::Config[conf.d/test-config]/Parent_dirs[/etc/icinga2/conf.d/test-config.conf]/Exec[parent_dirs-/etc/icinga2/conf.d/test-config.conf]/returns: executed successfully +==> default: Notice: /Stage[main]/Icingaweb2_dev/Exec[populate-openldap]/returns: executed successfully +==> default: Notice: /Stage[main]/Monitoring_test_config/Git_cmmi[Monitoring-Generator-TestConfig]/Cmmi_dir[Monitoring-Generator-TestConfig]/Exec[configure-Monitoring-Generator-TestConfig]/returns: executed successfully +==> default: Notice: /Stage[main]/Monitoring_test_config/Git_cmmi[Monitoring-Generator-TestConfig]/Cmmi_dir[Monitoring-Generator-TestConfig]/Exec[make-Monitoring-Generator-TestConfig]/returns: executed successfully +==> default: Notice: /Stage[main]/Icinga2/Icinga2::Feature[compatlog]/Parent_dirs[/etc/icinga2/features-enabled/compatlog.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/compatlog.conf]/returns: executed successfully +==> default: Notice: /Stage[main]/Icinga2_mysql/Icinga2::Feature[ido-mysql]/Parent_dirs[/etc/icinga2/features-enabled/ido-mysql.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/ido-mysql.conf]/returns: executed successfully +==> default: Notice: /Stage[main]/Apache/Service[httpd]: Triggered 'refresh' from 1 events +==> default: Notice: /Stage[main]/Icingaweb2_dev/Exec[enable-monitoring-module]/returns: executed successfully +==> default: Notice: /Stage[main]/Icingaweb2_dev/Exec[enable-test-module]/returns: executed successfully +==> default: Notice: /Stage[main]/Icinga2_mysql/Icinga2::Feature[ido-mysql]/Icinga2::Config[features-available/ido-mysql]/Parent_dirs[/etc/icinga2/features-available/ido-mysql.conf]/Exec[parent_dirs-/etc/icinga2/features-available/ido-mysql.conf]/returns: executed successfully +==> default: Notice: /Stage[main]/Icinga2_pgsql/Icinga2::Feature[ido-pgsql]/Icinga2::Config[features-available/ido-pgsql]/Parent_dirs[/etc/icinga2/features-available/ido-pgsql.conf]/Exec[parent_dirs-/etc/icinga2/features-available/ido-pgsql.conf]/returns: executed successfully +==> default: Notice: /Stage[main]/Icinga2_pgsql/Icinga2::Feature[ido-pgsql]/Parent_dirs[/etc/icinga2/features-enabled/ido-pgsql.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/ido-pgsql.conf]/returns: executed successfully From f8c4685456f43be7d60a468318bea5fa7bebca6b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 11:44:19 +0100 Subject: [PATCH 208/238] puppet: Fix Icinga Web 2's logging configuration refs #6842 --- .puppet/profiles/icingaweb2_dev/manifests/init.pp | 3 ++- .puppet/profiles/icingaweb2_dev/templates/config.ini.erb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.puppet/profiles/icingaweb2_dev/manifests/init.pp b/.puppet/profiles/icingaweb2_dev/manifests/init.pp index c330d772b..379f75247 100644 --- a/.puppet/profiles/icingaweb2_dev/manifests/init.pp +++ b/.puppet/profiles/icingaweb2_dev/manifests/init.pp @@ -46,7 +46,8 @@ class icingaweb2_dev ( User <| alias == apache |> { groups +> 'icingacmd' } - file { "${log}": + $log_dir = inline_template('<%= File.dirname(@log) %>') + file { $log_dir: ensure => directory, owner => 'root', group => 'icingaweb', diff --git a/.puppet/profiles/icingaweb2_dev/templates/config.ini.erb b/.puppet/profiles/icingaweb2_dev/templates/config.ini.erb index 899fc831f..13ef6710f 100644 --- a/.puppet/profiles/icingaweb2_dev/templates/config.ini.erb +++ b/.puppet/profiles/icingaweb2_dev/templates/config.ini.erb @@ -1,6 +1,6 @@ [logging] log = "file" -file = "/var/log/<%= @log %>/<%= @log %>.log" +file = "<%= @log %>" level = DEBUG [preferences] From 37ad4f7623e610a3e26f12b5f7625eb489e8e6cb Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:11:41 +0100 Subject: [PATCH 209/238] puppet: Add /usr/local/bin to PATH refs #6842 --- .puppet/manifests/site.pp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.puppet/manifests/site.pp b/.puppet/manifests/site.pp index 57545eb12..4d9fba1f2 100644 --- a/.puppet/manifests/site.pp +++ b/.puppet/manifests/site.pp @@ -1,5 +1,8 @@ node 'localhost' { - include icinga2_dev - include icingaweb2_dev - include motd + include icinga2_dev + include icingaweb2_dev + include motd + file { '/etc/profile.d/env.sh': + source => 'puppet:////vagrant/.puppet/files/etc/profile.d/env.sh' + } } From dcbf8c56614057279d2f61d06417c5000da573d1 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:12:35 +0100 Subject: [PATCH 210/238] puppet: Remove icinga_command_proxy No longer in use. refs #6842 --- .puppet/files/etc/init.d/icinga_command_proxy | 71 ------------------- .../files/usr/local/bin/icinga_command_proxy | 42 ----------- 2 files changed, 113 deletions(-) delete mode 100644 .puppet/files/etc/init.d/icinga_command_proxy delete mode 100644 .puppet/files/usr/local/bin/icinga_command_proxy diff --git a/.puppet/files/etc/init.d/icinga_command_proxy b/.puppet/files/etc/init.d/icinga_command_proxy deleted file mode 100644 index 77059981f..000000000 --- a/.puppet/files/etc/init.d/icinga_command_proxy +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# -# chkconfig: 345 99 01 -# -### BEGIN INIT INFO -# Provides: icinga_command_proxy -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog -# Should-Start: icinga -# Should-Stop: icinga -### END INIT INFO - -# Source function library. -. /etc/rc.d/init.d/functions - -PROG="icinga_command_proxy" -BIN="/usr/local/bin/icinga_command_proxy" - -if [[ -f /etc/sysconfig/$PROG ]]; then - . /etc/sysconfig/$PROG -fi - -ICINGA_CMD=${ICINGA_CMD:-"/usr/local/icinga/var/rw/icinga.cmd"} -ICINGA_MYSQL_CMD=${ICINGA_MYSQL_CMD:-"/usr/local/icinga-mysql/var/rw/icinga.cmd"} -ICINGA_PGSQL_CMD=${ICINGA_PGSQL_CMD:-"/usr/local/icinga-pgsql/var/rw/icinga.cmd"} - -LOCKFILE=${LOCKFILE:-/var/lock/subsys/$PROG} -PIDFILE=${PIDFILE:-/var/lock/subsys/$PROG/$PROG.pid} - -RETVAL=0 - -start() { - echo -n $"Starting $PROG: " - daemon --pidfile="$PIDFILE" "nohup \"$BIN\" \"$ICINGA_CMD\" \"$ICINGA_MYSQL_CMD\" \"$ICINGA_PGSQL_CMD\" >/dev/null 2>&1 &" - RETVAL=$? - echo - [ $RETVAL = 0 ] && touch "$LOCKFILE" - return $RETVAL -} - -stop() { - echo -n $"Stopping $PROG: " - killproc -p "$PIDFILE" "$BIN" - RETVAL=$? - echo - [ $RETVAL = 0 ] && rm -f "$LOCKFILE" "$PIDFILE" -} - -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - status -p "$PIDFILE" "$BIN" - RETVAL=$? - ;; - restart) - stop - start - ;; - *) - echo $"Usage: $PROG {start|stop|restart|status}" - RETVAL=2 -esac - -exit $RETVAL - diff --git a/.puppet/files/usr/local/bin/icinga_command_proxy b/.puppet/files/usr/local/bin/icinga_command_proxy deleted file mode 100644 index de7cb157c..000000000 --- a/.puppet/files/usr/local/bin/icinga_command_proxy +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# Redirect commands from pipe A to pipe B and C -# - -set -e -set -u - -ICINGA_CMD=${1:-"/usr/local/icinga/var/rw/icinga.cmd"} -ICINGA_MYSQL_CMD=${2:-"/usr/local/icinga-mysql/var/rw/icinga.cmd"} -ICINGA_PGSQL_CMD=${3:-"/usr/local/icinga-pgsql/var/rw/icinga.cmd"} - -trap 'rm -f "$ICINGA_CMD"; exit' EXIT SIGKILL - -if [[ -p "$ICINGA_CMD" ]]; then - rm -f "$ICINGA_CMD" -fi - -mkfifo -m 660 "$ICINGA_CMD" -chown icinga.icinga-cmd "$ICINGA_CMD" - -while true -do - if read COMMAND - then - if [[ -p "$ICINGA_MYSQL_CMD" ]]; then - echo "$COMMAND" > "$ICINGA_MYSQL_CMD" - else - logger -p local0.err Can\'t distribute command to the Icinga MySQL instance since its command pipe doesn\'t exist - fi - if [[ -p "$ICINGA_PGSQL_CMD" ]]; then - echo "$COMMAND" > "$ICINGA_PGSQL_CMD" - else - logger -p local0.err Can\'t distribute command to the Icinga PostgreSQL instance since its command pipe doesn\'t exist - fi - fi -done < "$ICINGA_CMD" 3> "$ICINGA_CMD" - -# Reset all traps -trap - EXIT SIGKILL - -exit 0 From 3d54087fa37a23c88a2f98842f1bc4a5680efa47 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:13:26 +0100 Subject: [PATCH 211/238] puppet: Remove mk-livestatus module No longer in use. refs #6842 --- .../modules/mk-livestatus/templates/mk-livestatus.cfg.erb | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .puppet/modules/mk-livestatus/templates/mk-livestatus.cfg.erb diff --git a/.puppet/modules/mk-livestatus/templates/mk-livestatus.cfg.erb b/.puppet/modules/mk-livestatus/templates/mk-livestatus.cfg.erb deleted file mode 100644 index f61ffc001..000000000 --- a/.puppet/modules/mk-livestatus/templates/mk-livestatus.cfg.erb +++ /dev/null @@ -1,6 +0,0 @@ -define module{ - module_name mklivestatus - path /usr/local/icinga-mysql/lib/mk-livestatus/livestatus.o - module_type neb - args /usr/local/icinga-mysql/var/rw/live - } From c54ab12ebce09036f989c8ef43506a629ed432c7 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:13:58 +0100 Subject: [PATCH 212/238] puppet: Remove module casperjs No longer in use. refs #6842 --- .puppet/modules/casperjs/manifests/init.pp | 66 ---------------------- 1 file changed, 66 deletions(-) delete mode 100644 .puppet/modules/casperjs/manifests/init.pp diff --git a/.puppet/modules/casperjs/manifests/init.pp b/.puppet/modules/casperjs/manifests/init.pp deleted file mode 100644 index fd54e37f9..000000000 --- a/.puppet/modules/casperjs/manifests/init.pp +++ /dev/null @@ -1,66 +0,0 @@ -# Class: casperjs -# -# This module downloads, extracts, and installs casperjs tar.gz archives -# using wget and tar. -# -# Parameters: -# [*url*] - fetch archive via wget from this url. -# [*output*] - filename to fetch the archive into. -# [*creates*] - target directory the software will install to. -# -# Actions: -# -# Requires: -# -# Sample Usage: -# -# class {'casperjs': -# url => 'https://github.com/n1k0/casperjs/tarball/1.0.2', -# output => 'casperjs-1.0.2.tar.gz', -# creates => '/usr/local/casperjs' -# } -# -class casperjs( - $url, - $output, - $creates -) { - - Exec { path => '/usr/bin:/bin' } - - $cwd = '/usr/local/src' - - include wget - - exec { 'download-casperjs': - cwd => $cwd, - command => "wget -q ${url} -O ${output}", - creates => "${cwd}/${output}", - timeout => 120, - require => Class['wget'] - } - - $tld = inline_template('<%= File.basename(@output, ".tar.bz2") %>') - $src = "${cwd}/casperjs" - - exec { 'extract-casperjs': - cwd => $cwd, - command => "mkdir -p casperjs && tar --no-same-owner \ - --no-same-permissions -xzf ${output} -C ${src} \ - --strip-components 1", - creates => $src, - require => Exec['download-casperjs'] - } - - file { 'install-casperjs': - path => $creates, - source => $src, - recurse => true, - require => Exec['extract-casperjs'] - } - - file { 'link-casperjs-bin': - ensure => "${creates}/bin/casperjs", - path => '/usr/local/bin/casperjs' - } -} From ada0b8c0a5db8a5de6b49101ad364ea9ab245869 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:14:30 +0100 Subject: [PATCH 213/238] puppet: Remove module phantomjs No longer in use. refs #6842 --- .puppet/modules/phantomjs/manifests/init.pp | 65 --------------------- 1 file changed, 65 deletions(-) delete mode 100644 .puppet/modules/phantomjs/manifests/init.pp diff --git a/.puppet/modules/phantomjs/manifests/init.pp b/.puppet/modules/phantomjs/manifests/init.pp deleted file mode 100644 index ea65b1f26..000000000 --- a/.puppet/modules/phantomjs/manifests/init.pp +++ /dev/null @@ -1,65 +0,0 @@ -# Class: phantomjs -# -# This module downloads, extracts, and installs phantomjs tar.bz2 archives -# using wget and tar. -# -# Parameters: -# [*url*] - fetch archive via wget from this url. -# [*output*] - filename to fetch the archive into. -# [*creates*] - target directory the software will install to. -# -# Actions: -# -# Requires: -# -# Sample Usage: -# -# class {'phantomjs': -# url => 'https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2', -# output => 'phantomjs-1.9.1-linux-x86_64.tar.bz2', -# creates => '/usr/local/phantomjs' -# } -# -class phantomjs( - $url, - $output, - $creates -) { - - Exec { path => '/usr/bin:/bin' } - - $cwd = '/usr/local/src' - - include wget - - exec { 'download-phantomjs': - cwd => $cwd, - command => "wget -q ${url} -O ${output}", - creates => "${cwd}/${output}", - timeout => 120, - require => Class['wget'] - } - - $src = "${cwd}/phantomjs" - - exec { 'extract-phantomjs': - cwd => $cwd, - command => "mkdir -p phantomjs && tar --no-same-owner \ - --no-same-permissions -xjf ${output} -C ${src} \ - --strip-components 1", - creates => $src, - require => Exec['download-phantomjs'] - } - - file { 'install-phantomjs': - path => $creates, - source => $src, - recurse => true, - require => Exec['extract-phantomjs'] - } - - file { 'link-phantomjs-bin': - ensure => "${creates}/bin/phantomjs", - path => '/usr/local/bin/phantomjs' - } -} From e1c35c457d43ae8ba221f1ff99465aef11b5165e Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:16:17 +0100 Subject: [PATCH 214/238] puppet: Remove module cpan No longer in use. refs #6842 --- .puppet/modules/cpan/manifests/init.pp | 47 ------------- .../modules/cpan/templates/MyConfig.pm.erb | 68 ------------------- 2 files changed, 115 deletions(-) delete mode 100644 .puppet/modules/cpan/manifests/init.pp delete mode 100644 .puppet/modules/cpan/templates/MyConfig.pm.erb diff --git a/.puppet/modules/cpan/manifests/init.pp b/.puppet/modules/cpan/manifests/init.pp deleted file mode 100644 index ea7653826..000000000 --- a/.puppet/modules/cpan/manifests/init.pp +++ /dev/null @@ -1,47 +0,0 @@ -# Define: cpan -# -# Download and install Perl modules from the Perl Archive Network, the canonical location for Perl code and modules. -# -# Parameters: -# [*creates*] - target directory the software will install to. -# [*timeout* ] - timeout for the CPAN command. -# -# Actions: -# -# Requires: -# -# perl -# -# Sample Usage: -# -# cpan { 'perl-module': -# creates => '/usr/local/share/perl5/perl-module', -# timeout => 600 -# } -# -define cpan( - $creates, - $timeout = 0 -) { - include perl - - file { [ '/root/.cpan/', '/root/.cpan/CPAN/' ]: - ensure => directory - } - - file { '/root/.cpan/CPAN/MyConfig.pm': - content => template('cpan/MyConfig.pm.erb'), - require => File[[ '/root/.cpan/', '/root/.cpan/CPAN/' ]], - } - - exec { "cpan-${name}": - command => "perl -MCPAN -e 'install ${name}'", - creates => $creates, - path => '/usr/local/bin:/usr/bin', - require => [ - Class['perl'], - File['/root/.cpan/CPAN/MyConfig.pm'] - ], - timeout => $timeout - } -} diff --git a/.puppet/modules/cpan/templates/MyConfig.pm.erb b/.puppet/modules/cpan/templates/MyConfig.pm.erb deleted file mode 100644 index da410a188..000000000 --- a/.puppet/modules/cpan/templates/MyConfig.pm.erb +++ /dev/null @@ -1,68 +0,0 @@ -$CPAN::Config = { - 'applypatch' => q[], - 'auto_commit' => q[0], - 'build_cache' => q[100], - 'build_dir' => q[/root/.cpan/build], - 'build_dir_reuse' => q[0], - 'build_requires_install_policy' => q[ask/yes], - 'bzip2' => q[/usr/bin/bzip2], - 'cache_metadata' => q[1], - 'check_sigs' => q[0], - 'commandnumber_in_prompt' => q[1], - 'connect_to_internet_ok' => q[1], - 'cpan_home' => q[/root/.cpan], - 'curl' => q[/usr/bin/curl], - 'ftp' => q[], - 'ftp_passive' => q[1], - 'ftp_proxy' => q[], - 'getcwd' => q[cwd], - 'gpg' => q[/usr/bin/gpg], - 'gzip' => q[/bin/gzip], - 'halt_on_failure' => q[0], - 'histfile' => q[/root/.cpan/histfile], - 'histsize' => q[100], - 'http_proxy' => q[], - 'inactivity_timeout' => q[0], - 'index_expire' => q[1], - 'inhibit_startup_message' => q[0], - 'keep_source_where' => q[/root/.cpan/sources], - 'load_module_verbosity' => q[v], - 'lynx' => q[], - 'make' => q[/usr/bin/make], - 'make_arg' => q[], - 'make_install_arg' => q[], - 'make_install_make_command' => q[/usr/bin/make], - 'makepl_arg' => q[INSTALLDIRS=site], - 'mbuild_arg' => q[], - 'mbuild_install_arg' => q[], - 'mbuild_install_build_command' => q[./Build], - 'mbuildpl_arg' => q[--installdirs site], - 'ncftp' => q[], - 'ncftpget' => q[], - 'no_proxy' => q[], - 'pager' => q[/usr/bin/less], - 'patch' => q[], - 'perl5lib_verbosity' => q[v], - 'prefer_installer' => q[MB], - 'prefs_dir' => q[/root/.cpan/prefs], - 'prerequisites_policy' => q[follow], - 'scan_cache' => q[atstart], - 'shell' => q[/bin/bash], - 'show_unparsable_versions' => q[0], - 'show_upload_date' => q[0], - 'show_zero_versions' => q[0], - 'tar' => q[/bin/tar], - 'tar_verbosity' => q[v], - 'term_is_latin' => q[1], - 'term_ornaments' => q[1], - 'test_report' => q[0], - 'trust_test_report_history' => q[0], - 'unzip' => q[/usr/bin/unzip], - 'urllist' => [], - 'use_sqlite' => q[0], - 'wget' => q[/usr/bin/wget], - 'yaml_load_code' => q[0], - 'yaml_module' => q[YAML], -}; -1; -__END__ From 00d3110b958989fb986c462ce4a30fcfca7506fd Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:16:36 +0100 Subject: [PATCH 215/238] puppet: Remove module perl No longer in use. refs #6842 --- .puppet/modules/perl/manifests/init.pp | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 .puppet/modules/perl/manifests/init.pp diff --git a/.puppet/modules/perl/manifests/init.pp b/.puppet/modules/perl/manifests/init.pp deleted file mode 100644 index c3fcb5fea..000000000 --- a/.puppet/modules/perl/manifests/init.pp +++ /dev/null @@ -1,23 +0,0 @@ -# Class: perl -# -# This class installs perl. -# -# Sample Usage: -# -# include perl -# -class perl { - $perl = 'perl-5.20.0' - $perlDir = '/opt/perl' - - cmmi { $perl: - url => "http://www.cpan.org/src/5.0/${perl}.tar.gz", - output => "${perl}.tar.gz", - creates => $perlDir, - configure_command => 'sh ./Configure', - flags => "-des -Dprefix=${perlDir}", - } -> file { '/usr/local/bin/perl': - ensure => link, - target => "${perlDir}/bin/perl", - } -} From 50e23a37d5d2ec2519b6febac19a6dca3093cd7e Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:18:11 +0100 Subject: [PATCH 216/238] puppet: Remove module tar No longer in use. refs #6842 --- .puppet/modules/tar/manifests/init.pp | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 .puppet/modules/tar/manifests/init.pp diff --git a/.puppet/modules/tar/manifests/init.pp b/.puppet/modules/tar/manifests/init.pp deleted file mode 100644 index acf85eab1..000000000 --- a/.puppet/modules/tar/manifests/init.pp +++ /dev/null @@ -1,13 +0,0 @@ -# Class: tar -# -# This class installs tar. -# -# Sample Usage: -# -# include tar -# -class tar { - package { 'tar': - ensure => latest, - } -} From d835fe624c1147b93705aa04f8d095086f1e3b3d Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:18:30 +0100 Subject: [PATCH 217/238] puppet: Remove module wget No longer in use. refs #6842 --- .puppet/modules/wget/manifests/init.pp | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .puppet/modules/wget/manifests/init.pp diff --git a/.puppet/modules/wget/manifests/init.pp b/.puppet/modules/wget/manifests/init.pp deleted file mode 100644 index ad1efd399..000000000 --- a/.puppet/modules/wget/manifests/init.pp +++ /dev/null @@ -1,20 +0,0 @@ -# Class: wget -# -# This class installs wget. -# -# Parameters: -# -# Actions: -# -# Requires: -# -# Sample Usage: -# -# include wget -# -class wget { - - package { 'wget': - ensure => latest, - } -} From 5cc5122d7931e0588047c04f9a969673e4f3b33b Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:18:48 +0100 Subject: [PATCH 218/238] puppet: Remove module cmmi No longer in use. refs #6842 --- .puppet/modules/cmmi/manifests/init.pp | 90 -------------------------- 1 file changed, 90 deletions(-) delete mode 100644 .puppet/modules/cmmi/manifests/init.pp diff --git a/.puppet/modules/cmmi/manifests/init.pp b/.puppet/modules/cmmi/manifests/init.pp deleted file mode 100644 index 128d00fc6..000000000 --- a/.puppet/modules/cmmi/manifests/init.pp +++ /dev/null @@ -1,90 +0,0 @@ -# Define: cmmi -# -# This module downloads, extracts, builds and installs tar.gz archives using -# wget, tar and the autotools stack. Build directory is always /usr/local/src. -# -# *Note* make sure to install build essentials before running cmmi. -# -# Parameters: -# [*url*] - fetch archive via wget from this url. -# [*output*] - filename to fetch the archive into. -# [*flags*] - configure options. -# [*creates*] - target directory the software will install to. -# [*make* ] - command to make and make install the software. -# [*make_timeout* ] - timeout for the make command. -# -# Actions: -# -# Requires: -# -# wget -# tar -# gcc -# -# Sample Usage: -# -# cmmi { 'example-software': -# url => 'http://example-software.com/download/', -# output => 'example-software.tar.gz', -# flags => '--prefix=/opt/example-software', -# creates => '/opt/example-software', -# } -# -define cmmi( - $url, - $output, - $creates, - $make='make && make install', - $flags='', - $make_timeout=0, - $configure_command='sh ./configure' -) { - - Exec { path => '/bin:/usr/bin' } - - $cwd = '/usr/local/src' - - include wget - include tar - include gcc - - exec { "download-${name}": - cwd => $cwd, - command => "wget -q \"${url}\" -O ${output}", - creates => "${cwd}/${output}", - require => Class['wget'] - } - - $tld = inline_template('<%= File.basename(@output, ".tar.gz") %>') - $src = "${cwd}/${name}/${tld}" - - exec { "extract-${name}": - cwd => $cwd, - command => "mkdir -p ${name}/${tld} && tar --no-same-owner \ - --no-same-permissions -xzf ${output} -C ${name}/${tld} \ - --strip-components 1", - creates => $src, - require => [ - Exec["download-${name}"], - Class['tar'] - ], - } - - exec { "configure-${name}": - cwd => $src, - command => "${configure_command} ${flags}", - creates => "${src}/Makefile", - require => Exec["extract-${name}"] - } - - exec { "make-${name}": - cwd => $src, - command => $make, - creates => $creates, - require => [ - Exec["configure-${name}"], - Class['gcc'] - ], - timeout => $make_timeout - } -} From 2e8f30d440d3964852d725f5e0efa142feef991c Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:19:11 +0100 Subject: [PATCH 219/238] puppet: Remove module cmmi_dir No longer in use. refs #6842 --- .puppet/modules/cmmi_dir/manifests/init.pp | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .puppet/modules/cmmi_dir/manifests/init.pp diff --git a/.puppet/modules/cmmi_dir/manifests/init.pp b/.puppet/modules/cmmi_dir/manifests/init.pp deleted file mode 100644 index 33d2f7eec..000000000 --- a/.puppet/modules/cmmi_dir/manifests/init.pp +++ /dev/null @@ -1,15 +0,0 @@ -define cmmi_dir ( - $configure='./configure', - $make='make && make install' -) { - Exec { - path => '/usr/bin:/bin', - cwd => "/usr/local/src/${name}", - } - - exec { "configure-${name}": - command => $configure, - } -> exec { "make-${name}": - command => $make, - } -} From ca24699e1b0d03da9bad37f99bb579ea982703e3 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:19:31 +0100 Subject: [PATCH 220/238] puppet: Remove module gcc No longer in use. refs #6842 --- .puppet/modules/gcc/manifests/init.pp | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 .puppet/modules/gcc/manifests/init.pp diff --git a/.puppet/modules/gcc/manifests/init.pp b/.puppet/modules/gcc/manifests/init.pp deleted file mode 100644 index f11538e2d..000000000 --- a/.puppet/modules/gcc/manifests/init.pp +++ /dev/null @@ -1,13 +0,0 @@ -# Class: gcc -# -# This class installs gcc. -# -# Sample Usage: -# -# include gcc -# -class gcc { - package { 'gcc': - ensure => latest, - } -} From 44d662c9833e9ded32c6a9b008a68273df7bfc80 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:19:49 +0100 Subject: [PATCH 221/238] puppet: Remove module configure No longer in use. refs #6842 --- .puppet/modules/configure/manifests/init.pp | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 .puppet/modules/configure/manifests/init.pp diff --git a/.puppet/modules/configure/manifests/init.pp b/.puppet/modules/configure/manifests/init.pp deleted file mode 100644 index beeb98b17..000000000 --- a/.puppet/modules/configure/manifests/init.pp +++ /dev/null @@ -1,17 +0,0 @@ -# Define: configure -# -# Run a gnu configure to prepare software for environment -# -# Parameters: -# [*flags*] - configure options. -# [*path*] - Target and working dir -# -define configure( - $path, - $flags -) { - exec { "configure-${name}": - cwd => $path, - command => "sh ./configure ${flags}" - } -} \ No newline at end of file From 6cb60541be6e27b46c2efe15dd1e7a8fc329df38 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:20:15 +0100 Subject: [PATCH 222/238] puppet: Remove obsolete manifests refs #6842 --- .puppet/manifests/default.pp | 2 - .puppet/manifests/default.pp.old | 375 ------------------------------- .puppet/manifests/finalize.sh | 17 -- 3 files changed, 394 deletions(-) delete mode 100644 .puppet/manifests/default.pp delete mode 100644 .puppet/manifests/default.pp.old delete mode 100644 .puppet/manifests/finalize.sh diff --git a/.puppet/manifests/default.pp b/.puppet/manifests/default.pp deleted file mode 100644 index 80abad8ef..000000000 --- a/.puppet/manifests/default.pp +++ /dev/null @@ -1,2 +0,0 @@ -include icinga2_dev -include icingaweb2_dev diff --git a/.puppet/manifests/default.pp.old b/.puppet/manifests/default.pp.old deleted file mode 100644 index f2516f6d0..000000000 --- a/.puppet/manifests/default.pp.old +++ /dev/null @@ -1,375 +0,0 @@ -include apache -include mysql -include pgsql -include openldap - -include icingaweb2 -include nodejs -include icinga2_dev - -Exec { path => '/bin:/usr/bin:/sbin:/usr/sbin' } - -$icingaVersion = '1.11.5' -$icinga2Version = '2.0.1' -$livestatusVersion = '1.2.4p5' -$phantomjsVersion = '1.9.1' -$casperjsVersion = '1.0.2' - -class { [ - 'icinga_mysql', - 'icinga_pgsql' ]: - icingaVersion => $icingaVersion, -} - -package { [ - 'gcc', 'glibc', 'glibc-common', 'gd', 'gd-devel', - 'libpng', 'libpng-devel', 'net-snmp', 'net-snmp-devel', 'net-snmp-utils', - 'libdbi', 'libdbi-devel', 'libdbi-drivers', - 'libdbi-dbd-mysql', 'libdbi-dbd-pgsql' ]: - ensure => installed -} - -php::extension { ['php-mysql', 'php-pgsql', 'php-ldap']: - require => [ Class['mysql'], Class['pgsql'], Class['openldap'] ] -} - -php::extension { 'php-gd': } - -group { 'icinga-cmd': - ensure => present -} - -group { 'icingacmd': - ensure => present, - require => Package['icinga2'] -} - -user { 'icinga': - ensure => present, - groups => 'icinga-cmd', - managehome => false -} - -user { 'apache': - groups => ['icinga-cmd', 'vagrant', 'icingacmd'], - require => [ Class['apache'], Group['icinga-cmd'], Group['icingacmd'] ] -} - -exec { 'iptables-allow-http': - unless => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables', - command => 'iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && iptables-save > /etc/sysconfig/iptables' -} - -exec { 'icinga-htpasswd': - creates => '/usr/share/icinga/htpasswd.users', - command => 'mkdir -p /usr/share/icinga && htpasswd -b -c /usr/share/icinga/htpasswd.users icingaadmin icinga', - require => Class['apache'] -} - -cmmi { 'mk-livestatus': - url => "http://mathias-kettner.de/download/mk-livestatus-${livestatusVersion}.tar.gz", - output => "mk-livestatus-${livestatusVersion}.tar.gz", - flags => '--prefix=/usr/local/icinga-mysql --exec-prefix=/usr/local/icinga-mysql', - creates => '/usr/local/icinga-mysql/lib/mk-livestatus', - make => 'make && make install', - require => Cmmi['icinga-mysql'] -} - -file { '/usr/local/icinga-mysql/etc/modules/mk-livestatus.cfg': - content => template('mk-livestatus/mk-livestatus.cfg.erb'), - owner => 'icinga', - group => 'icinga', - require => Cmmi['mk-livestatus'], - notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] -} - -file { 'openldap/db.ldif': - path => '/usr/share/openldap-servers/db.ldif', - source => 'puppet:///modules/openldap/db.ldif', - require => Class['openldap'] -} - -file { 'openldap/dit.ldif': - path => '/usr/share/openldap-servers/dit.ldif', - source => 'puppet:///modules/openldap/dit.ldif', - require => Class['openldap'] -} - -file { 'openldap/users.ldif': - path => '/usr/share/openldap-servers/users.ldif', - source => 'puppet:///modules/openldap/users.ldif', - require => Class['openldap'] -} - -exec { 'populate-openldap': - # TODO: Split the command and use unless instead of trying to populate openldap everytime - command => 'sudo ldapadd -c -Y EXTERNAL -H ldapi:/// -f /usr/share/openldap-servers/db.ldif || true && \ - sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/dit.ldif || true && \ - sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/users.ldif || true', - require => [ Service['slapd'], File['openldap/db.ldif'], - File['openldap/dit.ldif'], File['openldap/users.ldif'] ] -} - -class { 'phantomjs': - url => "https://phantomjs.googlecode.com/files/phantomjs-${phantomjsVersion}-linux-x86_64.tar.bz2", - output => "phantomjs-${phantomjsVersion}-linux-x86_64.tar.bz2", - creates => '/usr/local/phantomjs' -} - -class { 'casperjs': - url => "https://github.com/n1k0/casperjs/tarball/${casperjsVersion}", - output => "casperjs-${casperjsVersion}.tar.gz", - creates => '/usr/local/casperjs' -} - -file { '/etc/profile.d/env.sh': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/profile.d/env.sh' -} - -include epel - -exec { 'install PHPUnit': - command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-phpunit-PHPUnit', - unless => 'rpm -qa | grep php-phpunit-PHPUnit', - require => Class['epel'] -} - -exec { 'install PHP CodeSniffer': - command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-pear-PHP-CodeSniffer', - unless => 'rpm -qa | grep php-pear-PHP-CodeSniffer', - require => Class['epel'] -} - -exec { 'install php-ZendFramework': - command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework', - unless => 'rpm -qa | grep php-ZendFramework', - require => Class['epel'] -} - -package { ['cmake', 'boost-devel', 'bison', 'flex']: - ensure => installed -} - -# icinga 2 -yumrepo { 'icinga2-repo': - baseurl => "http://packages.icinga.org/epel/6/snapshot/", - enabled => '1', - gpgcheck => '1', - gpgkey => 'http://packages.icinga.org/icinga.key', - descr => "Icinga Repository - ${::architecture}" -} - -exec { 'install nagios-plugins-all': - command => 'yum -d 0 -e 0 -y --enablerepo=epel install nagios-plugins-all', - unless => 'rpm -qa | grep nagios-plugins-all', - require => [ Class['epel'], Package['icinga2'] ], -} -# vs include monitoring_plugins (epel is disabled) - - -# icinga 2 classic ui -package { 'icinga-gui': - ensure => latest, - require => Yumrepo['icinga2-repo'], - alias => 'icinga-gui' -} - -# icinga 2 ido mysql - - -# icinga 2 test config - - -exec { 'install php-ZendFramework-Db-Adapter-Pdo-Mysql': - command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework-Db-Adapter-Pdo-Mysql', - unless => 'rpm -qa | grep php-ZendFramework-Db-Adapter-Pdo-Mysql', - require => Exec['install php-ZendFramework'] -} - -file { '/etc/motd': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/motd', - owner => root, - group => root -} - -user { 'vagrant': - groups => 'icinga-cmd', - require => Group['icinga-cmd'] -} - -mysql::database::create { 'icinga_unittest': - username => 'icinga_unittest', - password => 'icinga_unittest', - privileges => 'ALL', -} - -pgsql::database::create { 'icinga_unittest': - username => 'icinga_unittest', - password => 'icinga_unittest', -} - -exec { 'install php-ZendFramework-Db-Adapter-Pdo-Pgsql': - command => 'yum -d 0 -e 0 -y --enablerepo=epel install php-ZendFramework-Db-Adapter-Pdo-Pgsql', - unless => 'rpm -qa | grep php-ZendFramework-Db-Adapter-Pdo-Pgsql', - require => Exec['install php-ZendFramework'] -} - - -# -# Following section installs the Perl module Monitoring::Generator::TestConfig in order to create test config to -# */usr/local/share/misc/monitoring_test_config*. Then the config is copied to */etc/conf.d/test_config/* of -# both the MySQL and PostgreSQL Icinga instance -# -cpan { 'Monitoring::Generator::TestConfig': - creates => '/usr/local/share/perl5/Monitoring/Generator/TestConfig.pm', - timeout => 600 -} - -exec { 'create_monitoring_test_config': - command => 'sudo install -o root -g root -d /usr/local/share/misc/ && \ - sudo /usr/local/bin/create_monitoring_test_config.pl -l icinga \ - /usr/local/share/misc/monitoring_test_config', - creates => '/usr/local/share/misc/monitoring_test_config', - require => Cpan['Monitoring::Generator::TestConfig'] -} - -define populate_monitoring_test_config { - file { "/usr/local/icinga-mysql/etc/conf.d/test_config/${name}.cfg": - owner => 'icinga', - group => 'icinga', - source => "/usr/local/share/misc/monitoring_test_config/etc/conf.d/${name}.cfg", - notify => Service['icinga-mysql'] - } - file { "/usr/local/icinga-pgsql/etc/conf.d/test_config/${name}.cfg": - owner => 'icinga', - group => 'icinga', - source => "/usr/local/share/misc/monitoring_test_config/etc/conf.d/${name}.cfg", - notify => Service['icinga-pgsql'] - } -} - -file { '/usr/local/icinga-mysql/etc/conf.d/test_config/': - ensure => directory, - owner => icinga, - group => icinga, - require => Cmmi['icinga-mysql'] -} - -file { '/usr/local/icinga-pgsql/etc/conf.d/test_config/': - ensure => directory, - owner => icinga, - group => icinga, - require => Cmmi['icinga-pgsql'] -} - -populate_monitoring_test_config { ['commands', 'contacts', 'dependencies', - 'hostgroups', 'hosts', 'servicegroups', 'services']: - require => [ Exec['create_monitoring_test_config'], - File['/usr/local/icinga-mysql/etc/conf.d/test_config/'], - File['/usr/local/icinga-pgsql/etc/conf.d/test_config/'] ] -} - -define populate_monitoring_test_config_plugins { - file { "/usr/lib64/nagios/plugins/libexec/${name}": - owner => 'icinga', - group => 'icinga', - source => "/usr/local/share/misc/monitoring_test_config/plugins/${name}", - notify => [ Service['icinga-mysql'], Service['icinga-pgsql'] ] - } -} - -populate_monitoring_test_config_plugins{ ['test_hostcheck.pl', 'test_servicecheck.pl']: - require => [ Exec['create_monitoring_test_config'], - Cmmi['icinga-mysql'], - Cmmi['icinga-pgsql'] ] -} - -# -# Following section creates and populates MySQL and PostgreSQL Icinga Web 2 databases -# - - -# -# Following section creates the Icinga command proxy to /usr/local/icinga-mysql/var/rw/icinga.cmd (which is the -# config's default path for the Icinga command pipe) in order to send commands to both the MySQL and PostgreSQL instance -# -file { [ '/usr/local/icinga/', '/usr/local/icinga/var/', '/usr/local/icinga/var/rw/' ]: - ensure => directory, - owner => icinga, - group => icinga, - require => User['icinga'] -} - -file { '/usr/local/bin/icinga_command_proxy': - source => 'puppet:////vagrant/.vagrant-puppet/files/usr/local/bin/icinga_command_proxy', - owner => root, - group => root, - mode => 755 -} - -file { '/etc/init.d/icinga_command_proxy': - source => 'puppet:////vagrant/.vagrant-puppet/files/etc/init.d/icinga_command_proxy', - owner => root, - group => root, - mode => 755, - require => File['/usr/local/bin/icinga_command_proxy'] -} - -service { 'icinga_command_proxy': - ensure => running, - require => [ File['/etc/init.d/icinga_command_proxy'], Service['icinga-mysql'], Service['icinga-pgsql'] ] -} - -mysql::database::create { 'icinga_web': - username => 'icinga_web', - password => 'icinga_web', - privileges => 'ALL', -} - -cmmi { 'icinga-web': - url => 'http://sourceforge.net/projects/icinga/files/icinga-web/1.10.0-beta/icinga-web-1.10.0-beta.tar.gz/download', - output => 'icinga-web-1.10.0-beta.tar.gz', - flags => '--prefix=/usr/local/icinga-web', - creates => '/usr/local/icinga-web', - make => 'make install && make install-apache-config', - require => Service['icinga_command_proxy'], - notify => Service['apache'] -} - -exec { 'populate-icinga_web-mysql-db': - unless => 'mysql -uicinga_web -picinga_web icinga_web -e "SELECT * FROM nsm_user;" &> /dev/null', - command => 'mysql -uicinga_web -picinga_web icinga_web < /usr/local/src/icinga-web/icinga-web-1.10.0-beta/etc/schema/mysql.sql', - require => [ Exec['create-mysql-icinga_web-db'], Cmmi['icinga-web'] ] -} - -file { '/var/www/html/icingaweb': - ensure => absent, -} - -# pear::package { 'deepend/Mockery': -# channel => 'pear.survivethedeepend.com' -# } - -# icingacli -file { '/usr/local/bin/icingacli': - ensure => 'link', - target => '/vagrant/bin/icingacli', - owner => 'apache', - group => 'apache', - require => [ File['/etc/icingaweb'], File['/etc/bash_completion.d/icingacli'] ] -} - -exec { 'install bash-completion': - command => 'yum -d 0 -e 0 -y --enablerepo=epel install bash-completion', - unless => 'rpm -qa | grep bash-completion', - require => Class['epel'] -} - -file { '/etc/bash_completion.d/icingacli': - source => 'puppet:////vagrant/etc/bash_completion.d/icingacli', - owner => 'root', - group => 'root', - mode => 755, - require => Exec['install bash-completion'] -} - diff --git a/.puppet/manifests/finalize.sh b/.puppet/manifests/finalize.sh deleted file mode 100644 index 069bb7734..000000000 --- a/.puppet/manifests/finalize.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -e - -mountIcinga2webVarLog () { - if ! $(/bin/mount | /bin/grep -q "/vagrant/var/log"); then - # Remount /vagrant/var/log/ with appropriate permissions since the group apache is missing initially - /bin/mount -t vboxsf -o \ - uid=`id -u vagrant`,gid=`id -g apache`,dmode=775,fmode=664 \ - /vagrant/var/log/ \ - /vagrant/var/log/ - fi -} - -mountIcinga2webVarLog - -exit 0 From 3a3c57390049b34eddec997d1ea4fb5426532690 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:20:43 +0100 Subject: [PATCH 223/238] puppet: Add hiera configuration files refs #6842 --- .puppet/hiera/common.yaml | 7 +++++++ .puppet/hiera/hiera.yaml | 9 +++++++++ 2 files changed, 16 insertions(+) create mode 100644 .puppet/hiera/common.yaml create mode 100644 .puppet/hiera/hiera.yaml diff --git a/.puppet/hiera/common.yaml b/.puppet/hiera/common.yaml new file mode 100644 index 000000000..0a85ba63a --- /dev/null +++ b/.puppet/hiera/common.yaml @@ -0,0 +1,7 @@ +--- +icingaweb2::config: /etc/icingaweb +icingaweb2::log: /var/log/icingaweb/icingaweb.log +icingaweb2::web_path: icingaweb +icingaweb2::db_user: icingaweb +icingaweb2::db_pass: icingaweb +icingaweb2::db_name: icingaweb diff --git a/.puppet/hiera/hiera.yaml b/.puppet/hiera/hiera.yaml new file mode 100644 index 000000000..22012bbd7 --- /dev/null +++ b/.puppet/hiera/hiera.yaml @@ -0,0 +1,9 @@ +--- +:backends: + - yaml + +:hierarchy: + - common + +:yaml: + :datadir: /vagrant/.puppet/hiera From 02044d674c1d20a011f5a8928ebbce12b986d896 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:22:27 +0100 Subject: [PATCH 224/238] puppet: Remove profile nodejs Not in use. refs #6842 --- .puppet/profiles/nodejs/manifests/init.pp | 45 ----------------------- 1 file changed, 45 deletions(-) delete mode 100644 .puppet/profiles/nodejs/manifests/init.pp diff --git a/.puppet/profiles/nodejs/manifests/init.pp b/.puppet/profiles/nodejs/manifests/init.pp deleted file mode 100644 index 2146a73b8..000000000 --- a/.puppet/profiles/nodejs/manifests/init.pp +++ /dev/null @@ -1,45 +0,0 @@ -class nodejs { - include epel - - exec { 'install nodejs': - command => 'yum -d 0 -e 0 -y --enablerepo=epel install npm', - unless => 'rpm -qa | grep ^npm', - require => Class['epel'], - } - - exec { 'install npm/mocha': - command => 'npm install -g mocha', - creates => '/usr/lib/node_modules/mocha', - require => Exec['install nodejs'], - } - - exec { 'install npm/mocha-cobertura-reporter': - command => 'npm install -g mocha-cobertura-reporter', - creates => '/usr/lib/node_modules/mocha-cobertura-reporter', - require => Exec['install npm/mocha'], - } - - exec { 'install npm/jshint': - command => 'npm install -g jshint', - creates => '/usr/lib/node_modules/jshint', - require => Exec['install nodejs'], - } - - exec { 'install npm/expect': - command => 'npm install -g expect', - creates => '/usr/lib/node_modules/expect', - require => Exec['install nodejs'], - } - - exec { 'install npm/should': - command => 'npm install -g should', - creates => '/usr/lib/node_modules/should', - require => Exec['install nodejs'], - } - - exec { 'install npm/URIjs': - command => 'npm install -g URIjs', - creates => '/usr/lib/node_modules/URIjs', - require => Exec['install nodejs'], - } -} From 11111b0d09a7ddc34db35ff42e02b837ce91b339 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:22:43 +0100 Subject: [PATCH 225/238] puppet: Remove profile icinga_mysql Not in use. refs #6842 --- .../profiles/icinga_mysql/manifests/init.pp | 68 ------------------- 1 file changed, 68 deletions(-) delete mode 100644 .puppet/profiles/icinga_mysql/manifests/init.pp diff --git a/.puppet/profiles/icinga_mysql/manifests/init.pp b/.puppet/profiles/icinga_mysql/manifests/init.pp deleted file mode 100644 index c5ab38a81..000000000 --- a/.puppet/profiles/icinga_mysql/manifests/init.pp +++ /dev/null @@ -1,68 +0,0 @@ -class icinga_mysql ($icingaVersion) { - cmmi { 'icinga-mysql': - url => "https://github.com/Icinga/icinga-core/releases/download/v${icingaVersion}/icinga-${icingaVersion}.tar.gz", - output => "icinga-${icingaVersion}.tar.gz", - flags => '--prefix=/usr/local/icinga-mysql --with-command-group=icinga-cmd \ - --enable-idoutils --with-init-dir=/usr/local/icinga-mysql/etc/init.d \ - --with-htmurl=/icinga-mysql --with-httpd-conf-file=/etc/httpd/conf.d/icinga-mysql.conf \ - --with-cgiurl=/icinga-mysql/cgi-bin \ - --with-http-auth-file=/usr/share/icinga/htpasswd.users \ - --with-plugin-dir=/usr/lib64/nagios/plugins/libexec', - creates => '/usr/local/icinga-mysql', - make => 'make all && make fullinstall install-config', - require => [ User['icinga'], Exec['install nagios-plugins-all'], Package['apache'] ], - notify => Service['apache'], - } - - file { '/etc/init.d/icinga-mysql': - source => '/usr/local/icinga-mysql/etc/init.d/icinga', - require => Cmmi['icinga-mysql'], - } - - file { '/etc/init.d/ido2db-mysql': - source => '/usr/local/icinga-mysql/etc/init.d/ido2db', - require => Cmmi['icinga-mysql'], - } - - service { 'icinga-mysql': - ensure => running, - require => File['/etc/init.d/icinga-mysql'], - } - - service { 'ido2db-mysql': - ensure => running, - require => File['/etc/init.d/ido2db-mysql'], - } - - file { '/usr/local/icinga-mysql/etc/ido2db.cfg': - content => template('icinga/ido2db-mysql.cfg.erb'), - owner => 'icinga', - group => 'icinga', - require => Cmmi['icinga-mysql'], - notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] - } - - file { '/usr/local/icinga-mysql/etc/idomod.cfg': - source => '/usr/local/icinga-mysql/etc/idomod.cfg-sample', - owner => 'icinga', - group => 'icinga', - require => Cmmi['icinga-mysql'], - notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] - } - - file { '/usr/local/icinga-mysql/etc/modules/idoutils.cfg': - source => '/usr/local/icinga-mysql/etc/modules/idoutils.cfg-sample', - owner => 'icinga', - group => 'icinga', - require => Cmmi['icinga-mysql'], - notify => [ Service['icinga-mysql'], Service['ido2db-mysql'] ] - } - - mysql::database::populate { 'icinga': - username => 'icinga', - password => 'icinga', - privileges => 'SELECT,INSERT,UPDATE,DELETE', - schemafile => "/usr/local/src/icinga-mysql/icinga-${icingaVersion}/module/idoutils/db/mysql/mysql.sql", - requirement => Cmmi['icinga-mysql'], - } -} From 57fdee337381558b844605e270d530df08b52b02 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:23:00 +0100 Subject: [PATCH 226/238] puppet: Remove profile icinga_pgsql Not in use. refs #6842 --- .../profiles/icinga_pgsql/manifests/init.pp | 68 ------------------- 1 file changed, 68 deletions(-) delete mode 100644 .puppet/profiles/icinga_pgsql/manifests/init.pp diff --git a/.puppet/profiles/icinga_pgsql/manifests/init.pp b/.puppet/profiles/icinga_pgsql/manifests/init.pp deleted file mode 100644 index a9590a913..000000000 --- a/.puppet/profiles/icinga_pgsql/manifests/init.pp +++ /dev/null @@ -1,68 +0,0 @@ -class icinga_pgsql ($icingaVersion) { - cmmi { 'icinga-pgsql': - url => "https://github.com/Icinga/icinga-core/releases/download/v${icingaVersion}/icinga-${icingaVersion}.tar.gz", - output => "icinga-${icingaVersion}.tar.gz", - flags => '--prefix=/usr/local/icinga-pgsql \ - --with-command-group=icinga-cmd --enable-idoutils \ - --with-init-dir=/usr/local/icinga-pgsql/etc/init.d \ - --with-htmurl=/icinga-pgsql --with-httpd-conf-file=/etc/httpd/conf.d/icinga-pgsql.conf \ - --with-cgiurl=/icinga-pgsql/cgi-bin \ - --with-http-auth-file=/usr/share/icinga/htpasswd.users \ - --with-plugin-dir=/usr/lib64/nagios/plugins/libexec', - creates => '/usr/local/icinga-pgsql', - make => 'make all && make fullinstall install-config', - require => [ User['icinga'], Exec['install nagios-plugins-all'], Package['apache'] ], - notify => Service['apache'], - } - - file { '/etc/init.d/icinga-pgsql': - source => '/usr/local/icinga-pgsql/etc/init.d/icinga', - require => Cmmi['icinga-pgsql'], - } - - file { '/etc/init.d/ido2db-pgsql': - source => '/usr/local/icinga-pgsql/etc/init.d/ido2db', - require => Cmmi['icinga-pgsql'], - } - - service { 'icinga-pgsql': - ensure => running, - require => Cmmi['icinga-pgsql'], - } - - service { 'ido2db-pgsql': - ensure => running, - require => Cmmi['icinga-pgsql'], - } - - file { '/usr/local/icinga-pgsql/etc/ido2db.cfg': - content => template('icinga/ido2db-pgsql.cfg.erb'), - owner => 'icinga', - group => 'icinga', - require => Cmmi['icinga-pgsql'], - notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ] - } - - file { '/usr/local/icinga-pgsql/etc/idomod.cfg': - source => '/usr/local/icinga-pgsql/etc/idomod.cfg-sample', - owner => 'icinga', - group => 'icinga', - require => Cmmi['icinga-pgsql'], - notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ] - } - - file { '/usr/local/icinga-pgsql/etc/modules/idoutils.cfg': - source => '/usr/local/icinga-pgsql/etc/modules/idoutils.cfg-sample', - owner => 'icinga', - group => 'icinga', - require => Cmmi['icinga-pgsql'], - notify => [ Service['icinga-pgsql'], Service['ido2db-pgsql'] ] - } - - pgsql::database::populate { 'icinga': - username => 'icinga', - password => 'icingaweb', - schemafile => "/usr/local/src/icinga-pgsql/icinga-${icingaVersion}/module/idoutils/db/pgsql/pgsql.sql", - require => Cmmi['icinga-pgsql'], - } -} From 60b8529db01300dc434bbf2f87545e740ac0808a Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:23:48 +0100 Subject: [PATCH 227/238] Revert "puppet: Remove module cmmi_dir" This reverts commit 2e8f30d440d3964852d725f5e0efa142feef991c. It's in use :) --- .puppet/modules/cmmi_dir/manifests/init.pp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .puppet/modules/cmmi_dir/manifests/init.pp diff --git a/.puppet/modules/cmmi_dir/manifests/init.pp b/.puppet/modules/cmmi_dir/manifests/init.pp new file mode 100644 index 000000000..33d2f7eec --- /dev/null +++ b/.puppet/modules/cmmi_dir/manifests/init.pp @@ -0,0 +1,15 @@ +define cmmi_dir ( + $configure='./configure', + $make='make && make install' +) { + Exec { + path => '/usr/bin:/bin', + cwd => "/usr/local/src/${name}", + } + + exec { "configure-${name}": + command => $configure, + } -> exec { "make-${name}": + command => $make, + } +} From 575b6778f14e3940d25ae0d1d5a2c449026bdc45 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 12:25:11 +0100 Subject: [PATCH 228/238] puppet: Provision epel repository first It should not be necesarry to require the epel repostiry where it is used. refs #6842 --- .puppet/manifests/site.pp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.puppet/manifests/site.pp b/.puppet/manifests/site.pp index 4d9fba1f2..adf412fb2 100644 --- a/.puppet/manifests/site.pp +++ b/.puppet/manifests/site.pp @@ -1,4 +1,11 @@ +stage { 'repositories': + before => Stage['main'], +} + node 'localhost' { + class { 'epel': + stage => repositories, + } include icinga2_dev include icingaweb2_dev include motd From 37b9aa36ec8d70e40f67aa2a9537b85e739472b6 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 13:40:33 +0100 Subject: [PATCH 229/238] puppet: Update TODO refs #6842 --- .puppet/TODO.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.puppet/TODO.md b/.puppet/TODO.md index 71953f54c..04af9a108 100644 --- a/.puppet/TODO.md +++ b/.puppet/TODO.md @@ -18,3 +18,5 @@ Fix steps that are always provisioned: ==> default: Notice: /Stage[main]/Icinga2_mysql/Icinga2::Feature[ido-mysql]/Icinga2::Config[features-available/ido-mysql]/Parent_dirs[/etc/icinga2/features-available/ido-mysql.conf]/Exec[parent_dirs-/etc/icinga2/features-available/ido-mysql.conf]/returns: executed successfully ==> default: Notice: /Stage[main]/Icinga2_pgsql/Icinga2::Feature[ido-pgsql]/Icinga2::Config[features-available/ido-pgsql]/Parent_dirs[/etc/icinga2/features-available/ido-pgsql.conf]/Exec[parent_dirs-/etc/icinga2/features-available/ido-pgsql.conf]/returns: executed successfully ==> default: Notice: /Stage[main]/Icinga2_pgsql/Icinga2::Feature[ido-pgsql]/Parent_dirs[/etc/icinga2/features-enabled/ido-pgsql.conf]/Exec[parent_dirs-/etc/icinga2/features-enabled/ido-pgsql.conf]/returns: executed successfully + +Fix provisioning for CentOS 7 From ea69b3f7093eb4d25279662e9eb53f656c07b84d Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 15 Dec 2014 13:44:32 +0100 Subject: [PATCH 230/238] puppet: Add the preferences configuration directory refs #6842 --- .puppet/modules/icingaweb2/manifests/config.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.puppet/modules/icingaweb2/manifests/config.pp b/.puppet/modules/icingaweb2/manifests/config.pp index c2005cf18..473d89d06 100644 --- a/.puppet/modules/icingaweb2/manifests/config.pp +++ b/.puppet/modules/icingaweb2/manifests/config.pp @@ -5,7 +5,7 @@ class icingaweb2::config ( ensure => present, } - file { [ "${config}", "${config}/enabledModules", "${config}/modules" ]: + file { [ "${config}", "${config}/enabledModules", "${config}/modules", "${config}/preferences" ]: ensure => directory, owner => 'root', group => 'icingaweb', From bca28a5ae2fcc94f633c69536a701950eae82a26 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 15 Dec 2014 13:55:20 +0100 Subject: [PATCH 231/238] Display inline pie-charts also in views exported to PDF fixes #6463 --- library/Icinga/Application/webrouter.php | 2 +- library/Icinga/Chart/Chart.php | 27 +++++++++++++++-- library/Icinga/Chart/Inline/PieChart.php | 29 +++++++++---------- library/Icinga/File/Pdf.php | 1 - library/Icinga/Web/Widget/Chart/InlinePie.php | 18 ++++++++++++ modules/setup/library/Setup/WebWizard.php | 17 +++++++++-- 6 files changed, 72 insertions(+), 22 deletions(-) diff --git a/library/Icinga/Application/webrouter.php b/library/Icinga/Application/webrouter.php index 71b48b2c7..b00034871 100644 --- a/library/Icinga/Application/webrouter.php +++ b/library/Icinga/Application/webrouter.php @@ -92,7 +92,7 @@ if (in_array($path, $special)) { header('Content-Type: image/svg+xml'); $pie = new PieChart(); $pie->initFromRequest(); - echo $pie->render(); + $pie->toSvg(); } elseif ($path === 'png/chart.php') { if (!array_key_exists('data', $_GET)) { diff --git a/library/Icinga/Chart/Chart.php b/library/Icinga/Chart/Chart.php index 3cfa4b39a..5b545d4de 100644 --- a/library/Icinga/Chart/Chart.php +++ b/library/Icinga/Chart/Chart.php @@ -4,7 +4,7 @@ namespace Icinga\Chart; -use Exception; +use Imagick; use Icinga\Chart\Legend; use Icinga\Chart\Palette; use Icinga\Chart\Primitive\Drawable; @@ -110,12 +110,35 @@ abstract class Chart implements Drawable return $this->renderer->render(); } + /** + * Return this graph rendered as PNG + * + * @param int $width The width of the PNG in pixel + * @param int $height The height of the PNG in pixel + * + * @return string A PNG binary string + * + * @throws IcingaException In case ImageMagick is not available + */ + public function toPng($width, $height) + { + if (! class_exists('Imagick')) { + throw new IcingaException('Cannot render PNGs without ImageMagick'); + } + + $image = new Imagick(); + $image->readImageBlob($this->render()); + $image->setImageFormat('png24'); + $image->resizeImage($width, $height, imagick::FILTER_LANCZOS, 1); + return $image; + } + /** * Align the chart to the top left corner instead of centering it * * @param bool $align */ - public function alignTopLeft ($align = true) + public function alignTopLeft($align = true) { $this->align = $align; } diff --git a/library/Icinga/Chart/Inline/PieChart.php b/library/Icinga/Chart/Inline/PieChart.php index f42034ebd..fdffd9acd 100644 --- a/library/Icinga/Chart/Inline/PieChart.php +++ b/library/Icinga/Chart/Inline/PieChart.php @@ -5,17 +5,13 @@ namespace Icinga\Chart\Inline; use Icinga\Chart\PieChart as PieChartRenderer; -use Imagick; -use Exception; -use Icinga\Exception\IcingaException; /** * Draw an inline pie-chart directly from the available request parameters. */ class PieChart extends Inline { - - public function render($output = true) + protected function getChart() { $pie = new PieChartRenderer(); $pie->alignTopLeft(); @@ -23,23 +19,24 @@ class PieChart extends Inline $pie->drawPie(array( 'data' => $this->data, 'colors' => $this->colors, 'labels' => $this->labels )); + return $pie; + } + + public function toSvg($output = true) + { if ($output) { - echo $pie->render(); + echo $this->getChart()->render(); } else { - return $pie->render(); + return $this->getChart()->render(); } } - public function toPng() + public function toPng($output = true) { - if (! class_exists('Imagick')) { - // TODO: This is quick & dirty. 404? - throw new IcingaException('Cannot render PNGs without Imagick'); + if ($output) { + echo $this->getChart()->toPng($this->width, $this->height); + } else { + return $this->getChart()->toPng($this->width, $this->height); } - $image = new Imagick(); - $image->readImageBlob($this->render(false)); - $image->setImageFormat('png24'); - $image->resizeImage($this->width, $this->height, imagick::FILTER_LANCZOS, 1); - echo $image; } } diff --git a/library/Icinga/File/Pdf.php b/library/Icinga/File/Pdf.php index 44d1a107a..a372cbfdf 100644 --- a/library/Icinga/File/Pdf.php +++ b/library/Icinga/File/Pdf.php @@ -49,7 +49,6 @@ class Pdf extends DOMPDF $html = $layout->render(); $imgDir = Url::fromPath('img'); $html = preg_replace('~src="' . $imgDir . '/~', 'src="' . Icinga::app()->getBootstrapDirectory() . '/img/', $html); - $html = preg_replace('~src="/svg/chart.php(.*)"~', 'class="icon" src="http://master1.com/png/chart.php$1"', $html); $this->load_html($html); $this->render(); $this->stream( diff --git a/library/Icinga/Web/Widget/Chart/InlinePie.php b/library/Icinga/Web/Widget/Chart/InlinePie.php index 3ff97b2df..90cf3e875 100644 --- a/library/Icinga/Web/Widget/Chart/InlinePie.php +++ b/library/Icinga/Web/Widget/Chart/InlinePie.php @@ -4,10 +4,12 @@ namespace Icinga\Web\Widget\Chart; +use Icinga\Chart\PieChart; use Icinga\Web\Widget\AbstractWidget; use Icinga\Web\Url; use Icinga\Util\Format; use Icinga\Application\Logger; +use Icinga\Exception\IcingaException; /** * A SVG-PieChart intended to be displayed as a small icon next to labels, to offer a better visualization of the @@ -375,6 +377,22 @@ EOD; */ public function render() { + if ($this->view()->layout()->getLayout() === 'pdf') { + $pie = new PieChart(); + $pie->alignTopLeft(); + $pie->disableLegend(); + $pie->drawPie(array( + 'data' => $this->data, 'colors' => $this->colors, 'labels' => $this->labels + )); + + try { + $png = $pie->toPng($this->width, $this->height); + return ''; + } catch (IcingaException $_) { + return ''; + } + } + $template = $this->template; $template = str_replace('{url}', $this->url, $template); diff --git a/modules/setup/library/Setup/WebWizard.php b/modules/setup/library/Setup/WebWizard.php index 72cd4f286..53a6bb8a8 100644 --- a/modules/setup/library/Setup/WebWizard.php +++ b/modules/setup/library/Setup/WebWizard.php @@ -461,8 +461,8 @@ class WebWizard extends Wizard implements SetupWizard mt('setup', 'PHP Module: GD'), mt( 'setup', - 'In case you want icons and graphs being exported to PDF' - . ' as well, you\'ll need the GD extension for PHP.' + 'In case you want icons being exported to PDF as' + . ' well, you\'ll need the GD extension for PHP.' ), Platform::extensionLoaded('gd'), Platform::extensionLoaded('gd') ? mt('setup', 'The PHP module GD is available') : ( @@ -470,6 +470,19 @@ class WebWizard extends Wizard implements SetupWizard ) ); + $requirements->addOptional( + mt('setup', 'PHP Module: Imagick'), + mt( + 'setup', + 'In case you want graphs being exported to PDF as well' + . ', you\'ll need the ImageMagick extension for PHP.' + ), + Platform::extensionLoaded('imagick'), + Platform::extensionLoaded('imagick') ? mt('setup', 'The PHP module Imagick is available') : ( + mt('setup', 'The PHP module Imagick is missing') + ) + ); + $requirements->addOptional( mt('setup', 'PHP Module: PDO-MySQL'), mt( From 3fde78f2b3ae06183eeb6d1a06df3e44637b6484 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 15 Dec 2014 13:56:19 +0100 Subject: [PATCH 232/238] Enable the dompdf float support and fix our list's layout --- application/layouts/scripts/pdf.phtml | 2 +- library/Icinga/Web/Widget/Chart/InlinePie.php | 2 +- library/Icinga/Web/Widget/FilterEditor.php | 2 +- library/vendor/dompdf/dompdf_config.custom.inc.php | 2 +- modules/monitoring/application/views/helpers/Perfdata.php | 8 ++------ .../application/views/scripts/list/services.phtml | 2 +- public/css/icinga/monitoring-colors.less | 5 +++-- public/css/pdf/pdfprint.less | 7 ++++++- 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/application/layouts/scripts/pdf.phtml b/application/layouts/scripts/pdf.phtml index c4a1b25f7..38c9bdc2c 100644 --- a/application/layouts/scripts/pdf.phtml +++ b/application/layouts/scripts/pdf.phtml @@ -31,7 +31,7 @@ if ( isset($pdf) ) } -img('img/logo_icinga_big_dark.png', array('align' => 'right', 'width' => '150')) ?> +img('img/logo_icinga_big_dark.png', array('align' => 'right', 'width' => '75')) ?>