Puppet Class: wordpress::db

Defined in:
manifests/db.pp

Overview

Parameters:

  • create_db (Any)
  • create_db_user (Any)
  • db_name (Any)
  • db_host (Any)
  • db_user (Any)
  • db_password (Any)


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
# 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 {
    database { $db_name:
      charset => 'utf8',
      require => Class['wordpress::app'],
    }
  }
  if $create_db_user {
    database_user { "${db_user}@${db_host}":
      password_hash => mysql_password($db_password),
      require       => Class['wordpress::app'],
    }
    database_grant { "${db_user}@${db_host}/${db_name}":
      privileges => ['all'],
      require    => Class['wordpress::app'],
    }
  }

}