summaryrefslogtreecommitdiff
path: root/manifests/install.pp
blob: bb32146f6058f856a9e41dfa4a01662f4c9e73af (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
class check_mk::install (
  $filestore = '',
  $package,
  $site,
  $workspace,
) {
  if $filestore {
    if ! defined(File[$workspace]) {
      file { $workspace:
        ensure => directory,
      }
    }
    file { "${workspace}/${package}":
      ensure  => latest,
      source  => "${filestore}/${package}",
      require => File[$workspace],
    }
    # omd-0.56-rh60-29.x86_64.rpm
    if $package =~ /^(omd-\d+\.\d+)-(.*?)\.(rpm|deb)$/ {
      $package_name = $1
      $type         = $3
      package { $package_name:
        ensure   => installed,
        provider => $type,
        source   => "${workspace}/${package}",
        require  => File["${workspace}/${package}"],
      }
    }
  }
  else {
    $package_name = $package
    package { $package_name:
      ensure => installed,
    }
  }
  $etc_dir = "/omd/sites/${site}/etc"
  exec { 'omd-create-site':
    command => "/usr/bin/omd create ${site}",
    creates => $etc_dir,
    require => Package[$package_name],
  }
}