-
Notifications
You must be signed in to change notification settings - Fork 321
/
Copy pathrepos.pp
90 lines (82 loc) · 2.51 KB
/
repos.pp
1
2
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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
# @summary
#
# @param location
#
# @param key_source
#
# @param key_check_source
#
# @param architecture
#
class docker::repos (
Optional[String] $location = $docker::package_location,
Optional[String] $key_source = $docker::package_key_source,
Optional[Boolean] $key_check_source = $docker::package_key_check_source,
String $architecture = $facts['os']['architecture'],
) {
stdlib::ensure_packages($docker::prerequired_packages)
case $facts['os']['family'] {
'Debian': {
$release = $docker::release
$package_key = $docker::package_key
$package_repos = $docker::package_repos
if ($docker::use_upstream_package_source) {
apt::source { 'docker':
location => $location,
architecture => $architecture,
release => $release,
repos => $package_repos,
key => {
id => $package_key,
source => $key_source,
},
include => {
src => false,
},
}
$url_split = split($location, '/')
$repo_host = $url_split[2]
$pin_ensure = $docker::pin_upstream_package_source ? {
true => 'present',
default => 'absent',
}
apt::pin { 'docker':
ensure => $pin_ensure,
origin => $repo_host,
priority => $docker::apt_source_pin_level,
}
if $docker::manage_package {
include apt
if (versioncmp($facts['facterversion'], '2.4.6') <= 0) {
if $facts['os']['name'] == 'Debian' and $facts['os']['lsb']['distcodename'] == 'wheezy' {
include apt::backports
}
} else {
if $facts['os']['name'] == 'Debian' and $facts['os']['distro']['codename'] == 'wheezy' {
include apt::backports
}
}
Exec['apt_update'] -> Package[$docker::prerequired_packages]
Apt::Source['docker'] -> Package['docker']
}
}
}
'RedHat': {
if ($docker::manage_package) {
$baseurl = $location
$gpgkey = $key_source
$gpgkey_check = $key_check_source
if ($docker::use_upstream_package_source) {
yumrepo { 'docker':
descr => 'Docker',
baseurl => $baseurl,
gpgkey => $gpgkey,
gpgcheck => $gpgkey_check,
}
Yumrepo['docker'] -> Package['docker']
}
}
}
default: {}
}
}