Closed we-CONECT-Joe closed 7 years ago
Thanks for fixing the headers....
However, I don't think the example for users are completely correct. This module also does not handle any of that. It instead relies on puppetlabs-mysql for that. If you want to link to their README for documentation on creating users etc, I think that would be better...
We just takes some hashes that pass on to the mysql module.
yeah sorry i realised this down the road too! trying to adapt it now!
also i found your db_grant but iam shooting for something more specific something like this is my current model, but im not sure yet.:
`# NOTE: if no host is specified, it is interpreted as: "user@%".
define mysqladminuser( $user, $password) { exec { "create_mysql_adminuser$name": require => Exec["set-mysql-root-password"], command => "/usr/bin/mysql -uroot -p$mysqlserver::conf::mysql_root_password -e \" grant all privileges on . to '$user'@'localhost' identified by '$password' with grant option; grant all privileges on . to '$user'@'%' identified by '$password' with grant option; grant all privileges on . to '$user' identified by '$password' with grant option; flush privileges;\"", } }
define mysqluser( $user, $password, $db) {
exec { "create_mysqluser$name":
require => Exec["set-mysql-root-password"],
command => "/usr/bin/mysql -uroot -p$mysqlserver::conf::mysql_root_password -e \"
grant all privileges on \$db\\
. to '$user'@'localhost' identified by '$password';
grant all privileges on \$db\\
. to '$user'@'%' identified by '$password';
grant all privileges on \$db\\
.* to '$user' identified by '$password';
flush privileges;\"",
}
}
`
Are you referring to this? https://github.com/edestecd/puppet-mariadb/blob/master/manifests/db_grant.pp
I'm trying to figure out what I made that for.... I no longer use it for anything at this point.
I think I may have made that defined type so that I could declare the same user more than once, in an old hiera scheme, where accounts were defined in multiple places.
At any rate you should probably just use the mysql_grant type from the puppetlabs module. https://github.com/puppetlabs/puppetlabs-mysql#mysql_grant
That's all my define was doing... Just passing it through ensure_resource, from stdlib, to avoid duplicates.
If you have other questions, feel free to ask.
So i finally understood all of it, i think it would be helpfull to create an "examples folder" just like the puppet repo.
ill see that ill do that once i got everything running how i want it and send you a pr
Yea I think the puppetlabs-mysql module types should do all of what you want from your scenario. This module is just a wrapper around the mysql module that sets up the repos first and configures it to install mariadb package names etc.. It also adds some nice things to help with galera cluster. https://github.com/we-CONECT-Joe/puppet-mariadb/blob/fec7faf82151c7e7100fdded5fcaafc012f1a652/README.md#module-description
All of the types for users, dbs, grants etc from the mysql module should work as expected.
Yea an examples folder would be nice ;) I appreciate anything you can add.
damn i fogort to add: "mysql::" to the last two examples sorry