58e15152c4
v4.0.0 cb0daf02d7a991be642e62294912d93b036c6a5a Implements: blueprint merge-openstack-puppet-modules Change-Id: I2f5f282a5388644ed092c2c42c358ce07ed99bbf
34 lines
996 B
Puppet
34 lines
996 B
Puppet
#
|
|
# Used to grant access to the glance mysql DB
|
|
#
|
|
define glance::db::mysql::host_access ($user, $password, $database, $mysql_module = '0.9') {
|
|
|
|
if ($mysql_module >= 2.2) {
|
|
mysql_user { "${user}@${name}":
|
|
password_hash => mysql_password($password),
|
|
require => Mysql_database[$database],
|
|
}
|
|
|
|
mysql_grant { "${user}@${name}/${database}.*":
|
|
privileges => ['ALL'],
|
|
options => ['GRANT'],
|
|
provider => 'mysql',
|
|
table => "${database}.*",
|
|
require => Mysql_user["${user}@${name}"],
|
|
user => "${user}@${name}"
|
|
}
|
|
} else {
|
|
database_user { "${user}@${name}":
|
|
password_hash => mysql_password($password),
|
|
provider => 'mysql',
|
|
require => Database[$database],
|
|
}
|
|
database_grant { "${user}@${name}/${database}":
|
|
# TODO figure out which privileges to grant.
|
|
privileges => 'all',
|
|
provider => 'mysql',
|
|
require => Database_user["${user}@${name}"]
|
|
}
|
|
}
|
|
}
|