Puppet Class: grafana::database::postgres

Defined in:
manifests/database/postgres.pp

Overview

Parameters:

  • database (String)
  • host (Variant[Bodgitlib::Host, Tuple[Bodgitlib::Host, Bodgitlib::Port]])
  • user (String)
  • password (Optional[String]) (defaults to: undef)
  • ssl_mode (Optional[Enum['disable', 'require', 'verify-full']]) (defaults to: undef)

See Also:



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
# File 'manifests/database/postgres.pp', line 12

class grafana::database::postgres (
  String                                                            $database,
  Variant[Bodgitlib::Host, Tuple[Bodgitlib::Host, Bodgitlib::Port]] $host,
  String                                                            $user,
  Optional[String]                                                  $password = undef,
  Optional[Enum['disable', 'require', 'verify-full']]               $ssl_mode = undef,
) {

  if ! defined(Class['::grafana']) {
    fail('You must include the grafana base class before using the grafana::database::postgres class')
  }

  $_host = type($host) ? {
    Type[Tuple] => join([bodgitlib::enclose_ipv6($host[0]), $host[1]], ':'),
    default     => bodgitlib::enclose_ipv6($host),
  }

  $config = delete_undef_values({
    'database/type'     => 'postgres',
    'database/host'     => $_host,
    'database/name'     => $database,
    'database/user'     => $user,
    'database/password' => $password,
    'database/ssl_mode' => $ssl_mode,
  })

  $config.each |String $setting, Any $value| {
    grafana_ini_setting { $setting:
      value => $value,
    }
  }
}