|
14 | 14 | # used for tuning data etc.
|
15 | 15 | #
|
16 | 16 | plan pe_xl::install (
|
| 17 | + # Large |
17 | 18 | String[1] $master_host,
|
18 |
| - Array[String[1]] $compiler_hosts = [ ], |
| 19 | + Array[String[1]] $compiler_hosts = [ ], |
| 20 | + Optional[String[1]] $master_replica_host = undef, |
19 | 21 |
|
| 22 | + # Extra Large |
20 | 23 | Optional[String[1]] $puppetdb_database_host = undef,
|
21 |
| - Optional[String[1]] $master_replica_host = undef, |
22 | 24 | Optional[String[1]] $puppetdb_database_replica_host = undef,
|
23 | 25 |
|
| 26 | + # Common Configuration |
24 | 27 | String[1] $console_password,
|
25 |
| - String[1] $version = '2018.1.3', |
26 |
| - Optional[String] $r10k_remote = undef, |
27 |
| - Optional[String] $r10k_private_key = undef, |
28 |
| - Array[String[1]] $dns_alt_names = [ ], |
| 28 | + String[1] $version = '2019.1.1', |
| 29 | + Array[String[1]] $dns_alt_names = [ ], |
| 30 | + Hash $pe_conf_data = { }, |
29 | 31 |
|
| 32 | + # Code Manager |
| 33 | + Optional[String] $r10k_remote = undef, |
| 34 | + Optional[String] $r10k_private_key_file = undef, |
| 35 | + Optional[Pe_xl::Pem] $r10k_private_key_content = undef, |
| 36 | + |
| 37 | + # Other |
30 | 38 | String[1] $stagingdir = '/tmp',
|
31 |
| - Hash $pe_conf_data = {}, |
32 | 39 | ) {
|
33 | 40 |
|
34 | 41 | # Define a number of host groupings for use later in the plan
|
|
108 | 115 |
|
109 | 116 | $dns_alt_names_csv = $dns_alt_names.reduce |$csv,$x| { "${csv},${x}" }
|
110 | 117 |
|
| 118 | + # Process user input for r10k private key (content or file) and set |
| 119 | + # appropriate value in $r10k_private_key. The value of this variable should |
| 120 | + # either be undef or else the key content to write. |
| 121 | + $r10k_private_key = [ |
| 122 | + $r10k_private_key_file, |
| 123 | + $r10k_private_key_content, |
| 124 | + ].pe_xl::flatten_compact.size ? { |
| 125 | + 0 => undef, # no key data supplied |
| 126 | + 2 => fail('Must specify either one or neither of r10k_private_key_file and r10k_private_key_content; not both'), |
| 127 | + 1 => $r10k_private_key_file ? { |
| 128 | + String => file($r10k_private_key_file), # key file path supplied, read data from file |
| 129 | + undef => $r10k_private_key_content, # key content supplied directly, use as-is |
| 130 | + }, |
| 131 | + } |
| 132 | + |
111 | 133 | # Validate that the name given for each system is both a resolvable name AND
|
112 | 134 | # the configured hostname.
|
113 | 135 | run_task('pe_xl::hostname', $all_hosts).each |$result| {
|
|
116 | 138 | }
|
117 | 139 | }
|
118 | 140 |
|
119 |
| - # Check if the r10k_private_key is a local file |
120 |
| - if ($r10k_private_key and find_file($r10k_private_key)) { |
121 |
| - # If the file exists then the config value should be the default path |
122 |
| - $_r10k_private_key = '/etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa' |
123 |
| - |
124 |
| - # Set a flag for managing the content later |
125 |
| - $manage_private_key = true |
126 |
| - } else { |
127 |
| - # Just use the config as a config value |
128 |
| - $_r10k_private_key = $r10k_private_key |
129 |
| - $manage_private_key = false |
130 |
| - } |
131 |
| - |
132 |
| - # Only auto configure code manager if we have given an r10k_remote |
133 |
| - $_code_manager_auto_configure = $r10k_remote ? { |
134 |
| - undef => undef, # If this is undef then it wont be passed |
135 |
| - default => true, |
136 |
| - } |
137 |
| - |
138 | 141 | # Generate all the needed pe.conf files
|
139 | 142 | $master_pe_conf = pe_xl::generate_pe_conf({
|
140 | 143 | 'console_admin_password' => $console_password,
|
141 | 144 | 'puppet_enterprise::puppet_master_host' => $master_host,
|
142 | 145 | 'pe_install::puppet_master_dnsaltnames' => $dns_alt_names,
|
143 | 146 | 'puppet_enterprise::profile::puppetdb::database_host' => $puppetdb_database_host,
|
| 147 | + 'puppet_enterprise::profile::master::code_manager_auto_configure' => true, |
| 148 | + 'puppet_enterprise::profile::master::r10k_private_key' => '/etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa', |
144 | 149 | 'puppet_enterprise::profile::master::r10k_remote' => $r10k_remote,
|
145 |
| - 'puppet_enterprise::profile::master::code_manager_auto_configure' => $_code_manager_auto_configure, |
146 |
| - 'puppet_enterprise::profile::master::r10k_private_key' => $_r10k_private_key, |
147 | 150 | } + $pe_conf_data)
|
148 | 151 |
|
149 | 152 | $puppetdb_database_pe_conf = pe_xl::generate_pe_conf({
|
|
227 | 230 | out::message("Finished: task pe_xl::pe_install on ${master_host}")
|
228 | 231 | }
|
229 | 232 |
|
230 |
| - if $manage_private_key { |
231 |
| - # Create the SSH private key |
| 233 | + if $r10k_private_key { |
232 | 234 | run_task('pe_xl::mkdir_p_file', [$master_host, $ha_replica_target],
|
233 |
| - path => $_r10k_private_key, # The configured path |
234 |
| - content => file($r10k_private_key), # The local file |
| 235 | + path => '/etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa', |
| 236 | + owner => 'pe-puppet', |
| 237 | + group => 'pe-puppet', |
| 238 | + mode => '0400', |
| 239 | + content => $r10k_private_key, |
235 | 240 | )
|
236 | 241 | }
|
237 | 242 |
|
|
0 commit comments