Created
June 14, 2012 22:42
-
-
Save limed/2933452 to your computer and use it in GitHub Desktop.
Removes yum packages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Remove a yum package via exec, this is done this way because | |
| # package { 'foo': ensure => purged; } keeps getting called on every | |
| # puppet run. We can't use ensure => absent because of an issue with | |
| # circular dependencies | |
| define yum::remove( | |
| $package = $name, | |
| $ensure = 'absent') { | |
| if ($ensure in ['absent', 'purged']) { | |
| exec { "purge_${package}": | |
| path => "/usr/bin:/usr/sbin:/bin:/sbin", | |
| command => "yum remove -y ${package}", | |
| onlyif => "rpm -qa ${package} | grep -i ${package}", | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment