puppet-cinder/manifests/db/mysql/host_access.pp
Michael Chapman 62f92f9888 Add support for puppetlabs-mysql 2.2
Puppetlabs-mysql has been rewritten to be much
cleaner. This patch adds a new parameter for the
cinder mysql class allowing users to use the new
version. Previous behavior will continue as normal
when using the old version (0.9)

Change-Id: Ie0011102d9f4dfcd50f24afcb73072090c914011
2014-03-18 15:49:55 +11:00

34 lines
1.0 KiB
Puppet

#
# Used to grant access to the cinder mysql DB
#
define cinder::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),
provider => 'mysql',
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}"]
}
}
}