Make privileges customizable in mysql::database::create (and mysql::database::populate)
refs #6842
This commit is contained in:
parent
920a784beb
commit
2e1afd7194
|
@ -15,6 +15,7 @@ $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'],
|
||||
}
|
||||
|
@ -22,6 +23,7 @@ mysql::database::populate { 'icinga':
|
|||
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'],
|
||||
}
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
define mysql::database::create ($username, $password) {
|
||||
define mysql::database::create ($username, $password, $privileges) {
|
||||
include mysql
|
||||
|
||||
exec { "create-mysql-${name}-db":
|
||||
unless => "mysql -u${username} -p${password} ${name}",
|
||||
command => "mysql -uroot -e \"CREATE DATABASE ${name}; \
|
||||
GRANT SELECT,INSERT,UPDATE,DELETE ON ${name}.* TO ${username}@localhost \
|
||||
GRANT ${privileges} ON ${name}.* TO ${username}@localhost \
|
||||
IDENTIFIED BY '${password}';\"",
|
||||
require => Service['mysqld']
|
||||
}
|
||||
}
|
||||
|
||||
define mysql::database::populate ($username, $password, $schemafile, $requirement) {
|
||||
define mysql::database::populate ($username, $password, $privileges, $schemafile, $requirement) {
|
||||
include mysql
|
||||
|
||||
mysql::database::create { $name:
|
||||
username => $username,
|
||||
password => $password,
|
||||
privileges => $privileges,
|
||||
}
|
||||
|
||||
exec { "populate-${name}-mysql-db":
|
||||
|
|
Loading…
Reference in New Issue