|
3 | 3 | # @param manage_apt Whether the module should manage apt repositories for Debian based systems.
|
4 | 4 | # @param zabbix_version This is the zabbix version.
|
5 | 5 | # @param repo_location A custom repo location (e.g. your own mirror)
|
| 6 | +# @param repo_gpg_key_location |
| 7 | +# A custom repo GPG key location (e.g. an airlocked copy of the gpg key) |
6 | 8 | # @param frontend_repo_location A custom repo location for frontend package.
|
7 | 9 | # @param unsupported_repo_location
|
8 | 10 | # A custom repo location for unsupported content (e.g. your own mirror)
|
9 | 11 | # Currently only supported under RedHat based systems.
|
| 12 | +# @param unsupported_repo_gpg_key_location |
| 13 | +# A custom repo GPG key location (e.g. an airlocked copy of the gpg key) |
10 | 14 | # @author Werner Dijkerman <[email protected]>
|
11 | 15 | # @author Tim Meusel <[email protected]>
|
12 | 16 | class zabbix::repo (
|
13 |
| - Boolean $manage_repo = $zabbix::params::manage_repo, |
14 |
| - Boolean $manage_apt = $zabbix::params::manage_apt, |
15 |
| - Optional[Stdlib::HTTPUrl] $repo_location = $zabbix::params::repo_location, |
16 |
| - Optional[Stdlib::HTTPUrl] $frontend_repo_location = $zabbix::params::frontend_repo_location, |
17 |
| - Optional[Stdlib::HTTPUrl] $unsupported_repo_location = $zabbix::params::unsupported_repo_location, |
18 |
| - String[1] $zabbix_version = $zabbix::params::zabbix_version, |
| 17 | + Boolean $manage_repo = $zabbix::params::manage_repo, |
| 18 | + Boolean $manage_apt = $zabbix::params::manage_apt, |
| 19 | + Optional[Stdlib::HTTPUrl] $repo_location = $zabbix::params::repo_location, |
| 20 | + Optional[Stdlib::HTTPUrl] $repo_gpg_key_location = $zabbix::params::repo_gpg_key_location, |
| 21 | + Optional[Stdlib::HTTPUrl] $frontend_repo_location = $zabbix::params::frontend_repo_location, |
| 22 | + Optional[Stdlib::HTTPUrl] $unsupported_repo_location = $zabbix::params::unsupported_repo_location, |
| 23 | + Optional[Stdlib::HTTPUrl] $unsupported_repo_gpg_key_location = $zabbix::params::unsupported_repo_gpg_key_location, |
| 24 | + String[1] $zabbix_version = $zabbix::params::zabbix_version, |
19 | 25 | ) inherits zabbix::params {
|
20 | 26 | if $manage_repo {
|
21 | 27 | case $facts['os']['family'] {
|
22 | 28 | 'RedHat': {
|
23 | 29 | $majorrelease = $facts['os']['release']['major']
|
24 | 30 | if versioncmp($zabbix_version, '7.0') >= 0 {
|
25 |
| - $gpgkey_zabbix = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005' |
| 31 | + $_gpgkey_zabbix = $repo_gpg_key_location ? { |
| 32 | + undef => 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005', |
| 33 | + default => "${repo_gpg_key_location}/RPM-GPG-KEY-ZABBIX-B5333005", |
| 34 | + } |
26 | 35 | if versioncmp(fact('os.release.major'), '9') >= 0 {
|
27 |
| - $gpgkey_nonsupported = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD' |
| 36 | + $_gpgkey_nonsupported = $unsupported_repo_gpg_key_location ? { |
| 37 | + undef => 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD', |
| 38 | + default => "${unsupported_repo_gpg_key_location}/RPM-GPG-KEY-ZABBIX-08EFA7DD", |
| 39 | + } |
28 | 40 | } else {
|
29 |
| - $gpgkey_nonsupported = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005' |
| 41 | + $_gpgkey_nonsupported = $unsupported_repo_gpg_key_location ? { |
| 42 | + undef => 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005', |
| 43 | + default => "${unsupported_repo_gpg_key_location}/RPM-GPG-KEY-ZABBIX-B5333005", |
| 44 | + } |
30 | 45 | }
|
31 | 46 | } elsif versioncmp(fact('os.release.major'), '9') >= 0 {
|
32 |
| - $gpgkey_zabbix = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD' |
33 |
| - $gpgkey_nonsupported = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD' |
| 47 | + $_gpgkey_zabbix = $repo_gpg_key_location ? { |
| 48 | + undef => 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD', |
| 49 | + default => "${repo_gpg_key_location}/RPM-GPG-KEY-ZABBIX-08EFA7DD", |
| 50 | + } |
| 51 | + $_gpgkey_nonsupported = $unsupported_repo_gpg_key_location ? { |
| 52 | + undef => 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD', |
| 53 | + default => "${unsupported_repo_gpg_key_location}/RPM-GPG-KEY-ZABBIX-08EFA7DD", |
| 54 | + } |
34 | 55 | } else {
|
35 |
| - $gpgkey_zabbix = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591' |
36 |
| - $gpgkey_nonsupported = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-79EA5ED4' |
| 56 | + $_gpgkey_zabbix = $repo_gpg_key_location ? { |
| 57 | + undef => 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591', |
| 58 | + default => "${repo_gpg_key_location}/RPM-GPG-KEY-ZABBIX-A14FE591", |
| 59 | + } |
| 60 | + $_gpgkey_nonsupported = $unsupported_repo_gpg_key_location ? { |
| 61 | + undef => 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-79EA5ED4', |
| 62 | + default => "${unsupported_repo_gpg_key_location}/RPM-GPG-KEY-ZABBIX-79EA5ED4", |
| 63 | + } |
37 | 64 | }
|
38 | 65 |
|
39 | 66 | $_repo_location = $repo_location ? {
|
|
46 | 73 | descr => "Zabbix_${majorrelease}_${facts['os']['architecture']}",
|
47 | 74 | baseurl => $_repo_location,
|
48 | 75 | gpgcheck => '1',
|
49 |
| - gpgkey => $gpgkey_zabbix, |
| 76 | + gpgkey => $_gpgkey_zabbix, |
50 | 77 | priority => '1',
|
51 | 78 | }
|
52 | 79 |
|
|
60 | 87 | descr => "Zabbix_nonsupported_${majorrelease}_${facts['os']['architecture']}",
|
61 | 88 | baseurl => $_unsupported_repo_location,
|
62 | 89 | gpgcheck => '1',
|
63 |
| - gpgkey => $gpgkey_nonsupported, |
| 90 | + gpgkey => $_gpgkey_nonsupported, |
64 | 91 | priority => '1',
|
65 | 92 | }
|
66 | 93 | }
|
|
91 | 118 | default => $repo_location,
|
92 | 119 | }
|
93 | 120 |
|
| 121 | + $_gpgkey_zabbix = $repo_gpg_key_location ? { |
| 122 | + undef => 'https://repo.zabbix.com/zabbix-official-repo.key', |
| 123 | + default => "${repo_gpg_key_location}/zabbix-official-repo.key", |
| 124 | + } |
| 125 | + |
94 | 126 | apt::key { 'zabbix-FBABD5F':
|
95 | 127 | id => 'FBABD5FB20255ECAB22EE194D13D58E479EA5ED4',
|
96 |
| - source => 'https://repo.zabbix.com/zabbix-official-repo.key', |
| 128 | + source => $_gpgkey_zabbix, |
97 | 129 | }
|
98 | 130 | apt::key { 'zabbix-A1848F5':
|
99 | 131 | id => 'A1848F5352D022B9471D83D0082AB56BA14FE591',
|
100 |
| - source => 'https://repo.zabbix.com/zabbix-official-repo.key', |
| 132 | + source => $_gpgkey_zabbix, |
101 | 133 | }
|
102 | 134 | apt::key { 'zabbix-4C3D6F2':
|
103 | 135 | id => '4C3D6F2CC75F5146754FC374D913219AB5333005',
|
104 |
| - source => 'https://repo.zabbix.com/zabbix-official-repo.key', |
| 136 | + source => $_gpgkey_zabbix, |
105 | 137 | }
|
106 | 138 |
|
107 | 139 | # Debian 11 provides Zabbix 5.0 by default. This can cause problems for 4.0 versions
|
|
0 commit comments