Puppet Class: metricbeat::repo

Inherits:
metricbeat
Defined in:
manifests/repo.pp

Summary

Manages the relevant repo manager on the target node.

Overview

metricbeat::repo If included, configure the relevant repo manager on the target node.



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
65
66
# File 'manifests/repo.pp', line 7

class metricbeat::repo inherits metricbeat {
  $apt_repo_url = $metricbeat::apt_repo_url ? {
    undef => "https://artifacts.elastic.co/packages/${metricbeat::major_version}.x/apt",
    default => $metricbeat::apt_repo_url,
  }
  $yum_repo_url = $metricbeat::yum_repo_url ? {
    undef => "https://artifacts.elastic.co/packages/${metricbeat::major_version}.x/yum",
    default => $metricbeat::yum_repo_url,
  }

  case $facts['osfamily'] {
    'Debian': {
      include ::apt

      if !defined(Apt::Source['beats']) {
        apt::source{'beats':
          location => $apt_repo_url,
          release  => 'stable',
          repos    => 'main',
          key      => {
            id     => '46095ACC8548582C1A2699A9D27D666CD88E42B4',
            source => 'https://artifacts.elastic.co/GPG-KEY-elasticsearch',
          },
        }
      }
      Class['apt::update'] -> Package['metricbeat']
    }
    'RedHat': {
      if !defined(Yumrepo['beats']) {
        yumrepo{'beats':
          descr    => "Elastic repository for ${metricbeat::major_version}.x packages",
          baseurl  => $yum_repo_url,
          gpgcheck => 1,
          gpgkey   => 'https://artifacts.elastic.co/GPG-KEY-elasticsearch',
          enabled  => 1,
        }
      }
    }
    'SuSe': {
      exec { 'topbeat_suse_import_gpg':
        command => '/usr/bin/rpmkeys --import https://artifacts.elastic.co/GPG-KEY-elasticsearch',
        unless  => '/usr/bin/test $(rpm -qa gpg-pubkey | grep -i "D88E42B4" | wc -l) -eq 1 ',
        notify  => [ Zypprepo['beats'] ],
      }
      if !defined (Zypprepo['beats']) {
        zypprepo{'beats':
          baseurl     => $yum_repo_url,
          enabled     => 1,
          autorefresh => 1,
          name        => 'beats',
          gpgcheck    => 1,
          gpgkey      => 'https://artifacts.elastic.co/GPG-KEY-elasticsearch',
          type        => 'yum',
        }
      }
    }
    default: {
    }
  }
}