]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/openstacklib/manifests/db/postgresql.pp
try with modules from master
[dsa-puppet.git] / 3rdparty / modules / openstacklib / manifests / db / postgresql.pp
1 # == Definition: openstacklib::db::postgresql
2 #
3 # This resource configures a postgresql database for an OpenStack service
4 #
5 # == Parameters:
6 #
7 #  [*password_hash*]
8 #    Password hash to use for the database user for this service;
9 #    string; required
10 #
11 #  [*dbname*]
12 #    The name of the database
13 #    string; optional; default to the $title of the resource, i.e. 'nova'
14 #
15 #  [*user*]
16 #    The database user to create;
17 #    string; optional; default to the $title of the resource, i.e. 'nova'
18 #
19 #  [*encoding*]
20 #    The charset to use for the database;
21 #    string; optional; default to undef
22 #
23 #  [*privileges*]
24 #    Privileges given to the database user;
25 #    string or array of strings; optional; default to 'ALL'
26
27 define openstacklib::db::postgresql (
28   $password_hash,
29   $dbname     = $title,
30   $user       = $title,
31   $encoding   = undef,
32   $privileges = 'ALL',
33 ){
34
35   if ((($::operatingsystem == 'RedHat' or $::operatingsystem == 'CentOS') and (versioncmp($::operatingsystemmajrelease, '6') <= 0))
36     or ($::operatingsystem == 'Fedora' and (versioncmp($::operatingsystemmajrelease, '14') <= 0))) {
37     warning('The system packages handling the postgresql infrastructure for OpenStack are out of date and should not be relied on for database migrations.')
38   }
39
40   postgresql::server::db { $dbname:
41     user     => $user,
42     password => $password_hash,
43     encoding => $encoding,
44     grant    => $privileges,
45   }
46 }