Outsource `icinga2' stuff, `icinga2-mysql' stuff and `icinga2::feature' into modules

refs #6842
This commit is contained in:
Alexander Klimov 2014-08-22 13:37:27 +02:00
parent 114a648b4f
commit 5a6995f67f
4 changed files with 83 additions and 79 deletions

View File

@ -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'],
}
}

View File

@ -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']
}
}

View File

@ -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'],
}
}

View File

@ -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',