Forge Home

minimum_version

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

4,103 downloads

2,940 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

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
  • , , , , , , , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'puppetlabs-minimum_version', '1.0.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add puppetlabs-minimum_version
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install puppetlabs-minimum_version --version 1.0.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

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
}