Ask Your Question
0

How to uninstall puppet agent with `puppet apply ...`?

asked 2015-09-24 14:28:52 -0600

Red Cricket gravatar image

Hi,

I do not know if this is a good idea or not, but I get these VM from my system admin that have the 3.3.2 puppet agent installed on them. I need to install the 3.7.2 puppet agent. To uninstall I download the 3.3.2 installation files from https://puppetlabs.com/misc/pe-files/previous-releases/3.3.2, untar it and run ./puppet-enterprise-uninstaller -pyd. Then install the 3.7.2 puppet agent like so:

curl -k https://my-pm-001:8140/packages/current/install.bash | bash ; puppet agent -t

I was wondering if there was a way to write a puppet class that could perform the download of the 3.3.2 installation files, untar it, and run ./puppet-enterprise-uninstaller -pyd? Maybe something like ...

class puppet_agent_begon {
    exec { 'wget http://pm.puppetlabs.com/puppet-enterprise/3.3.2/puppet-enterprise-3.3.2-el-7-x86_64.tar.gz':
        ...
    } -> 
    exec {'tar -xzf puppet-enterprise-3.3.2-el-7-x86_64.tar.gz':
        ...
    } -> 
    exec {'puppet-enterprise-3.3.2-el-7-x86_64/puppet-enterprise-uninstaller -pyd':
        ...
    }
}

I would like to be able to invoke the class like this: # puppet apply -e 'include puppet_agent_begone'.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2015-09-25 04:09:44 -0600

why not:

add puppet repos on all server (or add puppet rpms to your own repos) <= can do this via puppet install yum-versionlock if you want to pin to a specific version of puppet and not the latest for the puppet rpm use ensure => latest

this will ensure latest puppet rpm is on all boxes (saves having to manually do it) - also gives you a path in future to do any other upgrades tou may need.

i would recommend not using puppet to run puppet uninstaller - can see that getting messy.

edit flag offensive delete link more

Comments

Thank you for your answer. I wish I had control of the repos or how the initial images of the systems I use are created. Maybe what puppet agent needs is a self destruct button `puppet agent --self-destruct` which would remove puppet and any associated artifacts.

Red Cricket gravatar imageRed Cricket ( 2015-09-25 21:44:53 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-09-24 14:28:52 -0600

Seen: 1,059 times

Last updated: Sep 25 '15