|
14 | 14 | # @param gpg_key_source The gpg key for the repo |
15 | 15 | # @param apt_keyring_name The keyring filename to create (APT only) |
16 | 16 | # The filename extention is important here. |
17 | | -# Use `.asc` if the key is armored and `.gpg` if it's unarmored |
| 17 | +# Use `.asc` if the key is armored and `.gpg` if it's unarmored |
| 18 | +# @param gpg_key_path The path where the GPG key should be stored (APT only) |
18 | 19 | class elastic_stack::repo ( |
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, |
| 20 | + Boolean $oss = false, |
| 21 | + Boolean $prerelease = false, |
| 22 | + Optional[Integer] $priority = undef, |
| 23 | + String $proxy = 'absent', |
| 24 | + Integer $version = 7, |
| 25 | + Stdlib::Filesource $gpg_key_source = 'https://artifacts.elastic.co/GPG-KEY-elasticsearch', |
| 26 | + String[1] $apt_keyring_name = 'elastic-keyring.asc', |
| 27 | + Stdlib::Absolutepath $gpg_key_path = '/usr/share/keyrings', |
| 28 | + Optional[String] $base_repo_url = undef, |
27 | 29 | ) { |
28 | 30 | if $prerelease { |
29 | 31 | $version_suffix = '.x-prerelease' |
|
72 | 74 | 'Debian': { |
73 | 75 | include apt |
74 | 76 |
|
| 77 | + apt::keyring { $apt_keyring_name: |
| 78 | + ensure => present, |
| 79 | + source => $gpg_key_source, |
| 80 | + dir => $gpg_key_path, |
| 81 | + } |
| 82 | + |
75 | 83 | apt::source { 'elastic': |
76 | 84 | comment => $description, |
77 | 85 | location => $base_url, |
78 | 86 | release => 'stable', |
79 | 87 | repos => 'main', |
80 | | - key => { |
81 | | - 'name' => $apt_keyring_name, |
82 | | - 'source' => $gpg_key_source, |
83 | | - }, |
84 | 88 | pin => $priority, |
| 89 | + keyring => "${gpg_key_path}/${apt_keyring_name}", |
| 90 | + require => Apt::Keyring[$apt_keyring_name], |
85 | 91 | } |
86 | 92 | } |
87 | 93 | 'RedHat', 'Linux': { |
|
0 commit comments