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
57
|
# File 'manifests/repo/community.pp', line 4
class sensu::repo::community {
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_community':
ensure => 'present',
baseurl => "https://packagecloud.io/sensu/community/el/${repo_release}/\$basearch",
descr => 'sensu_community',
enabled => 1,
gpgcheck => 0,
gpgkey => 'https://packagecloud.io/sensu/community/gpgkey',
metadata_expire => 300,
repo_gpgcheck => 1,
sslcacert => '/etc/pki/tls/certs/ca-bundle.crt',
sslverify => 1,
}
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_community':
path => '/usr/bin:/bin:/usr/sbin:/sbin',
command => "dnf -q makecache -y --disablerepo='*' --enablerepo='sensu_community'",
refreshonly => true,
tries => 2,
subscribe => Yumrepo['sensu_community'],
}
}
}
if $facts['os']['family'] == 'Debian' {
apt::source { 'sensu_community':
ensure => 'present',
location => "https://packagecloud.io/sensu/community/${downcase($facts['os']['name'])}/",
repos => 'main',
release => $facts['os']['distro']['codename'],
include => {
'src' => true,
},
key => {
'id' => '7F54E8A5C0CB51DBE612D2F50156BD72FEC8CD59',
'source' => 'https://packagecloud.io/sensu/community/gpgkey',
},
}
}
}
|