mirror of https://github.com/Icinga/icinga2.git
Refactor Puppet files.
This commit is contained in:
parent
6534ad938a
commit
6729d1177f
|
@ -1,10 +1,5 @@
|
|||
include apache
|
||||
include mysql
|
||||
# enable when icinga2-ido-pgsql is ready
|
||||
#include pgsql
|
||||
include epel
|
||||
include icinga-classicui
|
||||
include icinga2
|
||||
include icinga-web
|
||||
include nagios-plugins
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class apache {
|
|||
|
||||
exec { 'iptables-allow-http':
|
||||
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
||||
unless => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables',
|
||||
unless => 'grep -Fxqe "-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables',
|
||||
command => 'lokkit --enabled --service=http'
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
class icinga-classicui {
|
||||
include icinga-rpm-snapshot
|
||||
include icinga2
|
||||
|
||||
# workaround for package conflicts
|
||||
# icinga-gui pulls icinga-gui-config automatically
|
||||
|
@ -31,12 +32,9 @@ class icinga-classicui {
|
|||
require => [ Class['apache'], Group['icingacmd'] ]
|
||||
}
|
||||
|
||||
exec { 'enable-icinga2-features':
|
||||
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
||||
command => 'i2enfeature statusdat; \
|
||||
i2enfeature compat-log; \
|
||||
i2enfeature command;',
|
||||
require => [ Package['icinga2'] ],
|
||||
notify => Service['icinga2']
|
||||
}
|
||||
icinga2::feature { 'statusdat': }
|
||||
|
||||
icinga2::feature { 'command': }
|
||||
|
||||
icinga2::feature { 'compat-log': }
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class icinga-web {
|
||||
include icinga-rpm-snapshot
|
||||
include icinga2-ido-mysql
|
||||
include mysql
|
||||
|
||||
php::extension { ['php-mysql']:
|
||||
require => [ Class['mysql'] ]
|
||||
|
@ -27,4 +28,4 @@ class icinga-web {
|
|||
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'] ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,13 +42,6 @@ class icinga2-ido-mysql {
|
|||
notify => Service['icinga2']
|
||||
}
|
||||
|
||||
exec { 'enable-icinga2-ido-mysql':
|
||||
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
||||
command => 'i2enfeature ido-mysql;',
|
||||
require => [ Package['icinga2'], Exec['populate-icinga2-ido-mysql-db'] ],
|
||||
notify => Service['icinga2']
|
||||
}
|
||||
|
||||
exec { 'create-mysql-icinga2-ido-db':
|
||||
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
||||
unless => 'mysql -uicinga -picinga icinga',
|
||||
|
@ -65,6 +58,10 @@ class icinga2-ido-mysql {
|
|||
command => 'mysql -uicinga -picinga icinga < /usr/share/doc/icinga2-ido-mysql-$(rpm -q icinga2-ido-mysql | cut -d\'-\' -f4)/schema/mysql.sql',
|
||||
require => [ Package['icinga2-ido-mysql'], Exec['create-mysql-icinga2-ido-db'] ]
|
||||
}
|
||||
|
||||
icinga2::feature { 'ido-mysql':
|
||||
require => Exec['create-mysql-icinga2-ido-db']
|
||||
}
|
||||
}
|
||||
|
||||
#class icinga2-ido-pgsql {
|
||||
|
@ -93,4 +90,14 @@ class icinga2-ido-mysql {
|
|||
# php::extension { ['php-pgsql']:
|
||||
# require => [ Class['pgsql'] ]
|
||||
# }
|
||||
#}
|
||||
#}
|
||||
|
||||
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 => "i2enfeature ${feature}",
|
||||
require => [ Package['icinga2'] ],
|
||||
notify => Service['icinga2']
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue