Puppet Class: icinga::web::x509

Defined in:
manifests/web/x509.pp

Summary

Setup the x509 module for Icinga Web 2

Overview

Parameters:

  • service_ensure (Stdlib::Ensure::Service) (defaults to: 'running')

    Manages if the x509 service should be stopped or running.

  • service_enable (Boolean) (defaults to: true)

    If set to true the x509 service will start on boot.

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

    Type of your database.

  • db_host (Stdlib::Host) (defaults to: 'localhost')

    Hostname of the database.

  • db_port (Optional[Stdlib::Port]) (defaults to: undef)

    Port of the database.

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

    Name of the database.

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

    Username for DB connection.

  • db_pass (Icinga::Secret)

    Password for DB connection.

  • manage_database (Boolean) (defaults to: false)

    Create database and import schema.



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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'manifests/web/x509.pp', line 31

class icinga::web::x509 (
  Enum['mysql', 'pgsql']    $db_type,
  Icinga::Secret            $db_pass,
  Stdlib::Ensure::Service   $service_ensure  = 'running',
  Boolean                   $service_enable  = true,
  Stdlib::Host              $db_host         = 'localhost',
  Optional[Stdlib::Port]    $db_port         = undef,
  String                    $db_name         = 'x509',
  String                    $db_user         = 'x509',
  Boolean                   $manage_database = false,
) {
  unless defined(Class['icinga::web::icingadb']) or defined(Class['icinga::web::monitoring']) {
    fail('Class icinga::web::icingadb or icinga::web::monitoring has to be declared before!')
  }

  $icingaweb2_version = $icinga::web::icingaweb2_version
  $_db_charset        = $db_type ? {
    'mysql' => 'utf8mb4',
    default => 'UTF8',
  }

  #
  # Database
  #
  if $manage_database {
    class { 'icinga::web::x509::database':
      db_type       => $db_type,
      db_name       => $db_name,
      db_user       => $db_user,
      db_pass       => $db_pass,
      web_instances => ['localhost'],
      before        => Class['icingaweb2::module::x509'],
    }
    $_db_host = 'localhost'
  } else {
    if $db_type != 'pgsql' {
      include mysql::client
    } else {
      include postgresql::client
    }
    $_db_host = $db_host
  }

  class { 'icingaweb2::module::x509':
    install_method => 'package',
    db_type        => $db_type,
    db_host        => $_db_host,
    db_port        => $db_port,
    db_name        => $db_name,
    db_username    => $db_user,
    db_password    => $db_pass,
    db_charset     => $_db_charset,
    import_schema  => lookup('icingaweb2::module::x509::import_schema', undef, undef, true),
  }

  if versioncmp($icingaweb2_version, '4.0.0') < 0 {
    service { 'icinga-x509':
      ensure  => $service_ensure,
      enable  => $service_enable,
      require => Class['icingaweb2::module::x509'],
    }
  }
}