diff options
Diffstat (limited to 'manifests/admin_user.pp')
-rw-r--r-- | manifests/admin_user.pp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/manifests/admin_user.pp b/manifests/admin_user.pp index 52d01fc..66e0cc1 100644 --- a/manifests/admin_user.pp +++ b/manifests/admin_user.pp @@ -1,17 +1,21 @@ +# add an admin user that has +# access to all databases define mysql::admin_user( + $password, $ensure = present, - $host = '127.0.0.1', - $password + $host = '127.0.0.1' ){ + $password_hash = $password ? { + 'trocla' => trocla("mysql_admin-user_${name}",'mysql'), + default => $password, + } mysql_user{"${name}@${host}": - ensure => $ensure, - password_hash => $password ? { - 'trocla' => trocla("mysql_admin-user_${name}",'mysql'), - default => $password, - }, + ensure => $ensure, + password_hash => $password_hash, + require => Exec['mysql_set_rootpw'], } mysql_grant{"${name}@${host}": - privileges => 'all', - require => Mysql_user["${name}@${host}"], + privileges => 'all', + require => Mysql_user["${name}@${host}"], } } |