Skip to content

Instantly share code, notes, and snippets.

@limed
Created June 14, 2012 22:42
Show Gist options
  • Select an option

  • Save limed/2933452 to your computer and use it in GitHub Desktop.

Select an option

Save limed/2933452 to your computer and use it in GitHub Desktop.
Removes yum packages
# 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