
The openstacklib::db::postgresql resource is a library resource that can be used by nova, cinder, ceilometer, etc., rather than replicating equivalent functionality across all of these modules. This resource is very simple, but its addition will make maintenance and adding features much more straightforward and consistent than implementing individually across modules. openstacklib::db::postgresql uses the puppetlabs postgresql::server::db resource to configure the database and user. openstacklib::db::postgresql accepts a password_hash as a parameter and passes it to the postgresql::server::db resource as the password parameter. While this seems to conflict, the postgresql::server::db resource is actually using the password parameter as a password hash. Change-Id: I1446f37e7fba3305cff3eb3dd7ea4e7d5577eb4e Implements: blueprint commmon-openstack-database-resource
47 lines
1.4 KiB
Puppet
47 lines
1.4 KiB
Puppet
# == Definition: openstacklib::db::postgresql
|
|
#
|
|
# This resource configures a postgresql database for an OpenStack service
|
|
#
|
|
# == Parameters:
|
|
#
|
|
# [*password_hash*]
|
|
# Password hash to use for the database user for this service;
|
|
# string; required
|
|
#
|
|
# [*dbname*]
|
|
# The name of the database
|
|
# string; optional; default to the $title of the resource, i.e. 'nova'
|
|
#
|
|
# [*user*]
|
|
# The database user to create;
|
|
# string; optional; default to the $title of the resource, i.e. 'nova'
|
|
#
|
|
# [*encoding*]
|
|
# The charset to use for the database;
|
|
# string; optional; default to undef
|
|
#
|
|
# [*privileges*]
|
|
# Privileges given to the database user;
|
|
# string or array of strings; optional; default to 'ALL'
|
|
|
|
define openstacklib::db::postgresql (
|
|
$password_hash,
|
|
$dbname = $title,
|
|
$user = $title,
|
|
$encoding = undef,
|
|
$privileges = 'ALL',
|
|
){
|
|
|
|
if ((($::operatingsystem == 'RedHat' or $::operatingsystem == 'CentOS') and $::operatingsystemmajrelease <= 6)
|
|
or ($::operatingsystem == 'Fedora' and $::operatingsystemmajrelease <= 14)) {
|
|
warning('The system packages handling the postgresql infrastructure for OpenStack are out of date and should not be relied on for database migrations.')
|
|
}
|
|
|
|
postgresql::server::db { $dbname:
|
|
user => $user,
|
|
password => $password_hash,
|
|
encoding => $encoding,
|
|
grant => $privileges,
|
|
}
|
|
}
|