Defined Type: icinga2::feature

Defined in:
manifests/feature.pp

Summary

Private define resource to used by this module only.

Overview

Parameters:

  • ensure (Enum['absent', 'present']) (defaults to: present)
  • feature (String[1]) (defaults to: $title)


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
# File 'manifests/feature.pp', line 6

define icinga2::feature (
  Enum['absent', 'present'] $ensure  = present,
  String[1]                 $feature = $title,
) {
  assert_private()

  $user     = $icinga2::globals::user
  $group    = $icinga2::globals::group
  $conf_dir = $icinga2::globals::conf_dir

  if $facts['os']['family'] != 'windows' {
    $_ensure = $ensure ? {
      'present' => link,
      default   => absent,
    }

    file { "${conf_dir}/features-enabled/${feature}.conf":
      ensure  => $_ensure,
      owner   => $user,
      group   => $group,
      seluser => 'unconfined_u',
      seltype => 'icinga2_etc_t',
      target  => "../features-available/${feature}.conf",
      require => Concat["${conf_dir}/features-available/${feature}.conf"],
      notify  => Class['icinga2::service'],
    }
  } else {
    $_ensure = $ensure ? {
      'present' => file,
      default   => absent,
    }

    file { "${conf_dir}/features-enabled/${feature}.conf":
      ensure  => $_ensure,
      owner   => $user,
      group   => $group,
      content => "include \"../features-available/${feature}.conf\"\r\n",
      require => Concat["${conf_dir}/features-available/${feature}.conf"],
      notify  => Class['icinga2::service'],
    }
  }
}