summaryrefslogtreecommitdiff
path: root/manifests/admin_user.pp
blob: 66e0cc1cb9240f64d66989dde62a9ca299698abd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# add an admin user that has
# access to all databases
define mysql::admin_user(
  $password,
  $ensure = present,
  $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_hash,
    require       => Exec['mysql_set_rootpw'],
  }
  mysql_grant{"${name}@${host}":
    privileges  => 'all',
    require     => Mysql_user["${name}@${host}"],
  }
}