Skip to content

Commit

Permalink
Make decommission plan more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
smortex committed Jun 30, 2022
1 parent 55edae0 commit 2416220
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions plans/decommission.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Decommission a node and disconnect it from the Puppet infrastructure
#
# @param nodes The nodes to decommission
plan commission::decommission(TargetSpec $nodes) {
# @param puppetserver The Puppet Server that manage the nodes
plan commission::decommission(
TargetSpec $nodes,
String[1] $puppetserver = 'puppet',
) {
upload_file('commission/motd.decommissioned', '/etc/motd', $nodes, '_run_as' => 'root')

run_task('service', $nodes, 'Stopping puppet', '_run_as' => 'root', 'action' => 'stop', 'name' => 'puppet')
Expand All @@ -14,8 +18,8 @@

run_script('commission/clean-cron-jobs.sh', $nodes, '_run_as' => 'root')

run_task('commission::revoke_certificates', 'puppet', '_run_as' => 'root', 'certificates' => $nodes)
run_task('commission::deactivate_nodes', 'puppet', '_run_as' => 'root', 'nodes' => $nodes)
run_task('commission::revoke_certificates', $puppetserver, '_run_as' => 'root', 'certificates' => $nodes)
run_task('commission::deactivate_nodes', $puppetserver, '_run_as' => 'root', 'nodes' => $nodes)

run_task('package', $nodes, 'Uninstalling puppet-agent', '_run_as' => 'root', 'action' => 'uninstall', 'name' => 'puppet-agent')
}

0 comments on commit 2416220

Please sign in to comment.