Skip to content

Add an experimental peadm::uninstall plan #195

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 7 commits into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions plans/uninstall.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# @summary Single-entry-point plan for uninstalling Puppet Enterprise

plan peadm::uninstall (
Peadm::SingleTargetSpec $primary_host,
) {
peadm::assert_supported_bolt_version()

$primary_target = peadm::get_targets($primary_host, 1)
$uninstall_result = run_task('peadm::pe_uninstall', $primary_target)

return([$uninstall_result])
}

12 changes: 12 additions & 0 deletions spec/plans/uninstall_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'spec_helper'

describe 'peadm::uninstall' do
include BoltSpec::Plans

describe 'basic functionality' do
it 'runs peadm::uninstall successfully with only primary_host as parameter' do
expect_task('peadm::pe_uninstall')
expect(run_plan('peadm::uninstall', 'primary_host' => 'primary')).to be_ok
end
end
end
9 changes: 9 additions & 0 deletions tasks/pe_uninstall.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"description": "Uninstall Puppet Enterprise",
"parameters": {
},
"input_method": "environment",
"implementations": [
{"name": "pe_uninstall.sh"}
]
}
13 changes: 13 additions & 0 deletions tasks/pe_uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# Uninstalling PE with the following flags
# For more information about the uninstaller
# and the command-line flags, visit:
# https://puppet.com/docs/pe/2019.8/uninstalling.html

if [ -x "$(command -v /opt/puppetlabs/bin/puppet-enterprise-uninstaller)" ]; then
/opt/puppetlabs/bin/puppet-enterprise-uninstaller -d -p -y
else
echo 'Error: puppet-enterprise-uninstaller is not available on this target.'
exit 1
fi