Files
vapemap/puppet/manifests/classes/mysql.pp
Andrew Williams 572216d10b Vagrant Support
Brings in the basic config for Vagrant, missing elasticsearch but its enough to bring up a Vagrant instance of the main web app.
2013-03-31 23:53:55 +01:00

35 lines
839 B
Puppet

# Get mysql up and running
class mysql {
package { "mysql-server":
ensure => installed,
}
case $operatingsystem {
ubuntu: {
package { "libmysqld-dev":
ensure => installed,
}
}
}
service { "mysql":
ensure => running,
enable => true,
require => Package['mysql-server'],
}
}
define mysql::database($user, $password) {
exec { "create-${name}-db":
unless => "/usr/bin/mysql -uroot ${name}",
command => "/usr/bin/mysql -uroot -e \"create database ${name};\"",
require => Service["mysql"],
}
exec { "grant-${name}-db":
unless => "/usr/bin/mysql -u${user} -p${password} ${name}",
command => "/usr/bin/mysql -uroot -e \"grant all on ${name}.* to ${user}@localhost identified by '$password';\"",
require => [Service["mysql"], Exec["create-${name}-db"]]
}
}