summaryrefslogtreecommitdiff
path: root/manifests/agent/install.pp
blob: 7225b20e5e7d1a4f88709f1082e499f1ac0b5cf1 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
class check_mk::agent::install (
  $version = '',
  $filestore = '',
  $workspace,
  $agent_package_name,
  $agent_logwatch_package_name,
  $method = 'xinetd',
) {
  if $method == 'xinetd' {
    if ! defined($require_method) {
      package { 'xinetd':
        ensure => latest,
      }
    }
    $require_method = 'Package[\'xinetd\']'
  } else {
    $require_method = undef
  }

  if $filestore {
    if ! defined(File[$workspace]) {
      file { $workspace:
        ensure => directory,
      }
    }
    file { "${workspace}/check_mk-agent-${version}.noarch.rpm":
      ensure  => latest,
      source  => "${filestore}/check_mk-agent-${version}.noarch.rpm",
      require => $require_method,
    }
    file { "${workspace}/check_mk-agent-logwatch-${version}.noarch.rpm":
      ensure  => latest,
      source  => "${filestore}/check_mk-agent-logwatch-${version}.noarch.rpm",
      require => $require_method,
    }
    package { 'check_mk-agent':
      ensure   => latest,
      provider => 'rpm',
      source   => "${workspace}/check_mk-agent-${version}.noarch.rpm",
      require  => File["${workspace}/check_mk-agent-${version}.noarch.rpm"],
    }
    package { 'check_mk-agent-logwatch':
      ensure   => latest,
      provider => 'rpm',
      source   => "${workspace}/check_mk-agent-logwatch-${version}.noarch.rpm",
      require  => [
        File["${workspace}/check_mk-agent-logwatch-${version}.noarch.rpm"],
        Package['check_mk-agent'],
      ],
    }
  }
  else {
    package { 'check_mk-agent':
      ensure  => latest,
      name    => $agent_package_name,
      require => $require_method,
    }
    package { 'check_mk-agent-logwatch':
      ensure  => latest,
      name    => $agent_logwatch_package_name,
      require => Package['check_mk-agent'],
    }
  }
}