Puppet Class: icingaweb2::module::x509

Defined in:
manifests/module/x509.pp

Summary

Installs the x509 module

Overview

Examples:

class { 'icingaweb2::module::x509':
  ensure       => present,
  git_revision => 'v1.2.1',
  db_host      => 'localhost',
  db_name      => 'x509',
  db_username  => 'x509',
  db_password  => Sensitive('supersecret'),
}

Parameters:

  • ensure (Enum['absent', 'present'])

    Ensures the state of the x509 module.

  • module_dir (Stdlib::Absolutepath) (defaults to: "${icingaweb2::globals::default_module_path}/x509")

    Target directory of the module.

  • git_repository (Stdlib::HTTPUrl)

    The upstream module repository.

  • git_revision (Optional[String[1]]) (defaults to: undef)

    The version of the module that needs to be used.

  • install_method (Enum['git', 'none', 'package'])

    Install methods are ‘git`, `package` and `none` is supported as installation method.

  • package_name (String[1])

    Package name of the module. This setting is only valid in combination with the installation method ‘package`.

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

    The database type. Either mysql or pgsql.

  • db_resource_name (String[1])

    Name for the x509 database resource.

  • db_host (Stdlib::Host)

    The host where the database will be running

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

    The port on which the database is accessible.

  • db_name (String[1])

    The name of the database this module should use.

  • db_username (String[1])

    The username needed to access the database.

  • db_password (Optional[Icinga::Secret]) (defaults to: undef)

    The password needed to access the database.

  • db_charset (Optional[String[1]]) (defaults to: undef)

    The charset the database is set to.

  • use_tls (Optional[Boolean]) (defaults to: undef)

    Either enable or disable TLS encryption to the database. Other TLS parameters are only affected if this is set to ‘true’.

  • tls_key_file (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    Location of the private key for client authentication. Only valid if tls is enabled.

  • tls_cert_file (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    Location of the certificate for client authentication. Only valid if tls is enabled.

  • tls_cacert_file (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    Location of the ca certificate. Only valid if tls is enabled.

  • tls_key (Optional[Icinga::Secret]) (defaults to: undef)

    The private key to store in spicified ‘tls_key_file` file. Only valid if tls is enabled.

  • tls_cert (Optional[String[1]]) (defaults to: undef)

    The certificate to store in spicified ‘tls_cert_file` file. Only valid if tls is enabled.

  • tls_cacert (Optional[String[1]]) (defaults to: undef)

    The ca certificate to store in spicified ‘tls_cacert_file` file. Only valid if tls is enabled.

  • tls_capath (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    The file path to the directory that contains the trusted SSL CA certificates, which are stored in PEM format. Only available for the mysql database.

  • tls_noverify (Optional[Boolean]) (defaults to: undef)

    Disable validation of the server certificate.

  • tls_cipher (Optional[String[1]]) (defaults to: undef)

    Cipher to use for the encrypted database connection.

  • import_schema (Optional[Icingaweb2::ImportSchema]) (defaults to: undef)

    Whether to import the database schema or not. Options ‘mariadb` and `mysql`, both means true. With mariadb its cli options are used for the import, whereas with mysql its different options.

  • manage_service (Boolean)

    If set to true the service (daemon) is managed.

  • service_ensure (Stdlib::Ensure::Service)

    Wether the service is ‘running` or `stopped`.

  • service_enable (Boolean)

    Whether the service should be started at boot time.

  • service_user (String[1])

    The user as which the service is running. Only valid if ‘install_method` is set to `git`.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'manifests/module/x509.pp', line 104

class icingaweb2::module::x509 (
  Enum['absent', 'present']                  $ensure,
  Enum['git', 'none', 'package']             $install_method,
  Stdlib::HTTPUrl                            $git_repository,
  String[1]                                  $package_name,
  Boolean                                    $manage_service,
  Stdlib::Ensure::Service                    $service_ensure,
  Boolean                                    $service_enable,
  String[1]                                  $service_user,
  Enum['mysql', 'pgsql']                     $db_type,
  String[1]                                  $db_resource_name,
  Stdlib::Host                               $db_host,
  String[1]                                  $db_name,
  String[1]                                  $db_username,
  Optional[Icinga::Secret]                   $db_password     = undef,
  Optional[Stdlib::Port]                     $db_port         = undef,
  Optional[String[1]]                        $db_charset      = undef,
  Optional[Icingaweb2::ImportSchema]         $import_schema   = undef,
  Stdlib::Absolutepath                       $module_dir      = "${icingaweb2::globals::default_module_path}/x509",
  Optional[String[1]]                        $git_revision    = undef,
  Optional[Boolean]                          $use_tls         = undef,
  Optional[Stdlib::Absolutepath]             $tls_key_file    = undef,
  Optional[Stdlib::Absolutepath]             $tls_cert_file   = undef,
  Optional[Stdlib::Absolutepath]             $tls_cacert_file = undef,
  Optional[Stdlib::Absolutepath]             $tls_capath      = undef,
  Optional[Icinga::Secret]                   $tls_key         = undef,
  Optional[String[1]]                        $tls_cert        = undef,
  Optional[String[1]]                        $tls_cacert      = undef,
  Optional[Boolean]                          $tls_noverify    = undef,
  Optional[String[1]]                        $tls_cipher      = undef,
) {
  require icingaweb2

  $module_conf_dir = "${icingaweb2::globals::conf_dir}/modules/x509"
  $cert_dir        = "${icingaweb2::globals::state_dir}/x509/certs"

  $db = {
    type     => $db_type,
    database => $db_name,
    host     => $db_host,
    port     => $db_port,
    username => $db_username,
    password => $db_password,
  }

  $tls = icinga::cert::files(
    $db_username,
    $cert_dir,
    $tls_key_file,
    $tls_cert_file,
    $tls_cacert_file,
    $tls_key,
    $tls_cert,
    $tls_cacert,
  )

  $settings = {
    'icingaweb2-module-x509-backend' => {
      'section_name' => 'backend',
      'target'       => "${module_conf_dir}/config.ini",
      'settings'     => {
        'resource' => $db_resource_name,
      },
    },
  }

  class { 'icingaweb2::module::x509::install': }
  -> class { 'icingaweb2::module::x509::config': }
  ~> class { 'icingaweb2::module::x509::service': }
  contain icingaweb2::module::x509::install
  contain icingaweb2::module::x509::config
  contain icingaweb2::module::x509::service
}