Skip to content

Commit 7e183ce

Browse files
timidrireidmv
authored andcommitted
Improve predictability of peadm::add_compiler
Ensure on agent install that the agent is not running. This makes the rest of the plan more durable, since unexpected agent runs won't interrupt what we're doing.
1 parent 1365215 commit 7e183ce

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Diff for: plans/add_compiler.pp

+8-8
Original file line numberDiff line numberDiff line change
@@ -47,26 +47,20 @@
4747
run_task('peadm::agent_install', $compiler_target,
4848
server => $primary_target.peadm::certname(),
4949
install_flags => $dns_alt_names_flag + [
50+
'--puppet-service-ensure', 'stopped',
5051
"extension_requests:${peadm::oid('pp_auth_role')}=pe_compiler",
5152
"extension_requests:${peadm::oid('peadm_availability_group')}=${avail_group_letter}",
5253
"main:certname=${compiler_target.peadm::certname()}",
5354
],
5455
)
5556

56-
# On <compiler-host>, run the puppet agent
57-
# ignoring errors to simplify logic
58-
run_task('peadm::puppet_runonce', $compiler_target, {'_catch_errors' => true})
59-
6057
# If necessary, manually submit a CSR
6158
# ignoring errors to simplify logic
6259
run_task('peadm::submit_csr', $compiler_target, {'_catch_errors' => true})
6360

6461
# On primary, if necessary, sign the certificate request
6562
run_task('peadm::sign_csr', $primary_target, { 'certnames' => [$compiler_target.peadm::certname()] } )
6663

67-
# On <compiler-host>, run the puppet agent
68-
run_task('peadm::puppet_runonce', $compiler_target)
69-
7064
# If there was already a signed cert, force the certificate extensions we want
7165
# TODO: update peadm::util::add_cert_extensions to take care of dns alt names
7266
run_plan('peadm::util::add_cert_extensions', $compiler_target,
@@ -77,11 +71,17 @@
7771
},
7872
)
7973

74+
# On <compiler-host>, run the puppet agent
75+
run_task('peadm::puppet_runonce', $compiler_target)
76+
8077
# On <primary_postgresql_host> run the puppet agent
8178
run_task('peadm::puppet_runonce', $primary_postgresql_target)
8279

8380
# On <primary_postgresql_host> start puppet.service
84-
run_command('systemctl start puppet.service', $primary_postgresql_target)
81+
run_command('systemctl start puppet.service', peadm::flatten_compact([
82+
$primary_postgresql_target,
83+
$compiler_target,
84+
])
8585

8686
return("Adding or replacing compiler ${$compiler_target.peadm::certname()} succeeded.")
8787

0 commit comments

Comments
 (0)