we have a puppet setup that basically works like this:
- Create user "puppetdeploy"
- Grant access to all tables for user "puppetdeploy"
- Runs scripts that creates and updates databases from .sql files, using 'puppetdeploy'
- Revoke all access to user 'puppetdeploy'
.pp file looks something like this:
mysql_user { 'puppetdeploy@localhost':
ensure => 'present',
password_hash => '*****',
}->
mysql_grant { 'grant_all_for_puppetdeploy':
ensure => 'present',
options => ['GRANT'],
privileges => ['ALL'],
table => '*.*',
user => 'puppetdeploy@localhost',
}
#... execute scripts to import bunch of .sql files using mysql user 'puppetdeploy'
mysql_grant { 'revoke_all_for_puppetdeploy':
options => ['REVOKE'],
privileges => ['ALL'],
table => '*.*',
user => 'puppetdeploy@localhost',
}
In later versions of the mysql-module this no longer works, as name for each grant need to be in format '[user]/[table]', and I'm not allowed to have same name for two or more mysql_grants.
Are there any ways to work around this restriction in puppetlabs-mysql 3.0.0, or are there better ways to deal with temporary mysql users?