Skip to content

Improve predictability of peadm::add_compiler #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions plans/add_compiler.pp
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,20 @@
run_task('peadm::agent_install', $compiler_target,
server => $primary_target.peadm::certname(),
install_flags => $dns_alt_names_flag + [
'--puppet-service-ensure', 'stopped',
"extension_requests:${peadm::oid('pp_auth_role')}=pe_compiler",
"extension_requests:${peadm::oid('peadm_availability_group')}=${avail_group_letter}",
"main:certname=${compiler_target.peadm::certname()}",
],
)

# On <compiler-host>, run the puppet agent
# ignoring errors to simplify logic
run_task('peadm::puppet_runonce', $compiler_target, {'_catch_errors' => true})

# If necessary, manually submit a CSR
# ignoring errors to simplify logic
run_task('peadm::submit_csr', $compiler_target, {'_catch_errors' => true})

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

# On <compiler-host>, run the puppet agent
run_task('peadm::puppet_runonce', $compiler_target)

# If there was already a signed cert, force the certificate extensions we want
# TODO: update peadm::util::add_cert_extensions to take care of dns alt names
run_plan('peadm::util::add_cert_extensions', $compiler_target,
Expand All @@ -77,11 +71,17 @@
},
)

# On <compiler-host>, run the puppet agent
run_task('peadm::puppet_runonce', $compiler_target)

# On <primary_postgresql_host> run the puppet agent
run_task('peadm::puppet_runonce', $primary_postgresql_target)

# On <primary_postgresql_host> start puppet.service
run_command('systemctl start puppet.service', $primary_postgresql_target)
run_command('systemctl start puppet.service', peadm::flatten_compact([
$primary_postgresql_target,
$compiler_target,
])

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

Expand Down