Split mysql::database into mysql::database::create and mysql::database::populate
refs #6842
This commit is contained in:
parent
538088d177
commit
920a784beb
|
@ -12,14 +12,14 @@ $livestatusVersion = '1.2.4p5'
|
|||
$phantomjsVersion = '1.9.1'
|
||||
$casperjsVersion = '1.0.2'
|
||||
|
||||
mysql::database { 'icinga':
|
||||
mysql::database::populate { 'icinga':
|
||||
username => 'icinga',
|
||||
password => 'icinga',
|
||||
schemafile => "/usr/local/src/icinga-mysql/icinga-${icingaVersion}/module/idoutils/db/mysql/mysql.sql",
|
||||
requirement => Cmmi['icinga-mysql'],
|
||||
}
|
||||
|
||||
mysql::database { 'icinga2':
|
||||
mysql::database::populate { 'icinga2':
|
||||
username => 'icinga2',
|
||||
password => 'icinga2',
|
||||
schemafile => "/usr/share/doc/icinga2-ido-mysql-${icinga2Version}/schema/mysql.sql",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define mysql::database ($username, $password, $schemafile, $requirement) {
|
||||
define mysql::database::create ($username, $password) {
|
||||
include mysql
|
||||
|
||||
exec { "create-mysql-${name}-db":
|
||||
|
@ -8,6 +8,15 @@ GRANT SELECT,INSERT,UPDATE,DELETE ON ${name}.* TO ${username}@localhost \
|
|||
IDENTIFIED BY '${password}';\"",
|
||||
require => Service['mysqld']
|
||||
}
|
||||
}
|
||||
|
||||
define mysql::database::populate ($username, $password, $schemafile, $requirement) {
|
||||
include mysql
|
||||
|
||||
mysql::database::create { $name:
|
||||
username => $username,
|
||||
password => $password,
|
||||
}
|
||||
|
||||
exec { "populate-${name}-mysql-db":
|
||||
unless => "mysql -u${username} -p${password} ${name} -e \"SELECT * FROM icinga_dbversion;\" &> /dev/null",
|
||||
|
|
Loading…
Reference in New Issue