File: postgresql.pp

package info (click to toggle)
puppet-module-nova 25.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,100 kB
  • sloc: ruby: 11,433; python: 38; sh: 10; makefile: 10
file content (65 lines) | stat: -rw-r--r-- 1,548 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
60
61
62
63
64
65
# == Class: nova::db::postgresql
#
# Class that configures postgresql for nova
# Requires the Puppetlabs postgresql module.
#
# === Parameters
#
# [*password*]
#   (Required) Password to connect to the database.
#
# [*dbname*]
#   (Optional) Name of the database.
#   Defaults to 'nova'.
#
# [*user*]
#   (Optional) User to connect to the database.
#   Defaults to 'nova'.
#
#  [*encoding*]
#    (Optional) The charset to use for the database.
#    Default to undef.
#
#  [*privileges*]
#    (Optional) Privileges given to the database user.
#    Default to 'ALL'
#
# [*setup_cell0*]
#   (Optional) Setup a cell0 for the cell_v2 functionality. This option will
#   be set to true by default in Ocata when the cell v2 setup is mandatory.
#   Defaults to true
#
class nova::db::postgresql(
  String[1] $password,
  $dbname              = 'nova',
  $user                = 'nova',
  $encoding            = undef,
  $privileges          = 'ALL',
  Boolean $setup_cell0 = true,
) {

  include nova::deps

  ::openstacklib::db::postgresql { 'nova':
    password   => $password,
    dbname     => $dbname,
    user       => $user,
    encoding   => $encoding,
    privileges => $privileges,
  }

  if $setup_cell0 {
    # need for cell_v2
    ::openstacklib::db::postgresql { 'nova_cell0':
      password   => $password,
      dbname     => "${dbname}_cell0",
      user       => $user,
      encoding   => $encoding,
      privileges => $privileges,
    }
  }

  Anchor['nova::db::begin']
  ~> Class['nova::db::postgresql']
  ~> Anchor['nova::db::end']
}