Puppet Class: check_mk::agent::install

Inherits:
check_mk::agent
Defined in:
manifests/agent/install.pp

Summary

Installs the check_mk client.

Overview

Class: check_mk::agent::install

Parameters:

  • filestore (Any) (defaults to: $check_mk::agent::filestore)
  • workspace (Any) (defaults to: $check_mk::agent::workspace)
  • package (Any) (defaults to: $check_mk::agent::package)
  • package_ensure (Any) (defaults to: $check_mk::agent::package_ensure)


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

class check_mk::agent::install (
  $filestore      = $check_mk::agent::filestore,
  $workspace      = $check_mk::agent::workspace,
  $package        = $check_mk::agent::package,
  $package_ensure = $check_mk::agent::package_ensure,
) inherits check_mk::agent {
  if $filestore {
    if ! defined(File[$workspace]) {
      file { $workspace:
        ensure => directory,
      }
    }

    # check-mk-agent_1.5.0p7-1_all.deb
    if $package =~ /^(check-mk-(\w*))(-|_)(\d*\.\d*\.\d*p\d*).+\.(\w+)$/ {
      case $5 {
        'deb':     {
          $type = 'dpkg'
        }
        default: {
          $type = $5
        }
      }
      $package_name = $1

      file { "${workspace}/${package}":
        ensure => file,
        source => "${filestore}/${package}",
      }

      package { 'check_mk-agent':
        ensure   => present,
        name     => $package_name,
        provider => $type,
        source   => "${workspace}/${package}",
        require  => File["${workspace}/${package}"],
      }
    } else {
      fail('Package does not match format like check-mk-agent_1.5.0p7-1_all.deb')
    }
  } else {
    package { 'check_mk-agent':
      ensure => $package_ensure,
      name   => $package,
    }
  }
}