blob: 87e5162a2d528e851c738c4b5a41a1d5f8e7c61e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
class database {
include mysql::server
# Database definitions
define instance($password, $ensure = 'present', $privileges = 'all') {
mysql_database { "$name":
ensure => $ensure,
require => Service['mysql'],
}
mysql_user { "$name@%":
ensure => $ensure,
password_hash => mysql_password($password),
require => Mysql_database["$name"],
}
if $ensure == 'present' {
mysql_grant { "$name@%/$name":
privileges => $privileges,
require => Mysql_user["$name@%"],
}
}
}
}
|