2013-10-15 09:36:29 +02:00
|
|
|
class icinga-web {
|
|
|
|
include icinga-rpm-snapshot
|
2013-10-15 10:59:32 +02:00
|
|
|
include icinga2-ido-mysql
|
2013-11-05 11:19:21 +01:00
|
|
|
include icinga2-ido-pgsql
|
2013-10-16 08:25:11 +02:00
|
|
|
include mysql
|
2013-10-15 09:36:29 +02:00
|
|
|
|
|
|
|
php::extension { ['php-mysql']:
|
|
|
|
require => [ Class['mysql'] ]
|
|
|
|
}
|
|
|
|
|
2013-11-05 11:19:21 +01:00
|
|
|
php::extension { ['php-pgsql']:
|
|
|
|
require => [ Class['pgsql'] ]
|
|
|
|
}
|
|
|
|
|
2013-10-15 09:36:29 +02:00
|
|
|
package { 'icinga-web':
|
|
|
|
ensure => installed,
|
|
|
|
require => Class['icinga-rpm-snapshot'],
|
2013-10-15 10:12:30 +02:00
|
|
|
notify => Service['apache']
|
2013-10-15 09:36:29 +02:00
|
|
|
}
|
|
|
|
|
2013-10-16 21:11:49 +02:00
|
|
|
package { 'icinga-web-mysql':
|
|
|
|
ensure => installed,
|
|
|
|
require => Class['icinga-rpm-snapshot'],
|
|
|
|
notify => Service['apache']
|
|
|
|
}
|
|
|
|
|
2013-10-15 09:36:29 +02:00
|
|
|
exec { 'create-mysql-icinga-web-db':
|
2013-10-15 10:12:30 +02:00
|
|
|
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
|
|
|
unless => 'mysql -uicinga_web -picinga_web icinga_web',
|
2013-10-16 21:11:49 +02:00
|
|
|
command => 'mysql -uroot -e "CREATE DATABASE icinga_web; GRANT ALL ON icinga_web.* TO icinga_web@localhost IDENTIFIED BY \'icinga_web\';"',
|
2013-10-15 09:36:29 +02:00
|
|
|
require => Service['mysqld']
|
|
|
|
}
|
|
|
|
|
|
|
|
exec { 'populate-icinga-web-mysql-db':
|
2013-10-15 10:12:30 +02:00
|
|
|
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
|
|
|
unless => 'mysql -uicinga_web -picinga_web icinga_web -e "SELECT * FROM nsm_user;" &> /dev/null',
|
2013-10-15 09:36:29 +02:00
|
|
|
command => 'mysql -uicinga_web -picinga_web icinga_web < /usr/share/icinga-web/etc/schema/mysql.sql',
|
|
|
|
require => [ Package['icinga-web'], Exec['create-mysql-icinga-web-db'] ]
|
|
|
|
}
|
2013-10-16 21:31:29 +02:00
|
|
|
|
2013-10-18 22:34:44 +02:00
|
|
|
exec { 'set-icinga2-cmd-pipe-path':
|
2013-10-16 21:31:29 +02:00
|
|
|
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
2013-10-18 22:34:44 +02:00
|
|
|
command => 'sed -i \'s/\/var\/spool\/icinga\/cmd\/icinga.cmd/\/var\/run\/icinga2\/cmd\/icinga2.cmd/g\' /etc/icinga-web/conf.d/access.xml',
|
|
|
|
require => Package['icinga-web']
|
2013-10-16 21:31:29 +02:00
|
|
|
}
|
|
|
|
|
2013-10-18 22:34:44 +02:00
|
|
|
exec { 'clear-config-cache':
|
2013-10-16 21:31:29 +02:00
|
|
|
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
2013-10-18 22:34:44 +02:00
|
|
|
command => '/usr/bin/icinga-web-clearcache',
|
|
|
|
require => Exec['set-icinga2-cmd-pipe-path']
|
2013-10-16 21:31:29 +02:00
|
|
|
}
|
2013-10-18 22:34:44 +02:00
|
|
|
|
2013-10-16 08:25:11 +02:00
|
|
|
}
|