|
9 | 9 | # over to the masters at /etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa
|
10 | 10 | # If the file does not exist the value will simply be supplied to the masters
|
11 | 11 | #
|
| 12 | +# @param license_key |
| 13 | +# The license key to use with Puppet Enterprise. If this is a local file it |
| 14 | +# will be copied over to the MoM at /etc/puppetlabs/license.key |
| 15 | +# If the file does not exist the value will simply be supplied to the masters |
| 16 | +# |
12 | 17 | # @param pe_conf_data
|
13 | 18 | # Config data to plane into pe.conf when generated on all hosts, this can be
|
14 | 19 | # used for tuning data etc.
|
|
36 | 41 | Optional[String] $r10k_private_key_file = undef,
|
37 | 42 | Optional[Peadm::Pem] $r10k_private_key_content = undef,
|
38 | 43 |
|
| 44 | + # License key |
| 45 | + Optional[String] $license_key_file = undef, |
| 46 | + Optional[String] $license_key_content = undef, |
| 47 | + |
39 | 48 | # Other
|
40 | 49 | String $stagingdir = '/tmp',
|
41 | 50 | ) {
|
|
106 | 115 | },
|
107 | 116 | }
|
108 | 117 |
|
| 118 | + $license_key = [ |
| 119 | + $license_key_file, |
| 120 | + $license_key_content, |
| 121 | + ].peadm::flatten_compact.size ? { |
| 122 | + 0 => undef, # no key data supplied |
| 123 | + 2 => fail('Must specify either one or neither of license_key_file and license_key_content; not both'), |
| 124 | + 1 => $license_key_file ? { |
| 125 | + String => file($license_key_file), # key file path supplied, read data from file |
| 126 | + undef => $license_key_content, # key content supplied directly, use as-is |
| 127 | + }, |
| 128 | + } |
| 129 | + |
109 | 130 | $precheck_results = run_task('peadm::precheck', $all_targets)
|
110 | 131 | $platform = $precheck_results.first['platform'] # Assume the platform of the first result correct
|
111 | 132 |
|
|
221 | 242 | )
|
222 | 243 | }
|
223 | 244 |
|
| 245 | + if $license_key { |
| 246 | + run_task('peadm::mkdir_p_file', [$master_target, $master_replica_target], |
| 247 | + path => '/etc/puppetlabs/license.key', |
| 248 | + owner => 'pe-puppet', |
| 249 | + group => 'pe-puppet', |
| 250 | + mode => '0400', |
| 251 | + content => $license_key, |
| 252 | + ) |
| 253 | + } |
| 254 | +
|
224 | 255 | # Configure autosigning for the puppetdb database hosts 'cause they need it
|
225 | 256 | $autosign_conf = $database_targets.reduce('') |$memo,$target| { "${target.name}\n${memo}" }
|
226 | 257 | run_task('peadm::mkdir_p_file', $master_target,
|
|
0 commit comments