|
11 | 11 | # @param proxy The URL of a HTTP proxy to use for package downloads (YUM only) |
12 | 12 | # @param version The (major) version of the Elastic Stack for which to configure the repo |
13 | 13 | # @param base_repo_url The base url for the repo path |
| 14 | +# @param gpg_key_source The gpg key for the repo |
| 15 | +# @param apt_keyring_name The keyring filename to create (APT only) |
| 16 | +# The filename extention is important here. |
| 17 | +# Use `.asc` if the key is armored and `.gpg` if it's unarmored |
14 | 18 | class elastic_stack::repo ( |
15 | | - Boolean $oss = false, |
16 | | - Boolean $prerelease = false, |
17 | | - Optional[Integer] $priority = undef, |
18 | | - String $proxy = 'absent', |
19 | | - Integer $version = 7, |
20 | | - Optional[String] $base_repo_url = undef, |
| 19 | + Boolean $oss = false, |
| 20 | + Boolean $prerelease = false, |
| 21 | + Optional[Integer] $priority = undef, |
| 22 | + String $proxy = 'absent', |
| 23 | + Integer $version = 7, |
| 24 | + Stdlib::Filesource $gpg_key_source = 'https://artifacts.elastic.co/GPG-KEY-elasticsearch', |
| 25 | + String[1] $apt_keyring_name = 'elastic-keyring.asc', |
| 26 | + Optional[String] $base_repo_url = undef, |
21 | 27 | ) { |
22 | 28 | if $prerelease { |
23 | 29 | $version_suffix = '.x-prerelease' |
|
60 | 66 | } |
61 | 67 |
|
62 | 68 | $base_url = "${_repo_url}/${version_prefix}${version}${version_suffix}/${_repo_path}" |
63 | | - $key_source='https://artifacts.elastic.co/GPG-KEY-elasticsearch' |
64 | 69 | $description='Elastic package repository.' |
65 | 70 |
|
66 | 71 | case $facts['os']['family'] { |
|
73 | 78 | release => 'stable', |
74 | 79 | repos => 'main', |
75 | 80 | key => { |
76 | | - 'name' => 'elastic.asc', |
77 | | - 'source' => $key_source, |
| 81 | + 'name' => $apt_keyring_name, |
| 82 | + 'source' => $gpg_key_source, |
78 | 83 | }, |
79 | 84 | pin => $priority, |
80 | 85 | } |
|
84 | 89 | descr => $description, |
85 | 90 | baseurl => $base_url, |
86 | 91 | gpgcheck => 1, |
87 | | - gpgkey => $key_source, |
| 92 | + gpgkey => $gpg_key_source, |
88 | 93 | enabled => 1, |
89 | 94 | proxy => $proxy, |
90 | 95 | priority => $priority, |
|
100 | 105 | 'Suse': { |
101 | 106 | # Older versions of SLES do not ship with rpmkeys |
102 | 107 | if $facts['os']['name'] == 'SLES' and versioncmp($facts['os']['release']['major'], '11') <= 0 { |
103 | | - $_import_cmd = "rpm --import ${key_source}" |
| 108 | + $_import_cmd = "rpm --import ${gpg_key_source}" |
104 | 109 | } |
105 | 110 | else { |
106 | | - $_import_cmd = "rpmkeys --import ${key_source}" |
| 111 | + $_import_cmd = "rpmkeys --import ${gpg_key_source}" |
107 | 112 | } |
108 | 113 |
|
109 | 114 | exec { 'elastic_suse_import_gpg': |
|
120 | 125 | autorefresh => 1, |
121 | 126 | name => 'elastic', |
122 | 127 | gpgcheck => 1, |
123 | | - gpgkey => $key_source, |
| 128 | + gpgkey => $gpg_key_source, |
124 | 129 | type => 'yum', |
125 | 130 | priority => $priority, |
126 | 131 | } |
|
0 commit comments