Add mysql class to manage db, and configure db name
When using local mysql, this class is useful to automate database creation. Also add the ability to configure database name, so it can match the name created on mysql class. Change-Id: I9c97b4a6355816b931e93d053f4748ef88f0a823
This commit is contained in:
parent
7a03ae7eb1
commit
b1cb51e864
30
manifests/mysql.pp
Normal file
30
manifests/mysql.pp
Normal file
@ -0,0 +1,30 @@
|
||||
# == Class: puppet-lodgeit::mysql
|
||||
#
|
||||
class lodgeit::mysql(
|
||||
$mysql_root_password,
|
||||
$database_name = $name,
|
||||
$database_user = $name,
|
||||
$database_password,
|
||||
) {
|
||||
class { '::mysql::server':
|
||||
config_hash => {
|
||||
'root_password' => $mysql_root_password,
|
||||
'default_engine' => 'InnoDB',
|
||||
'bind_address' => '127.0.0.1',
|
||||
}
|
||||
}
|
||||
include ::mysql::server::account_security
|
||||
|
||||
mysql::db { $database_name:
|
||||
user => $database_user,
|
||||
password => $database_password,
|
||||
host => 'localhost',
|
||||
grant => ['all'],
|
||||
charset => 'utf8',
|
||||
require => [
|
||||
Class['mysql::server'],
|
||||
Class['mysql::server::account_security'],
|
||||
],
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ define lodgeit::site(
|
||||
$port,
|
||||
$db_password,
|
||||
$db_host='localhost',
|
||||
$db_name=$name,
|
||||
$db_user=$name,
|
||||
$vhost_name="paste.${name}.org",
|
||||
$image=undef,
|
||||
|
@ -7,7 +7,7 @@ from lodgeit import local
|
||||
from lodgeit.application import make_app
|
||||
from lodgeit.database import session
|
||||
|
||||
dburi = 'mysql://<%= @db_user %>:<%= @db_password %>@<%= @db_host %>:3306/<%= @name %>'
|
||||
dburi = 'mysql://<%= @db_user %>:<%= @db_password %>@<%= @db_host %>:3306/<%= @db_name %>'
|
||||
|
||||
SECRET_KEY = 'no secret key'
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user