Puppet Class: sensu::repo

Defined in:
manifests/repo.pp

Summary

Private class to manage sensu repository resources

Overview



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

class sensu::repo {

  if $facts['os']['family'] == 'RedHat' {
    if $facts['os']['name'] == 'Amazon' {
      if $facts['os']['release']['major'] =~ /^201\d$/ {
        $repo_release = '6'
      } else {
        $repo_release = '7'
      }
    } else {
      $repo_release = $facts['os']['release']['major']
    }
    yumrepo { 'sensu':
      descr           => 'sensu',
      baseurl         => "https://packagecloud.io/sensu/stable/el/${repo_release}/\$basearch",
      repo_gpgcheck   => 1,
      gpgcheck        => 0,
      enabled         => 1,
      gpgkey          => 'https://packagecloud.io/sensu/stable/gpgkey',
      sslverify       => 1,
      sslcacert       => '/etc/pki/tls/certs/ca-bundle.crt',
      metadata_expire => 300,
    }
    if String($repo_release) == '8' {
      # This exec ensures GPG key is added without errors
      # Initial GPG download for dnf appears to return no exit code, tries=2 is workaround
      # This is method used by upstream Package Cloud scripts and will download GPG key
      # https://packagecloud.io/sensu/stable/install#bash-rpm
      exec { 'dnf makecache sensu':
        path        => '/usr/bin:/bin:/usr/sbin:/sbin',
        command     => "dnf -q makecache -y --disablerepo='*' --enablerepo='sensu'",
        refreshonly => true,
        tries       => 2,
        subscribe   => Yumrepo['sensu'],
      }
    }
  }
  if $facts['os']['family'] == 'Debian' {
    apt::source { 'sensu':
      ensure   => 'present',
      location => "https://packagecloud.io/sensu/stable/${downcase($facts['os']['name'])}/",
      repos    => 'main',
      release  => $facts['os']['distro']['codename'],
      include  => {
        'src' => true,
      },
      key      => {
        'id'     => 'CB1605C4E988C91F438249E3A5BC3FB70A3F7426',
        'source' => 'https://packagecloud.io/sensu/stable/gpgkey',
      },
    }
  }
}