|
11 | 11 | # over to the primary at /etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa
|
12 | 12 | # If the file does not exist the value will simply be supplied to the primary
|
13 | 13 | #
|
| 14 | +# @param r10k_known_hosts |
| 15 | +# Puppet Enterprise 2023.3+ requires host key verification for the |
| 16 | +# r10k_remote host. When setting \$r10k_private_key, you must also provide |
| 17 | +# \$r10k_known_hosts information in the form of an array of hashes with |
| 18 | +# 'name', 'type' and 'key' information for hostname, key-type and public key. |
| 19 | +# |
14 | 20 | # @param license_key_file
|
15 | 21 | # The license key to use with Puppet Enterprise. If this is a local file it
|
16 | 22 | # will be copied over to the MoM at /etc/puppetlabs/license.key
|
|
50 | 56 | Optional[String] $r10k_remote = undef,
|
51 | 57 | Optional[String] $r10k_private_key_file = undef,
|
52 | 58 | Optional[Peadm::Pem] $r10k_private_key_content = undef,
|
| 59 | + Optional[Peadm::Known_hosts] $r10k_known_hosts = undef, |
53 | 60 |
|
54 | 61 | # License key
|
55 | 62 | Optional[String] $license_key_file = undef,
|
|
125 | 132 | # either be undef or else the key content to write.
|
126 | 133 | $r10k_private_key = peadm::file_or_content('r10k_private_key', $r10k_private_key_file, $r10k_private_key_content)
|
127 | 134 |
|
128 |
| - # Same for license key |
| 135 | + # Determine whether r10k_known_hosts is required and has been provided. |
| 136 | + $is_pe_2023_3_or_greater = (versioncmp($version, '2023.3.0') >= 0) |
| 137 | + if (($is_pe_2023_3_or_greater) and |
| 138 | + ($r10k_private_key =~ NotUndef) and |
| 139 | + ($r10k_known_hosts =~ Undef)) { |
| 140 | + fail_plan("In Puppet Enterprise 2023.3+ r10k 4.0 requires host key verification for the r10k_remote host. When setting \$r10k_private_key, you must also provide \$r10k_known_hosts information in the form of an array of hashes with 'name', 'type' and 'key' information for hostname, key-type and public key. Puppet Enterprise version: ${version}, r10k_known_hosts: ${r10k_known_hosts}") |
| 141 | + } |
| 142 | + $r10k_known_hosts_config = $r10k_known_hosts ? { |
| 143 | + undef => {}, |
| 144 | + default => { |
| 145 | + 'puppet_enterprise::profile::master::r10k_known_hosts' => $r10k_known_hosts, |
| 146 | + }, |
| 147 | + } |
| 148 | + |
| 149 | + # Process user input for license key (same process as for r10k private key above). |
129 | 150 | $license_key = peadm::file_or_content('license_key', $license_key_file, $license_key_content)
|
130 | 151 |
|
131 | 152 | $precheck_results = run_task('peadm::precheck', $all_targets)
|
|
170 | 191 | undef => undef,
|
171 | 192 | default => '/etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa',
|
172 | 193 | },
|
173 |
| - } + $puppetdb_database_temp_config + $pe_conf_data) |
| 194 | + } + $r10k_known_hosts_config + $puppetdb_database_temp_config + $pe_conf_data) |
174 | 195 |
|
175 | 196 | $primary_postgresql_pe_conf = peadm::generate_pe_conf({
|
176 | 197 | 'console_admin_password' => 'not used',
|
|
0 commit comments