Outsource specific parts into profiles icinga-mysql, icinga-pgsql, icinga2, icingaweb2 and nodejs
refs #6842
This commit is contained in:
parent
05afbeebe0
commit
392e725d8a
|
@ -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'
|
||||
# }
|
||||
|
|
|
@ -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'],
|
||||
}
|
||||
}
|
|
@ -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'],
|
||||
}
|
||||
}
|
|
@ -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'],
|
||||
}
|
||||
}
|
|
@ -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',
|
||||
}
|
||||
}
|
|
@ -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'],
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue