|
1 | 1 | # @summary Perform initial installation of Puppet Enterprise Extra Large
|
2 | 2 | #
|
| 3 | +# @param r10k_remote |
| 4 | +# The clone URL of the controlrepo to use. This just uses the basic config |
| 5 | +# from the documentaion https://puppet.com/docs/pe/2019.0/code_mgr_config.html |
| 6 | +# |
| 7 | +# @param r10k_private_key |
| 8 | +# The private key to use for r10k. If this is a local file it will be copied |
| 9 | +# over to the masters at /etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa |
| 10 | +# If the file does not exist the value will simply be supplied to the masters |
| 11 | +# |
| 12 | +# @param pe_conf_data |
| 13 | +# Config data to plane into pe.conf when generated on all hosts, this can be |
| 14 | +# used for tuning data etc. |
| 15 | +# |
3 | 16 | plan pe_xl::install (
|
| 17 | + # Large |
4 | 18 | String[1] $master_host,
|
5 |
| - Array[String[1]] $compiler_hosts = [ ], |
6 |
| - |
7 |
| - Optional[String[1]] $puppetdb_database_host = undef, |
| 19 | + Array[String[1]] $compiler_hosts = [ ], |
8 | 20 | Optional[String[1]] $master_replica_host = undef,
|
| 21 | + |
| 22 | + # Extra Large |
| 23 | + Optional[String[1]] $puppetdb_database_host = undef, |
9 | 24 | Optional[String[1]] $puppetdb_database_replica_host = undef,
|
10 | 25 |
|
| 26 | + # Common Configuration |
11 | 27 | String[1] $console_password,
|
12 |
| - String[1] $version = '2018.1.3', |
13 |
| - Hash $r10k_sources = { }, |
| 28 | + String[1] $version = '2019.1.1', |
14 | 29 | Array[String[1]] $dns_alt_names = [ ],
|
| 30 | + Hash $pe_conf_data = { }, |
| 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, |
15 | 36 |
|
16 |
| - String[1] $stagingdir = '/tmp', |
| 37 | + # Other |
| 38 | + String[1] $stagingdir = '/tmp', |
17 | 39 | ) {
|
18 | 40 |
|
19 | 41 | # Define a number of host groupings for use later in the plan
|
|
93 | 115 |
|
94 | 116 | $dns_alt_names_csv = $dns_alt_names.reduce |$csv,$x| { "${csv},${x}" }
|
95 | 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 | + |
96 | 133 | # Validate that the name given for each system is both a resolvable name AND
|
97 | 134 | # the configured hostname.
|
98 | 135 | run_task('pe_xl::hostname', $all_hosts).each |$result| {
|
|
102 | 139 | }
|
103 | 140 |
|
104 | 141 | # Generate all the needed pe.conf files
|
105 |
| - $master_pe_conf = epp('pe_xl/master-pe.conf.epp', |
106 |
| - console_password => $console_password, |
107 |
| - master_host => $master_host, |
108 |
| - puppetdb_database_host => $puppetdb_database_host, |
109 |
| - dns_alt_names => $dns_alt_names, |
110 |
| - r10k_sources => $r10k_sources, |
111 |
| - ) |
112 |
| - |
113 |
| - $puppetdb_database_pe_conf = epp('pe_xl/puppetdb_database-pe.conf.epp', |
114 |
| - master_host => $master_host, |
115 |
| - puppetdb_database_host => $puppetdb_database_host, |
116 |
| - ) |
117 |
| - |
118 |
| - $puppetdb_database_replica_pe_conf = epp('pe_xl/puppetdb_database-pe.conf.epp', |
119 |
| - master_host => $master_host, |
120 |
| - puppetdb_database_host => $puppetdb_database_replica_host, |
121 |
| - ) |
| 142 | + $master_pe_conf = pe_xl::generate_pe_conf({ |
| 143 | + 'console_admin_password' => $console_password, |
| 144 | + 'puppet_enterprise::puppet_master_host' => $master_host, |
| 145 | + 'pe_install::puppet_master_dnsaltnames' => $dns_alt_names, |
| 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', |
| 149 | + 'puppet_enterprise::profile::master::r10k_remote' => $r10k_remote, |
| 150 | + } + $pe_conf_data) |
| 151 | + |
| 152 | + $puppetdb_database_pe_conf = pe_xl::generate_pe_conf({ |
| 153 | + 'console_admin_password' => 'not used', |
| 154 | + 'puppet_enterprise::puppet_master_host' => $master_host, |
| 155 | + 'puppet_enterprise::database_host' => $puppetdb_database_host, |
| 156 | + } + $pe_conf_data) |
| 157 | + |
| 158 | + $puppetdb_database_replica_pe_conf = pe_xl::generate_pe_conf({ |
| 159 | + 'console_admin_password' => 'not used', |
| 160 | + 'puppet_enterprise::puppet_master_host' => $master_host, |
| 161 | + 'puppet_enterprise::database_host' => $puppetdb_database_replica_host, |
| 162 | + } + $pe_conf_data) |
122 | 163 |
|
123 | 164 | # Upload the pe.conf files to the hosts that need them
|
124 | 165 | pe_xl::file_content_upload($master_pe_conf, '/tmp/pe.conf', $master_host)
|
|
189 | 230 | out::message("Finished: task pe_xl::pe_install on ${master_host}")
|
190 | 231 | }
|
191 | 232 |
|
| 233 | + if $r10k_private_key { |
| 234 | + run_task('pe_xl::mkdir_p_file', [$master_host, $ha_replica_target], |
| 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, |
| 240 | + ) |
| 241 | + } |
| 242 | +
|
192 | 243 | # Configure autosigning for the puppetdb database hosts 'cause they need it
|
193 | 244 | $autosign_conf = $database_hosts.reduce |$memo,$host| { "${host}\n${memo}" }
|
194 | 245 | run_task('pe_xl::mkdir_p_file', $master_host,
|
195 | 246 | path => '/etc/puppetlabs/puppet/autosign.conf',
|
196 | 247 | owner => 'pe-puppet',
|
197 | 248 | group => 'pe-puppet',
|
198 | 249 | mode => '0644',
|
199 |
| - content => "$autosign_conf", |
| 250 | + content => $autosign_conf, |
200 | 251 | )
|
201 | 252 |
|
202 | 253 | # Run the PE installer on the puppetdb database hosts
|
|
0 commit comments