|
10 | 10 |
|
11 | 11 | # Large
|
12 | 12 | Optional[TargetSpec] $compiler_hosts = undef,
|
| 13 | + Optional[TargetSpec] $legacy_compilers = undef, |
13 | 14 |
|
14 | 15 | # Extra Large
|
15 | 16 | Optional[Peadm::SingleTargetSpec] $primary_postgresql_host = undef,
|
|
36 | 37 | $replica_target = peadm::get_targets($replica_host, 1)
|
37 | 38 | $replica_postgresql_target = peadm::get_targets($replica_postgresql_host, 1)
|
38 | 39 | $compiler_targets = peadm::get_targets($compiler_hosts)
|
| 40 | + $legacy_compiler_targets = peadm::get_targets($legacy_compilers) |
39 | 41 | $primary_postgresql_target = peadm::get_targets($primary_postgresql_host, 1)
|
40 | 42 |
|
41 | 43 | $all_targets = peadm::flatten_compact([
|
42 | 44 | $primary_target,
|
43 | 45 | $replica_target,
|
44 | 46 | $replica_postgresql_target,
|
45 | 47 | $compiler_targets,
|
| 48 | + $legacy_compiler_targets, |
46 | 49 | $primary_postgresql_target,
|
47 | 50 | ])
|
48 | 51 |
|
|
53 | 56 | $primary_postgresql_host,
|
54 | 57 | $replica_postgresql_host,
|
55 | 58 | $compiler_hosts,
|
| 59 | + $legacy_compilers, |
56 | 60 | )
|
57 | 61 |
|
58 | 62 | out::message('# Gathering information')
|
|
115 | 119 | $index % 2 != 0
|
116 | 120 | }
|
117 | 121 | }
|
| 122 | + $legacy_compiler_a_targets = $legacy_compiler_targets.filter |$index,$target| { |
| 123 | + $exts = $cert_extensions[$target.peadm::certname()] |
| 124 | + if ($exts[peadm::oid('peadm_availability_group')] in ['A', 'B']) { |
| 125 | + $exts[peadm::oid('peadm_availability_group')] == 'A' |
| 126 | + } |
| 127 | + elsif ($exts[peadm::oid('pp_cluster')] in ['A', 'B']) { |
| 128 | + $exts[peadm::oid('pp_cluster')] == 'A' |
| 129 | + } |
| 130 | + else { |
| 131 | + $index % 2 == 0 |
| 132 | + } |
| 133 | + } |
| 134 | + $legacy_compiler_b_targets = $legacy_compiler_targets.filter |$index,$target| { |
| 135 | + $exts = $cert_extensions[$target.peadm::certname()] |
| 136 | + if ($exts[peadm::oid('peadm_availability_group')] in ['A', 'B']) { |
| 137 | + $exts[peadm::oid('peadm_availability_group')] == 'B' |
| 138 | + } |
| 139 | + elsif ($exts[peadm::oid('pp_cluster')] in ['A', 'B']) { |
| 140 | + $exts[peadm::oid('pp_cluster')] == 'B' |
| 141 | + } |
| 142 | + else { |
| 143 | + $index % 2 != 0 |
| 144 | + } |
| 145 | + } |
118 | 146 | }
|
119 | 147 | else {
|
120 | 148 | $compiler_a_targets = $compiler_targets
|
121 | 149 | $compiler_b_targets = []
|
| 150 | + $legacy_compiler_a_targets = $legacy_compiler_targets |
| 151 | + $legacy_compiler_b_targets = [] |
122 | 152 | }
|
123 | 153 |
|
124 | 154 | # Modify csr_attributes.yaml and insert the peadm-specific OIDs to identify
|
|
185 | 215 | add_extensions => {
|
186 | 216 | peadm::oid('pp_auth_role') => 'pe_compiler',
|
187 | 217 | peadm::oid('peadm_availability_group') => 'A',
|
| 218 | + peadm::oid('peadm_legacy_compiler') => 'false', |
188 | 219 | },
|
189 | 220 | )
|
190 | 221 | },
|
|
194 | 225 | add_extensions => {
|
195 | 226 | peadm::oid('pp_auth_role') => 'pe_compiler',
|
196 | 227 | peadm::oid('peadm_availability_group') => 'B',
|
| 228 | + peadm::oid('peadm_legacy_compiler') => 'false', |
| 229 | + }, |
| 230 | + ) |
| 231 | + }, |
| 232 | + background('modify-compilers-a-certs') || { |
| 233 | + run_plan('peadm::modify_certificate', $legacy_compiler_a_targets, |
| 234 | + primary_host => $primary_target, |
| 235 | + add_extensions => { |
| 236 | + peadm::oid('pp_auth_role') => 'pe_compiler', |
| 237 | + peadm::oid('peadm_availability_group') => 'A', |
| 238 | + peadm::oid('peadm_legacy_compiler') => 'true', |
| 239 | + }, |
| 240 | + ) |
| 241 | + }, |
| 242 | + background('modify-compilers-b-certs') || { |
| 243 | + run_plan('peadm::modify_certificate', $legacy_compiler_b_targets, |
| 244 | + primary_host => $primary_target, |
| 245 | + add_extensions => { |
| 246 | + peadm::oid('pp_auth_role') => 'pe_compiler', |
| 247 | + peadm::oid('peadm_availability_group') => 'B', |
| 248 | + peadm::oid('peadm_legacy_compiler') => 'true', |
197 | 249 | },
|
198 | 250 | )
|
199 | 251 | },
|
|
252 | 304 | # completion
|
253 | 305 | run_command('systemctl restart pe-puppetserver.service pe-puppetdb.service',
|
254 | 306 | $all_targets - $primary_target - $primary_postgresql_target - $replica_postgresql_target)
|
| 307 | + |
| 308 | + # Run puppet on all targets again to ensure everything is fully up-to-date |
| 309 | + run_task('peadm::puppet_runonce', $all_targets) |
255 | 310 | }
|
256 | 311 |
|
257 | 312 | return("Conversion to peadm Puppet Enterprise ${arch['architecture']} completed.")
|
|
0 commit comments