Puppet Class: icingaweb2::config

Defined in:
manifests/config.pp

Overview

Class icingaweb2::config

Parameters:

  • config_dir (Any) (defaults to: $::icingaweb2::config_dir)
  • config_dir_purge (Any) (defaults to: $::icingaweb2::config_dir_purge)
  • web_root (Any) (defaults to: $::icingaweb2::web_root)


3
4
5
6
7
8
9
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
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
94
95
96
97
98
99
100
101
102
103
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
177
# File 'manifests/config.pp', line 3

class icingaweb2::config (
  $config_dir       = $::icingaweb2::config_dir,
  $config_dir_purge = $::icingaweb2::config_dir_purge,
  $web_root         = $::icingaweb2::web_root,
) {

  if $::icingaweb2::manage_user {
    @user { 'icingaweb2':
      ensure     => present,
      home       => $::icingaweb2::web_root,
      managehome => true,
      system     => true,
    }

    @group { 'icingaweb2':
      ensure => present,
      system => true,
    }

    realize(User['icingaweb2'])
    realize(Group['icingaweb2'])
  }

  File {
    require => Class['::icingaweb2::install'],
    owner => $::icingaweb2::config_user,
    group => $::icingaweb2::config_group,
    mode  => $::icingaweb2::config_file_mode,
  }

  file {
    $::icingaweb2::config_dir:
      ensure  => directory,
      mode    => $::icingaweb2::config_dir_mode,
      purge   => $::icingaweb2::config_dir_purge,
      recurse => $::icingaweb2::config_dir_recurse;

    "${::icingaweb2::config_dir}/enabledModules":
      ensure => directory,
      mode   => $::icingaweb2::config_dir_mode;

    "${::icingaweb2::config_dir}/modules":
      ensure => directory,
      mode   => $::icingaweb2::config_dir_mode;

    "${::icingaweb2::config_dir}/authentication.ini":
      ensure => file;

    "${::icingaweb2::config_dir}/config.ini":
      ensure => file;

    "${::icingaweb2::config_dir}/resources.ini":
      ensure => file;

    "${::icingaweb2::config_dir}/roles.ini":
      ensure => file;

    $::icingaweb2::web_root:
      ensure => directory,
      mode   => $::icingaweb2::config_dir_mode;

    "${::icingaweb2::web_root}/modules":
      ensure => directory,
      mode   => $::icingaweb2::config_dir_mode;
  }

  # Configure authentication.ini settings
  case $::icingaweb2::auth_backend {
    'db': {
      icingaweb2::config::authentication_database { 'Local Database Authentication':
        auth_section  => 'icingaweb2',
        auth_resource => $::icingaweb2::auth_resource,
      }
    }
    'external': {
      icingaweb2::config::authentication_external { 'External Authentication':
        auth_section  => 'icingaweb2',
      }
    }
    'ldap': {
      icingaweb2::config::authentication_ldap { 'LDAP Authentication':
        auth_section        => 'icingaweb2',
        auth_resource       => 'ldap',
        user_class          => $::icingaweb2::auth_ldap_user_class,
        user_name_attribute => $::icingaweb2::auth_ldap_user_name_attribute,
        filter              => $::icingaweb2::auth_ldap_filter,
        base_dn             => $::icingaweb2::auth_ldap_base_dn,
      }
    }
    default: {}
  }

  # Configure config.ini settings
  Ini_Setting {
    ensure  => present,
    require => File["${::icingaweb2::config_dir}/config.ini"],
    path    => "${::icingaweb2::config_dir}/config.ini",
  }

  # Logging Configuration
  ini_setting { 'icingaweb2 config logging method':
    section => 'logging',
    setting => 'log',
    value   => "\"${::icingaweb2::log_method}\"",
  }

  ini_setting { 'icingaweb2 config logging level':
    section => 'logging',
    setting => 'level',
    value   => "\"${::icingaweb2::log_level}\"",
  }

  ini_setting { 'icingaweb2 config logging application':
    section => 'logging',
    setting => 'application',
    value   => "\"${::icingaweb2::log_application}\"",
  }

  # Preferences Configuration
  ini_setting { 'icingaweb2 config preferences store':
    section => 'preferences',
    setting => 'store',
    value   => "\"${::icingaweb2::log_store}\"",
  }

  ini_setting { 'icingaweb2 config preferences resource':
    section => 'preferences',
    setting => 'resource',
    value   => "\"${::icingaweb2::log_resource}\"",
  }

  # Configure resources.ini
  icingaweb2::config::resource_database { 'icingaweb_db':
    resource_db       => $::icingaweb2::web_db,
    resource_host     => $::icingaweb2::web_db_host,
    resource_port     => $::icingaweb2::web_db_port,
    resource_dbname   => $::icingaweb2::web_db_name,
    resource_username => $::icingaweb2::web_db_user,
    resource_password => $::icingaweb2::web_db_pass,
  }

  icingaweb2::config::resource_database { 'icinga_ido':
    resource_db       => $::icingaweb2::ido_db,
    resource_host     => $::icingaweb2::ido_db_host,
    resource_port     => $::icingaweb2::ido_db_port,
    resource_dbname   => $::icingaweb2::ido_db_name,
    resource_username => $::icingaweb2::ido_db_user,
    resource_password => $::icingaweb2::ido_db_pass,
  }

  if $::icingaweb2::auth_backend == 'ldap' {
    icingaweb2::config::resource_ldap { 'ldap':
      resource_host       => $::icingaweb2::ldap_host,
      resource_bind_dn    => $::icingaweb2::ldap_bind_dn,
      resource_bind_pw    => $::icingaweb2::ldap_bind_pw,
      resource_port       => $::icingaweb2::ldap_port,
      resource_root_dn    => $::icingaweb2::ldap_root_dn,
      resource_encryption => $::icingaweb2::ldap_encryption,
    }
  }

  # Configure roles.ini
  icingaweb2::config::roles { 'Admins':
    role_users       => $::icingaweb2::admin_users,
    role_permissions => $::icingaweb2::admin_permissions,
  }

  if $::icingaweb2::manage_apache_vhost {
    include ::apache

    ::apache::custom_config { 'icingaweb2':
      content => template($::icingaweb2::template_apache),
    }
  }
}