Puppet Class: bacula::director::postgresql

Defined in:
manifests/director/postgresql.pp

Summary

Manage Bacula Director PostgreSQL database

Overview

Deploys a postgres database server for hosting the Bacula director database.

Parameters:

  • make_bacula_tables (String) (defaults to: $bacula::director::make_bacula_tables)

    Path to the script that loads the database schema

  • db_name (String) (defaults to: $bacula::director::db_name)

    The database name

  • db_pw (String) (defaults to: $bacula::director::db_pw)

    The database user’s password

  • db_user (String) (defaults to: $bacula::director::db_user)

    The database user



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
# File 'manifests/director/postgresql.pp', line 10

class bacula::director::postgresql (
  String $make_bacula_tables = $bacula::director::make_bacula_tables,
  String $db_name            = $bacula::director::db_name,
  String $db_pw              = $bacula::director::db_pw,
  String $db_user            = $bacula::director::db_user,
) {
  include bacula

  $services = $bacula::director::services
  $user     = $bacula::bacula_user

  if $bacula::director::manage_db {
    require postgresql::server
    postgresql::server::db { $db_name:
      user     => $db_user,
      password => postgresql_password($db_user, $db_pw),
      encoding => 'SQL_ASCII',
      locale   => 'C',
      before   => Exec["/bin/sh ${make_bacula_tables}"],
      notify   => Exec["/bin/sh ${make_bacula_tables}"],
    }
  }

  exec { "/bin/sh ${make_bacula_tables}":
    user        => $user,
    refreshonly => true,
    environment => ["db_name=${db_name}"],
    notify      => Service[$services],
  }
}