File: postgresql.pp

package info (click to toggle)
puppet-module-openstacklib 25.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 968 kB
  • sloc: ruby: 4,500; python: 38; sh: 22; makefile: 10
file content (59 lines) | stat: -rw-r--r-- 1,785 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# == 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 (
  Optional[String[1]] $password                    = undef,
  String[1] $dbname                                = $title,
  String[1] $user                                  = $title,
  Optional[String[1]] $encoding                    = undef,
  Variant[String[1], Array[String[1]]] $privileges = 'ALL',
  # DEPRECATED PARAMETERS
  Optional[String[1]] $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,
  }
}