2012-03-29 14:39:59 -07:00
|
|
|
#
|
|
|
|
# implements mysql backend for keystone
|
|
|
|
#
|
2012-04-06 15:48:05 -07:00
|
|
|
# This class can be used to create tables, users and grant
|
|
|
|
# privelege for a mysql keystone database.
|
|
|
|
#
|
2012-10-31 12:33:09 -07:00
|
|
|
# == parameters
|
2012-04-06 15:48:05 -07:00
|
|
|
#
|
|
|
|
# [password] Password that will be used for the keystone db user.
|
|
|
|
# Optional. Defaults to: 'keystone_default_password'
|
|
|
|
#
|
|
|
|
# [dbname] Name of keystone database. Optional. Defaults to keystone.
|
|
|
|
#
|
|
|
|
# [user] Name of keystone user. Optional. Defaults to keystone_admin.
|
|
|
|
#
|
|
|
|
# [host] Host where user should be allowed all priveleges for database.
|
|
|
|
# Optional. Defaults to 127.0.0.1.
|
|
|
|
#
|
2012-04-17 17:16:48 +02:00
|
|
|
# [allowed_hosts] Hosts allowed to use the database
|
2012-04-06 15:48:05 -07:00
|
|
|
#
|
|
|
|
# == Dependencies
|
|
|
|
# Class['mysql::server']
|
|
|
|
#
|
|
|
|
# == Examples
|
|
|
|
# == Authors
|
|
|
|
#
|
|
|
|
# Dan Bode dan@puppetlabs.com
|
|
|
|
#
|
|
|
|
# == Copyright
|
|
|
|
#
|
|
|
|
# Copyright 2012 Puppetlabs Inc, unless otherwise noted.
|
|
|
|
#
|
2012-04-21 21:52:11 -07:00
|
|
|
class keystone::db::mysql(
|
2012-10-14 11:51:45 -07:00
|
|
|
$password,
|
2012-03-29 14:39:59 -07:00
|
|
|
$dbname = 'keystone',
|
|
|
|
$user = 'keystone_admin',
|
|
|
|
$host = '127.0.0.1',
|
2012-05-16 09:31:37 -05:00
|
|
|
$charset = 'latin1',
|
2012-03-29 14:39:59 -07:00
|
|
|
$allowed_hosts = undef
|
|
|
|
) {
|
|
|
|
|
2012-10-02 20:31:50 -07:00
|
|
|
Class['mysql::server'] -> Class['keystone::db::mysql']
|
|
|
|
Class['keystone::db::mysql'] -> Exec<| title == 'keystone-manage db_sync' |>
|
2012-04-21 21:52:11 -07:00
|
|
|
Class['keystone::db::mysql'] -> Service<| title == 'keystone' |>
|
2012-10-14 11:52:08 -07:00
|
|
|
Mysql::Db[$dbname] ~> Exec<| title == 'keystone-manage db_sync' |>
|
2012-04-09 23:43:27 -07:00
|
|
|
|
|
|
|
require 'mysql::python'
|
2012-03-29 14:39:59 -07:00
|
|
|
|
|
|
|
mysql::db { $dbname:
|
2012-04-21 21:52:11 -07:00
|
|
|
user => $user,
|
|
|
|
password => $password,
|
|
|
|
host => $host,
|
2012-04-06 15:48:05 -07:00
|
|
|
# TODO does it make sense to support other charsets?
|
2012-05-16 09:31:37 -05:00
|
|
|
charset => $charset,
|
2012-05-16 09:01:38 -05:00
|
|
|
require => Class['mysql::config'],
|
2012-03-29 14:39:59 -07:00
|
|
|
}
|
|
|
|
|
2012-04-17 17:16:48 +02:00
|
|
|
if $allowed_hosts {
|
2012-04-24 12:55:18 +02:00
|
|
|
keystone::db::mysql::host_access { $allowed_hosts:
|
2012-04-17 17:16:48 +02:00
|
|
|
user => $user,
|
|
|
|
password => $password,
|
|
|
|
database => $dbname,
|
|
|
|
}
|
2012-09-20 18:54:23 +04:00
|
|
|
|
2013-03-24 21:43:29 +00:00
|
|
|
Keystone::Db::Mysql::Host_access[$allowed_hosts] -> Exec<| title == 'keystone-manage db_sync' |>
|
2012-09-20 18:54:23 +04:00
|
|
|
|
2012-04-05 23:53:18 -07:00
|
|
|
}
|
|
|
|
|
2012-03-29 14:39:59 -07:00
|
|
|
}
|