Update containers to CentOS Stream 8
[barometer.git] / puppet-barometer / manifests / db / postgresql.pp
1 # == Class: barometer::db::postgresql
2 #
3 # Class that configures postgresql for barometer
4 # Requires the Puppetlabs postgresql module.
5 #
6 # === Parameters
7 #
8 # [*password*]
9 #   (Required) Password to connect to the database.
10 #
11 # [*dbname*]
12 #   (Optional) Name of the database.
13 #   Defaults to 'barometer'.
14 #
15 # [*user*]
16 #   (Optional) User to connect to the database.
17 #   Defaults to 'barometer'.
18 #
19 #  [*encoding*]
20 #    (Optional) The charset to use for the database.
21 #    Default to undef.
22 #
23 #  [*privileges*]
24 #    (Optional) Privileges given to the database user.
25 #    Default to 'ALL'
26 #
27 # == Dependencies
28 #
29 # == Examples
30 #
31 # == Authors
32 #
33 # == Copyright
34 #
35 class barometer::db::postgresql(
36   $password,
37   $dbname     = 'barometer',
38   $user       = 'barometer',
39   $encoding   = undef,
40   $privileges = 'ALL',
41 ) {
42
43   Class['barometer::db::postgresql'] -> Service<| title == 'barometer' |>
44
45   ::openstacklib::db::postgresql { 'barometer':
46     password_hash => postgresql_password($user, $password),
47     dbname        => $dbname,
48     user          => $user,
49     encoding      => $encoding,
50     privileges    => $privileges,
51   }
52
53   ::Openstacklib::Db::Postgresql['barometer'] ~> Exec<| title == 'barometer-manage db_sync' |>
54
55 }