aboutsummaryrefslogtreecommitdiff
path: root/manifests/database.pp
blob: c2d1fc3199ec76c60b249e12af1314bba38c0fa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class database {
  include mysql::server

  # Database definitions
  define instance($password) {
    mysql_database { "$name":
      ensure => present,
    }

    mysql_user { "$name@%":
      password_hash => mysql_password($password),
      ensure        => present,
      require       => Mysql_database["$name"],
    }

    mysql_grant { "$name@%/$name":
      privileges => all,
      require    => Mysql_user["$name@%"],
    }
  }
}