minimum_version

pdk
A function to enable specifying a minimum version in your Package declarations
Puppet

Puppet

puppetlabs

2,172 downloads

1,103 latest version

5.0 quality score

Version information

  • 1.0.1 (latest)
  • 1.0.0
released Jul 13th 2020
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x
  • Puppet >= 5.5.1 < 7.0.0
  • CentOS
    ,
    OracleLinux
    ,
    RedHat
    ,
    Scientific
    ,
    Debian
    ,
    Ubuntu
    ,
    Fedora
    ,
    Darwin
    ,
    SLES
    ,
    Solaris
    ,
    windows

Start using this module

Documentation

puppetlabs/minimum_version — version 1.0.1 Jul 13th 2020

puppetlabs-minimum_version

This module is for use specifically with Puppet Enterprise, as it depends on the Package Manager capability in PE to inventory the currently installed versions of software packages.

About minimum_version()

Return the package version for a given package that is at least the given minimum version The function will compare the currently installed package with the given minimum version and:

  • return the minimum version if the installed package is less than the minimum version, or not present
  • return the installed version if the installed package is the same or newer than the minimum version If the optional 'installversion' parameter is set, a different version than the minimum version can be returned

Note: To use this module, Package Inventory must be enabled in PE!

Usage

# Ensure at least version 2.7.5-77.el7_6 of python is installed
package { 'python':
   ensure => minimum_version('python', '2.7.5-77.el7_6')
}

To install the latest version if the minimum version is not met:

# Ensure the latest version of python is installed if it is not at least version 2.7.5-77.el7_6
package { 'python':
  ensure => minimum_version('python', '2.7.5-77.el7_6', 'latest')
}

To specify a specific provider, you also have to provide a value for 'installversion':

# Ensure at least version 2.1.2 of the openssl gem is installed
package { 'openssl':
  ensure   => minimum_version('openssl', '2.1.2', '2.1.2', 'gem'),
  provider => gem
}

To specify all options:

# Ensure the latest version of the openssl gem is installed if it is not at least version 2.1.2
package { 'openssl':
   ensure   => minimum_version('openssl', '2.1.2', 'latest', 'gem'),
   provider => gem
}