parent
5c0f998085
commit
5f977328a9
|
@ -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':
|
||||
|
|
|
@ -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],
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue