Defined Type: icingaweb2::resource::ldap

Defined in:
manifests/resource/ldap.pp

Summary

Create and remove Icinga Web 2 resources. Resources may be referenced in other configuration sections.

Overview

Examples:

Create a LDAP resource:

icingaweb2::resource::ldap{ 'my-ldap':
  host    => 'localhost',
  port    => 389,
  root_dn => 'ou=users,dc=icinga,dc=com',
  bind_dn => 'cn=icingaweb2,ou=users,dc=icinga,dc=com',
  bind_pw => Sensitive('supersecret'),
}

Parameters:

  • resource_name (String[1]) (defaults to: $title)

    Name of the resources. Resources are referenced by their name in other configuration sections.

  • host (String[1]) (defaults to: 'localhost')

    Connect to the database or ldap server on the given host. For using unix domain sockets, specify ‘localhost’ for MySQL and the path to the unix domain socket directory for PostgreSQL. When using the ‘ldap’ type you can also provide multiple hosts separated by a space.

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

    Port number to use.

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

    Root object of the tree, e.g. ‘ou=people,dc=icinga,dc=com’.

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

    The user to use when connecting to the server.

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

    The password to use when connecting to the server.

  • encryption (Enum['none', 'starttls', 'ldaps']) (defaults to: 'none')

    Type of encryption to use: none (default), starttls, ldaps.

  • timeout (Integer) (defaults to: 5)

    Timeout for the ldap connection.



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
# File 'manifests/resource/ldap.pp', line 39

define icingaweb2::resource::ldap (
  String[1]                         $resource_name = $title,
  String[1]                         $host          = 'localhost',
  Optional[Stdlib::Port]            $port          = undef,
  Optional[String[1]]               $root_dn       = undef,
  Optional[String[1]]               $bind_dn       = undef,
  Optional[Icinga::Secret]          $bind_pw       = undef,
  Enum['none', 'starttls', 'ldaps'] $encryption    = 'none',
  Integer                           $timeout       = 5,
) {
  $conf_dir = $icingaweb2::globals::conf_dir
  $settings = {
    'type'       => 'ldap',
    'hostname'   => $host,
    'port'       => $port,
    'root_dn'    => $root_dn,
    'bind_dn'    => $bind_dn,
    'bind_pw'    => unwrap($bind_pw),
    'encryption' => $encryption,
    'timeout'    => $timeout,
  }

  icingaweb2::inisection { "resource-${resource_name}":
    section_name => $resource_name,
    target       => "${conf_dir}/resources.ini",
    settings     => delete_undef_values($settings),
  }
}