1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'manifests/db.pp', line 1
class wordpress::db (
$create_db,
$create_db_user,
$db_name,
$db_host,
$db_user,
$db_password,
) {
validate_bool($create_db,$create_db_user)
validate_string($db_name,$db_host,$db_user,$db_password)
## Set up DB using puppetlabs-mysql defined type
if $create_db {
mysql_database { $db_name:
charset => 'utf8',
require => Class['wordpress::app'],
}
}
if $create_db_user {
mysql_user { "${db_user}@${db_host}":
password_hash => mysql_password($db_password),
require => Class['wordpress::app'],
}
mysql_grant { "${db_user}@${db_host}/${db_name}.*":
table => "${db_name}.*",
user => "${db_user}@${db_host}",
privileges => ['all'],
require => Class['wordpress::app'],
}
}
}
|