Files
puppet-openstacklib/manifests/db/postgresql.pp
Takashi Kajinami e4b68e9ad6 Generate password hash from password
Currently openstacklib only accepts password_hash instead of password
for db credentials, thus we should implement hashing process in each
modules, with including puppet-mysql and puppet-postgresql.
This patch migrates that hash generation to puppet-openstacklib, so
that all logics related to db is gathered in one module.

In addition, because postgresql_password function was deprecated in
favor of postgresql::postgresql_password in puppet-postgresql
6.5.0[1], this patch also deals with that deprecation.

[1] 700d2c5bb5

Change-Id: I898d31e88188bfd3476412a37f48fc918122a98a
2020-05-18 14:29:39 +09:00

60 lines
1.5 KiB
Puppet

# == Definition: openstacklib::db::postgresql
#
# This resource configures a postgresql database for an OpenStack service
#
# == Parameters:
#
# [*password*]
# Password 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'
#
# DEPRECATED PARAMETERS
#
# [*password_hash*]
# Password hash to use for the database user for this service;
# string; required
#
define openstacklib::db::postgresql (
$password = undef,
$dbname = $title,
$user = $title,
$encoding = undef,
$privileges = 'ALL',
# DEPRECATED PARAMETERS
$password_hash = undef,
){
if $password_hash != undef {
warning('The password_hash parameter was deprecated and will be removed
in a future release. Use password instead')
$password_hash_real = $password_hash
} elsif $password != undef {
$password_hash_real = postgresql::postgresql_password($user, $password)
} else {
fail('password should be set')
}
postgresql::server::db { $dbname:
user => $user,
password => $password_hash_real,
encoding => $encoding,
grant => $privileges,
}
}