Puppet Class: icinga::web::director::database

Defined in:
manifests/web/director/database.pp

Summary

Setup Director database.

Overview

Parameters:

  • db_type (Enum['mysql','pgsql'])

    What kind of database type to use.

  • web_instances (Array[Stdlib::Host])

    List of Hosts to allow write access to the database. Usually an Icinga Web 2 instance.

  • db_pass (Icinga::Secret)

    Password to connect the database.

  • db_name (String) (defaults to: 'director')

    Name of the database.

  • db_user (String) (defaults to: 'director')

    Database user name.

  • tls (Variant[Boolean, Enum['password','cert']]) (defaults to: false)

    Access only for TLS encrypted connections. Authentication via ‘password` or `cert`, value `true` means password auth.



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
# File 'manifests/web/director/database.pp', line 24

class icinga::web::director::database (
  Enum['mysql','pgsql']      $db_type,
  Array[Stdlib::Host]        $web_instances,
  Icinga::Secret             $db_pass,
  String                     $db_user = 'director',
  String                     $db_name = 'director',
  Variant[Boolean,
  Enum['password','cert']]   $tls      = false,
) {
  $_encoding = $db_type ? {
    'mysql' => 'utf8',
    default => 'UTF8',
  }

  icinga::database { "${db_type}-${db_name}":
    db_type          => $db_type,
    db_name          => $db_name,
    db_user          => $db_user,
    db_pass          => $db_pass,
    access_instances => $web_instances,
    mysql_privileges => ['ALL'],
    encoding         => $_encoding,
    tls              => $tls,
  }

  if $db_type == 'pgsql' {
    include postgresql::server::contrib

    postgresql::server::extension { "${db_name}-pgcrypto":
      extension => 'pgcrypto',
      database  => $db_name,
    }
  }
}