-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathrepo.pp
114 lines (97 loc) · 4.05 KB
/
repo.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# powerdns::repo
class powerdns::repo inherits powerdns {
# The repositories of PowerDNS use a version such as '40' for version 4.0
# and 41 for version 4.1.
$authoritative_short_version = regsubst($powerdns::authoritative_version, /^(\d)\.(\d)$/, '\\1\\2', 'G')
$recursor_short_version = regsubst($powerdns::recursor_version, /^(\d)\.(\d)$/, '\\1\\2', 'G')
case $facts['os']['family'] {
'RedHat': {
unless $powerdns::custom_epel {
include epel
}
Yumrepo['powerdns'] -> Package <| title == $powerdns::params::authoritative_package |>
Yumrepo['powerdns-recursor'] -> Package <| title == $powerdns::params::recursor_package |>
if versioncmp($facts['os']['release']['major'], '7') <= 0 {
stdlib::ensure_packages('yum-plugin-priorities')
Package['yum-plugin-priorities']
-> Yumrepo['powerdns']
}
if versioncmp($facts['os']['release']['major'], '8') >= 0 {
if ($facts['os']['name'] == 'Rocky') {
$mirrorlist = "https://mirrors.rockylinux.org/mirrorlist?arch=\$basearch&repo=PowerTools-\$releasever"
$gpgkey = 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial'
} else {
$mirrorlist = "http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=PowerTools&infra=\$infra"
$gpgkey = 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial'
}
yumrepo { 'powertools':
ensure => 'present',
descr => 'PowerTools',
mirrorlist => $mirrorlist,
enabled => 'true',
gpgkey => $gpgkey,
gpgcheck => 'true',
}
}
yumrepo { 'powerdns':
name => 'powerdns',
descr => "PowerDNS repository for PowerDNS Authoritative - version ${powerdns::authoritative_version}",
baseurl => "http://repo.powerdns.com/centos/\$basearch/\$releasever/auth-${authoritative_short_version}",
gpgkey => 'https://repo.powerdns.com/FD380FBB-pub.asc',
gpgcheck => 1,
enabled => 1,
priority => 90,
includepkgs => 'pdns*',
}
yumrepo { 'powerdns-recursor':
name => 'powerdns-recursor',
descr => "PowerDNS repository for PowerDNS Recursor - version ${powerdns::recursor_version}",
baseurl => "http://repo.powerdns.com/centos/\$basearch/\$releasever/rec-${recursor_short_version}",
gpgkey => 'https://repo.powerdns.com/FD380FBB-pub.asc',
gpgcheck => 1,
enabled => 1,
priority => 90,
includepkgs => 'pdns*',
}
}
'Debian': {
include apt
$os = downcase($facts['os']['name'])
apt::key { 'powerdns':
ensure => present,
id => '9FAAA5577E8FCF62093D036C1B0C6205FD380FBB',
source => 'https://repo.powerdns.com/FD380FBB-pub.asc',
}
apt::source { 'powerdns':
ensure => present,
location => "http://repo.powerdns.com/${os}",
repos => 'main',
release => "${facts['os']['distro']['codename']}-auth-${authoritative_short_version}",
architecture => 'amd64',
require => Apt::Key['powerdns'],
}
apt::source { 'powerdns-recursor':
ensure => present,
location => "http://repo.powerdns.com/${os}",
repos => 'main',
release => "${facts['os']['distro']['codename']}-rec-${recursor_short_version}",
architecture => 'amd64',
require => Apt::Source['powerdns'],
}
apt::pin { 'powerdns':
priority => 600,
packages => 'pdns-*',
origin => 'repo.powerdns.com',
require => Apt::Source['powerdns-recursor'],
}
Apt::Pin['powerdns'] -> Package <| title == $powerdns::params::authoritative_package |>
Apt::Pin['powerdns'] -> Package <| title == $powerdns::params::recursor_package |>
}
'FreeBSD','Archlinux': {
# Use the official pkg repository
}
default: {
fail("${facts['os']['family']} is not supported yet.")
}
}
}