Puppet Class: prometheusforemansd::install

Defined in:
manifests/install.pp

Overview

Class prometheusforemansd::install



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

class prometheusforemansd::install {
  if $::prometheusforemansd::archive_source != undef {
    $real_archive_source = $::prometheusforemansd::archive_source
  }
  else {
    $real_archive_source = "https://s3.ap-south-1.amazonaws.com/zomato-foremandns/prometheus-foreman-sd-linux-amd64-${::prometheusforemansd::version}.tgz"
  }
  case $::prometheusforemansd::install_method {
    'archive': {
      # create log directory /var/log/prometheusforemansd (or parameterize)

      file { $::prometheusforemansd::install_dir:
        ensure  => directory,
        group   => 'root',
        owner   => 'root'
      }

      archive { '/tmp/prometheusforemansd.tar.gz':
        ensure          => present,
        extract         => true,
        extract_command => 'tar xfz %s',
        extract_path    => $::prometheusforemansd::install_dir,
        source          => $real_archive_source,
        user            => 'root',
        group           => 'root',
        cleanup         => true,
        require         => File[$::prometheusforemansd::install_dir]
      }

    }
    default: {
      fail("Installation method ${::prometheusforemansd::install_method} not supported")
    }
  }
}