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.
|
|
|
|
#
|
|
|
|
# [*Parameters*]
|
|
|
|
#
|
|
|
|
# [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.
|
|
|
|
#
|
|
|
|
# [allowed_hosts] TODO implement.
|
|
|
|
#
|
|
|
|
# == Dependencies
|
|
|
|
# Class['mysql::server']
|
|
|
|
#
|
|
|
|
# == Examples
|
|
|
|
# == Authors
|
|
|
|
#
|
|
|
|
# Dan Bode dan@puppetlabs.com
|
|
|
|
#
|
|
|
|
# == Copyright
|
|
|
|
#
|
|
|
|
# Copyright 2012 Puppetlabs Inc, unless otherwise noted.
|
|
|
|
#
|
2012-03-29 14:39:59 -07:00
|
|
|
class keystone::mysql(
|
2012-04-05 11:14:00 -07:00
|
|
|
$password = 'keystone_default_password',
|
2012-03-29 14:39:59 -07:00
|
|
|
$dbname = 'keystone',
|
|
|
|
$user = 'keystone_admin',
|
|
|
|
$host = '127.0.0.1',
|
|
|
|
$allowed_hosts = undef
|
|
|
|
) {
|
|
|
|
|
2012-04-09 23:43:27 -07:00
|
|
|
Class['keystone::mysql'] -> Service<| title == 'keystone' |>
|
|
|
|
|
|
|
|
require 'mysql::python'
|
2012-03-29 14:39:59 -07:00
|
|
|
|
|
|
|
file { '/var/lib/keystone/keystone.db':
|
|
|
|
ensure => absent,
|
|
|
|
subscribe => Package['keystone'],
|
2012-04-05 16:57:33 -07:00
|
|
|
before => Mysql::Db[$dbname],
|
2012-03-29 14:39:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
mysql::db { $dbname:
|
|
|
|
user => $user,
|
|
|
|
password => $password,
|
|
|
|
host => $host,
|
2012-04-06 15:48:05 -07:00
|
|
|
# TODO does it make sense to support other charsets?
|
2012-03-29 14:39:59 -07:00
|
|
|
charset => 'latin1',
|
|
|
|
require => Class['mysql::server'],
|
|
|
|
}
|
|
|
|
|
2012-04-05 23:53:18 -07:00
|
|
|
# this probably needs to happen more often than just when the db is
|
|
|
|
# created
|
|
|
|
exec { 'keystone-manage db_sync':
|
|
|
|
path => '/usr/bin',
|
|
|
|
refreshonly => true,
|
|
|
|
subscribe => Mysql::Db[$dbname],
|
2012-04-17 14:21:44 +01:00
|
|
|
require => File['/etc/keystone/keystone.conf'],
|
2012-04-05 23:53:18 -07:00
|
|
|
}
|
|
|
|
|
2012-03-29 14:39:59 -07:00
|
|
|
}
|