A collection of task oriented solutions in Puppet

 

Remove a package

Challenge

You want to remove a package

Solution

class remove_package {

  # remove a package but leave its config files alone
  package { 'screen':
    ensure => 'absent',
  }

  # remove a package and purge its config files
  package { 'screen':
    ensure => 'purged',
  }

}

Explanation

Removing a package via Puppet is as simple as installing one. Simply setting "ensure" to "absent" will remove the package. If your platforms package provider supports purging packages (you can check in the table under packages then you can specify "Purged" as a value and it should remove the config files along with the package.

See also