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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'manifests/ubuntu.pp', line 6
class datadog_agent::ubuntu(
Integer $agent_major_version = $datadog_agent::params::default_agent_major_version,
String $apt_key = 'A2923DFF56EDA6E76E55E492D3A80E30382E94DE',
String $agent_version = $datadog_agent::params::agent_version,
Optional[String] $agent_repo_uri = undef,
String $release = $datadog_agent::params::apt_default_release,
Boolean $skip_apt_key_trusting = false,
Optional[String] $apt_keyserver = undef,
) inherits datadog_agent::params {
if $agent_version =~ /^[0-9]+\.[0-9]+\.[0-9]+((?:~|-)[^0-9\s-]+[^-\s]*)?$/ {
$platform_agent_version = "1:${agent_version}-1"
}
else {
$platform_agent_version = $agent_version
}
case $agent_major_version {
5 : { $repos = 'main' }
6 : { $repos = '6' }
7 : { $repos = '7' }
default: { fail('invalid agent_major_version') }
}
if !$skip_apt_key_trusting {
$key = {
'id' => $apt_key,
'server' => $apt_keyserver,
}
} else {
$key = {}
}
if ($agent_repo_uri != undef) {
$location = $agent_repo_uri
} else {
$location = 'https://apt.datadoghq.com/'
}
apt::source { 'datadog-beta':
ensure => absent,
}
apt::source { 'datadog5':
ensure => absent,
}
apt::source { 'datadog6':
ensure => absent,
}
apt::source { 'datadog':
comment => 'Datadog Agent Repository',
location => $location,
release => $release,
repos => $repos,
require => Class['apt'],
key => $key,
}
package { 'datadog-agent-base':
ensure => absent,
before => Package[$datadog_agent::params::package_name],
}
package { $datadog_agent::params::package_name:
ensure => $platform_agent_version,
require => [Apt::Source['datadog'],
Class['apt::update']],
}
}
|