package_alternatives

pdk
Package wrapper for easy work with different package names across platforms

CERIT Scientific Cloud

ceritsc

11,772 downloads

4,681 latest version

5.0 quality score

Version information

  • 1.0.3 (latest)
  • 1.0.2
  • 1.0.1
  • 1.0.0
  • 0.9.5
  • 0.9.4
  • 0.9.3
  • 0.9.2
  • 0.9.1
  • 0.9.0
released Apr 27th 2018
This version is compatible with:
  • Puppet Enterprise 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 4.7.0 < 6.0.0
  • RedHat, CentOS, Scientific, OracleLinux, Fedora, SLES, SLED, Debian, Ubuntu

Start using this module

Tags: package

Documentation

ceritsc/package_alternatives — version 1.0.3 Apr 27th 2018

Puppet package_alternatives module

This module provides a defined type package_alternatives for easy installation of software packages with different (alternative) names across platforms.

Requirements

Module has been tested on:

  • Puppet 5.5
  • Debian and Red Hat family systems

Required modules:

Quick Start

Full configuration options:

package_alternatives { 'resource title':
  ensure       => ...,         # Resource package ensure state
  fail_missing => boolean,     # Fail on no alternative package.
  alternatives => string|hash, # Structure with package alternatives.
  platform     => string,      # Current platform detection override.
}

Software alternatives structure

$alternatives accepts:

  • string for no alternative (defaults to resource $title)

  • hash of platforms and alternative package names, e.g.:

$software = {
  'debian' => 'openssh-client',
  'redhat' => 'openssh-clients'
}
  • hash of resource names with with hash or string containing package name or platforms hash of alternatives, e.g.:
$software = {
  'bash' => 'bash',
  'openssh-client' => {
    'debian' => 'openssh-client',
    'redhat' => 'openssh-clients',
  }
}

Platforms resolution order

Lower cased:

  1. Custom $platform parameter
  2. ${::operatingsystem}-${::operatingsystemrelease}-${::architecture} (centos-6.4-x86_64)
  3. ${::operatingsystem}-${::operatingsystemrelease} (centos-6.4)
  4. ${::operatingsystem}-${::operatingsystemmajrelease}-${::architecture} (centos-6-x86_64)
  5. ${::operatingsystem}-${::operatingsystemmajrelease} (centos-6)
  6. ${::operatingsystem}-${::architecture} (centos-x86_64)
  7. ${::operatingsystem} (centos)
  8. ${::osfamily}-${::operatingsystemrelease}-${::architecture} (redhat-6.4-x86_64)
  9. ${::osfamily}-${::operatingsystemrelease} (redhat-6.4)
  10. ${::osfamily}-${::operatingsystemmajrelease}-${::architecture} (redhat-6-x86_64)
  11. ${::osfamily}-${::operatingsystemmajrelease} (redhat-6)
  12. ${::osfamily}-${::architecture} (redhat-x86_64)
  13. ${::osfamily} (redhat)

Software alternatives structure

Parameter $alternatives accepts:

  • string for no alternative (defaults to resource $title)
$software = 'bash'
  • hash of platforms and alternative package names, e.g.:
$software = {
  'debian' => 'openssh-client',
  'redhat' => 'openssh-clients'
}
  • hash of resource names with with hash or string containing package name or platforms hash of alternatives, e.g.:
$software = {
  'bash' => 'bash',
  'openssh-client' => {
    'debian' => 'openssh-client',
    'redhat' => 'openssh-clients',
  }
}

Example

$software = {
  'rsync'  => 'rsync',          # same name on all platforms
  'ash'    => {
    'debian'   => 'ash'         # just Debian supported
  },
  'tshark' => {
    'debian-6' => 'tshark',     # just Debian 6 and any
    'redhat'   => 'wireshark',  # RedHat family supported
  },
}

package_alternatives { keys($software):
  ensure       => present,
  alternatives => $software,
  fail_missing => false,       # skip packages with no alternative on platform
}

CERIT Scientific Cloud, support@cerit-sc.cz