A collection of task oriented solutions in Puppet

 

Install and track the newest version of a package

Challenge

You want to install a package if it's not present and track and upgrade the version if it is.

Solution

class screen {

  package { 'screen':
    ensure => 'latest',
  }

}

Explanation

Sometimes just having a package present isn't enough, you also want to ensure it stays up to date. By specifying latest Puppet will install a package if it is not already installed, and upgrade the package to newer versions when they become available. This last part is where latest differs from installed.