Skip to content

Commit d7f99ad

Browse files
committed
Update version to 1.0.0; add docs for conversion
This commit adds documentation for converting a stack deployed with peadm 0.5.x to be compatible with changes in the 1.x version of the module.
1 parent e05bfd6 commit d7f99ad

File tree

5 files changed

+94
-7
lines changed

5 files changed

+94
-7
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ Reference:
2222
* [Classification](documentation/classification.md)
2323
* [Architectures](documentation/architectures.md)
2424
* [Testing](documentation/pre_post_checks.md)
25+
* [Converting From Old Versions of peadm](documentation/old_versions_of_peadm.md)
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Old Versions of Puppet Enterprise (pe) Administration (adm) Module
2+
3+
Prior to the 1.0.0 release of peadm, the pp\_application and pp\_cluster trusted facts were used to identify peadm server roles and availability groups. In order to avoid conflict with customer use of these trusted facts, in 1.0.0 peadm switched to using its own custom OID trusted facts for the purpose instead.
4+
5+
Puppet Enterprise systems deployed with peadm 1.0.0 will use the correct trusted facts, but any system deployed with peadm 0.5.x or older will still be relying on pp\_application and pp\_cluster. It is recommended that for these systems, you either A) continue to use an older version of peadm to perform upgrades; B) deploy new PE infrastructure using a 1.0.0 version of peadm or newer; or C) use the peadm::misc::upgrade\_trusted\_facts plan to re-issue certificates for each server to include the new custom OID trusted facts.
6+
7+
8+
Prepare to run the plan against all servers in the PE infrastructure, using a params.json file such as this one:
9+
10+
```json
11+
{
12+
"master_host": "pe-xl-core-0.lab1.puppet.vm",
13+
"targets": [
14+
"pe-xl-core-0.lab1.puppet.vm",
15+
"pe-xl-core-1.lab1.puppet.vm",
16+
"pe-xl-core-2.lab1.puppet.vm",
17+
"pe-xl-core-3.lab1.puppet.vm",
18+
"pe-xl-compiler-0.lab1.puppet.vm",
19+
"pe-xl-compiler-1.lab1.puppet.vm"
20+
],
21+
}
22+
```
23+
24+
Run the plan. Note that this cannot be done using the Orchestrator transport; it must be performed over ssh.
25+
26+
```
27+
bolt plan run peadm::misc::upgrade_trusted_facts --params @params.json
28+
```
29+
30+
To complete the conversion, the PE node groups in the console should be updated to use the new trusted fact OIDs, and not pp\_application or pp\_cluster anymore. This can be accomplished by re-applying the peadm::setup::node\_manager class to the master.
31+
32+
Tip: use the `--noop` flag to validate that the changes which will be made are the changes expected before applying the configuration change.
33+
34+
```
35+
bolt apply --target pe-xl-core-0.lab1.puppet.vm -e <<EOF
36+
37+
file { 'node_manager.yaml':
38+
ensure => file,
39+
mode => '0644',
40+
path => Deferred('peadm::node_manager_yaml_location'),
41+
content => epp('peadm/node_manager.yaml.epp', {
42+
server => 'pe-xl-core-0.lab1.puppet.vm',,
43+
}),
44+
}
45+
46+
class { 'peadm::setup::node_manager':
47+
master_host => 'pe-xl-core-0.lab1.puppet.vm',
48+
master_replica_host => 'pe-xl-core-2.lab1.puppet.vm',
49+
puppetdb_database_host => 'pe-xl-core-1.lab1.puppet.vm',
50+
puppetdb_database_replica_host => 'pe-xl-core-3.lab1.puppet.vm',
51+
compiler_pool_address => 'puppet.lab1.puppet.vm',
52+
require => File['node_manager.yaml'],
53+
}
54+
55+
EOF
56+
```

metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "puppetlabs-peadm",
3-
"version": "0.5.2",
3+
"version": "1.0.0",
44
"author": "Puppet Labs Solutions Architecture",
55
"summary": "Bolt plans used to deploy an at-scale Puppet Enterprise architecture",
66
"license": "Apache-2.0",

plans/misc/upgrade_trusted_facts.pp

+26-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
$all_targets = peadm::get_targets($targets)
99
$master_target = peadm::get_targets($master_host, 1)
1010

11+
# This plan doesn't work over the orchestrator due to certificates being revoked.
12+
$all_targets.peadm::fail_on_transport('pcp')
13+
1114
$certdata = run_task('peadm::trusted_facts', $all_targets).reduce({}) |$memo,$result| {
1215
# Keep the the OID-form trusted fact key/value pairs. If we accidentally
1316
# include an OID and also a shortname that resolves to the same OID,
@@ -35,15 +38,32 @@
3538

3639
run_command("${pserver} ca clean --certname ${certdata[$target]['certname']}", $master_target)
3740
run_command("${puppet} ssl clean --certname ${certdata[$target]['certname']}", $target)
38-
run_command("${puppet} ssl submit_request --certname ${certdata[$target]['certname']}", $target)
39-
40-
ctrl::sleep(2) # some lag sometimes before the cert is available to sign
4141

42-
if !$autosign {
43-
run_command("${pserver} ca sign --certname ${certdata[$target]['certname']}", $master_target)
42+
# The procedure for regenerating an agent's cert
43+
if ($target != $master_target) {
44+
run_command("${puppet} ssl submit_request --certname ${certdata[$target]['certname']}", $target)
45+
ctrl::sleep(2) # some lag sometimes before the cert is available to sign
46+
if !$autosign {
47+
run_command("${pserver} ca sign --certname ${certdata[$target]['certname']}", $master_target)
48+
}
49+
run_command("${puppet} ssl download_cert --certname ${certdata[$target]['certname']}", $target)
4450
}
4551

46-
run_command("${puppet} ssl download_cert --certname ${certdata[$target]['certname']}", $target)
52+
# The procedure for regenerating the master's cert
53+
else {
54+
$alt_names_flag = $certdata[$target]['dns-alt-names'] ? {
55+
undef => '',
56+
default => "--subject-alt-names ${certdata[$target]['dns-alt-names'].join(',')}",
57+
}
58+
run_task('service', $target, {action => 'stop', name => 'pe-puppetserver'})
59+
run_command(@("HEREDOC"/L), $master_target)
60+
${pserver} ca generate \
61+
--certname ${certdata[$target]['certname']} \
62+
${alt_names_flag} \
63+
--ca-client \
64+
| HEREDOC
65+
run_task('service', $target, {action => 'start', name => 'pe-puppetserver'})
66+
}
4767
}
4868

4969
}

plans/upgrade.pp

+10
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@
5353
$memo + { $result.target => $result['extensions'] }
5454
}
5555

56+
# Ensure needed trusted facts are available
57+
if $trusted_facts.any |$t,$ext| { $ext[peadm::oid('peadm_role')] == undef } {
58+
fail_plan(@(HEREDOC/L))
59+
Required trusted facts are not present; upgrade cannot be completed. If \
60+
this infrastructure was provisioned with an old version of peadm, you may \
61+
need to run the peadm::misc::upgrade_trusted_facts plan against each of the \
62+
infrastructure nodes.
63+
| HEREDOC
64+
}
65+
5666
# Determine which compilers are associated with which HA group
5767
$compiler_m1_targets = $compiler_targets.filter |$target| {
5868
($trusted_facts[$target][peadm::oid('peadm_availability_group')]

0 commit comments

Comments
 (0)