summaryrefslogtreecommitdiff
path: root/manifests/agent/config.pp
blob: 256af8fa04abd960f10a4d35fc75d5f2ca6a719d (plain)
1
2
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
class check_mk::agent::config (
  $ip_whitelist = '',
  $port,
  $server_dir,
  $homedir,
  $use_cache,
  $user,
  $method          = 'xinetd',
  $generate_sshkey = false,
) {
  if $use_cache {
    $server = "${server_dir}/check_mk_caching_agent"
  }
  else {
    $server = "${server_dir}/check_mk_agent"
  }
  case $method {
    'xinetd': {
    if $ip_whitelist {
      $only_from = join($ip_whitelist, ' ')
    }
    else {
      $only_from = undef
    }
    file { '/etc/xinetd.d/check_mk':
      ensure  => present,
      owner   => 'root',
      group   => 'root',
      mode    => '0444',
      content => template('check_mk/agent/check_mk.erb'),
      require => Package['check_mk-agent','check_mk-agent-logwatch'],
      notify  => Class['check_mk::agent::service'],
    }
    }
    'ssh'   : {
      if $generate_sshkey {
        check_mk::agent::generate_sshkey { 'check_mk_key':
          homedir => $homedir
        }
      }
    }
    default : {}
  }
}