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. Setting ensure to 'absent' will remove the package. If your platforms package provider supports purging packages (you can check in the package provider features table) you can specify 'purged' as a value and it should remove the config files along with the package.

See also