yum

YUM utilities

65,648,627 downloads

2,190 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

  • 7.3.0 (latest)
  • 7.2.0
  • 7.1.0
  • 7.0.0
  • 6.2.0
  • 6.1.0
  • 6.0.0
  • 5.6.1
  • 5.6.0
  • 5.5.0
  • 5.4.0
  • 5.3.1
  • 5.3.0
  • 5.2.0
  • 5.1.0
  • 5.0.0
  • 4.3.0
  • 4.2.0
  • 4.1.1
  • 4.1.0
  • 4.0.0
  • 3.1.1
  • 3.1.0
  • 3.0.0
  • 2.2.1
  • 2.2.0
  • 2.1.0
  • 2.0.2
  • 2.0.1
  • 2.0.0
  • 1.0.0
  • 0.10.0
  • 0.9.15
  • 0.9.14
released Mar 9th 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.8 < 7.0.0
  • , , , , , ,
Tasks:
  • yum

Start using this module

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

Add this module to your Puppetfile:

mod 'puppet-yum', '4.1.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add puppet-yum
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install puppet-yum --version 4.1.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

puppet/yum — version 4.1.1 Mar 9th 2020

Reference

Table of Contents

Classes

  • yum: A class to install and manage Yum configuration.
  • yum::clean: A $(yum clean all) Exec to be notified if desired.
  • yum::plugin::versionlock: Class: yum::plugin::versionlock This class installs versionlock plugin Parameters: [ensure] - specifies if versionlock should be presen

Defined types

  • yum::config: Define: yum::config This definition manages yum.conf Parameters: [key] - alternative conf. key (defaults to name) [ensure] -
  • yum::gpgkey: Define: yum::gpgkey This definition saves and imports public GPG key for RPM. Key can be stored on Puppet's fileserver or as inline content.
  • yum::group: Define: yum::group This definition installs or removes yum package group. Parameters: [ensure] - specifies if package group should be
  • yum::install: Define: yum::install This definition installs or removes rpms from local file or URL via yum install command. This can be better than using
  • yum::plugin: Define: yum::plugin This definition installs Yum plugin. Parameters: [ensure] - specifies if plugin should be present or absent Acti
  • yum::versionlock: Locks package from updates.

Functions

  • yum::bool2num_hash_recursive: This functions converts the Boolean values of a Hash to Integers, either '0' or '1'. It does this recursively, decending as far as the langu

Data types

  • Yum::VersionlockString: This type matches strings appropriate for use with yum-versionlock. Its basic format, using the rpm(8) query string format, is `%{EPOCH}:%{

Tasks

  • init: Allows you to perform yum functions

Classes

yum

A class to install and manage Yum configuration.

Examples

Enable management of the default repos for a supported OS:
```yaml
---
yum::manage_os_default_repos: true

##### Add Hiera data to disable *management* of the CentOS Base repo:

```puppet
```yaml
---
yum::manage_os_default_repos: true
yum::repo_exclusions:
    - 'base'

##### Ensure the CentOS base repo is removed from the agent system(s):

```puppet
```yaml
---
yum::manage_os_default_repos: true
yum::repos:
    base:
        ensure: 'absent'

##### Add a custom repo:

```puppet
```yaml
---
yum::managed_repos:
    - 'example_repo'
yum::repos:
    example_repo:
        ensure: 'present'
        enabled: true
        descr: 'Example Repo'
        baseurl: 'https://repos.example.com/example/'
        gpgcheck: true
        gpgkey: 'file:///etc/pki/gpm-gpg/RPM-GPG-KEY-Example'
        target: '/etc/yum.repos.d/example.repo'

##### Use a custom `baseurl` for the CentOS Base repo:

```puppet
```yaml
---
yum::manage_os_default_repos: true
yum::repos:
    base:
        baseurl: 'https://repos.example.com/CentOS/base/'
        mirrorlist: '--'

#### Parameters

The following parameters are available in the `yum` class.

##### `clean_old_kernels`

Data type: `Boolean`

Whether or not to purge old kernel version beyond the `keeponly_limit`.

Default value: `true`

##### `keep_kernel_devel`

Data type: `Boolean`

Whether or not to keep kernel devel packages on old kernel purge.

Default value: `false`

##### `config_options`

Data type: `Hash[String, Variant[String, Integer, Boolean, Hash[String, Variant[String, Integer, Boolean]]]]`

A Hash where keys are the names of `Yum::Config` resources and the values
are either the direct `ensure` value, or a Hash of the resource's attributes.

@note Boolean parameter values will be converted to either a `1` or `0`; use a quoted string to
  get a literal `true` or `false`.

Default value: { }

##### `repos`

Data type: `Optional[Hash[String, Optional[Hash[String, Variant[String, Integer, Boolean]]]]]`

A hash where keys are the names of `Yumrepo` resources and each value represents its respective
Yumrepo's resource parameters.  This is used in conjunction with the `managed_repos` parameter
to create `Yumrepo` resources en masse.  Some default data is provided for this using module
data.  It is configured to deep merge with a `knockout_prefix` of `--` by default, so individual
parameters may be overriden or removed via global or environment Hiera data.

@note Boolean parameter values will be converted to either a `1` or `0`; use a quoted string to
  get a literal `true` or `false`.

Default value: {}

##### `managed_repos`

Data type: `Array[String]`

An array of first-level keys from the `repos` hash to include in the catalog.  The module uses
this list to select `Yumrepo` resources from the `repos` hash for instantiation.  Defaults are
set in the module's Hiera data.

@note This only indicates the *managed* state of the repos, the `ensure` state must be managed
  in the `repos` data.

Default value: []

##### `manage_os_default_repos`

Data type: `Boolean`

Whether or not to add an operating system's default repos to the `managed_repos` array.

@note This only works for operating systems with data in the module's data directory.  Currently
  the module only contains data for for CentOS 6 & 7.

Default value: `false`

##### `os_default_repos`

Data type: `Array[String]`

A list of default repos to add to `managed_repos` if `manage_os_default_repos` is enabled.
Normally this should not be modified.

Default value: []

##### `repo_exclusions`

Data type: `Array[String]`

An array of first-level keys from the `repos` hash to exclude from management via this module.
Values in this array will be subtracted from the `managed_repos` array as a last step before
instantiation.

Default value: []

##### `gpgkeys`

Data type: `Hash[String, Hash[String, String]]`

A hash of yum::gpgkey types, which will be automatically included if they
are referenced by a managed_repo. This will use the same merging behavior
as repos.

Default value: {}

##### `utils_package_name`

Data type: `String`

Name of the utils package, e.g. 'yum-utils', or 'dnf-utils'.

Default value: 'yum-utils'

### yum::clean

A $(yum clean all) Exec to be notified if desired.

### yum::plugin::versionlock

Class: yum::plugin::versionlock

This class installs versionlock plugin

Parameters:
  [*ensure*] - specifies if versionlock should be present or absent
  [*clean*] - specifies if yum clean all should be called after edits. Defaults false.

Actions:

Requires:

Sample usage:
  include yum::plugin::versionlock

#### Parameters

The following parameters are available in the `yum::plugin::versionlock` class.

##### `ensure`

Data type: `Enum['present', 'absent']`



Default value: 'present'

##### `path`

Data type: `String`



Default value: '/etc/yum/pluginconf.d/versionlock.list'

##### `clean`

Data type: `Boolean`



Default value: `false`

## Defined types

### yum::config

Define: yum::config

This definition manages yum.conf

Parameters:
  [*key*]      - alternative conf. key (defaults to name)
  [*ensure*]   - specifies value or absent keyword
  [*section*]  - config section (default to main)

Actions:

Requires:
  RPM based system

Sample usage:
  yum::config { 'installonly_limit':
    ensure => 2,
  }

  yum::config { 'debuglevel':
    ensure => absent,
  }

#### Parameters

The following parameters are available in the `yum::config` defined type.

##### `ensure`

Data type: `Variant[Boolean, Integer, Enum['absent'], String]`



##### `key`

Data type: `String`



Default value: $title

### yum::gpgkey

Define: yum::gpgkey

This definition saves and imports public GPG key for RPM. Key can
be stored on Puppet's fileserver or as inline content. Key can be
also removed from system.

Parameters:
  [*path*]     - alternative file location (defaults to name)
  [*ensure*]   - specifies if key should be present or absent
  [*content*]  - content
  [*source*]   - source (e.g.: puppet:///)
  [*owner*]    - file owner
  [*group*]    - file group
  [*mode*]     - file mode

Actions:

Requires:
  RPM based system

Sample usage:
  yum::gpgkey { '/etc/pki/rpm-gpg/RPM-GPG-KEY-puppet-smoketest1':
    ensure  => 'present',
    content => '-----BEGIN PGP PUBLIC KEY BLOCK-----
  ...
  -----END PGP PUBLIC KEY BLOCK-----';
  }

#### Parameters

The following parameters are available in the `yum::gpgkey` defined type.

##### `path`

Data type: `String`



Default value: $name

##### `ensure`

Data type: `Enum['present', 'absent']`



Default value: 'present'

##### `content`

Data type: `Optional[String]`



Default value: `undef`

##### `source`

Data type: `Optional[String]`



Default value: `undef`

##### `owner`

Data type: `String`



Default value: 'root'

##### `group`

Data type: `String`



Default value: 'root'

##### `mode`

Data type: `String`



Default value: '0644'

### yum::group

Define: yum::group

This definition installs or removes yum package group.

Parameters:
  [*ensure*]   - specifies if package group should be
                 present (installed) or absent (purged)
  [*timeout*]  - exec timeout for yum groupinstall command
  [*install_options*]  - options provided to yum groupinstall command

Actions:

Requires:
  RPM based system

Sample usage:
  yum::group { 'X Window System':
    ensure  => 'present',
  }

#### Parameters

The following parameters are available in the `yum::group` defined type.

##### `install_options`

Data type: `Array[String[1]]`



Default value: []

##### `ensure`

Data type: `Enum['present', 'installed', 'latest', 'absent', 'purged']`



Default value: 'present'

##### `timeout`

Data type: `Optional[Integer]`



Default value: `undef`

### yum::install

Define: yum::install

This definition installs or removes rpms from local file or URL via
yum install command. This can be better than using just the rpm
provider because it will pull all the dependencies.

Parameters:
  [*ensure*] - specifies if package group should be
               present (installed) or absent (purged)
  [*source*] - file or URL where RPM is available

Actions:

Requires:
  RPM based system

Sample usage:
  yum::install { 'epel-release':
    ensure => 'present',
    source => 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm',
  }

#### Parameters

The following parameters are available in the `yum::install` defined type.

##### `source`

Data type: `String`



##### `ensure`

Data type: `Enum['present', 'installed', 'absent', 'purged']`



Default value: 'present'

##### `timeout`

Data type: `Optional[Integer]`



Default value: `undef`

### yum::plugin

Define: yum::plugin

This definition installs Yum plugin.

Parameters:
  [*ensure*]   - specifies if plugin should be present or absent

Actions:

Requires:
  RPM based system

Sample usage:
  yum::plugin { 'versionlock':
    ensure  => 'present',
  }

#### Parameters

The following parameters are available in the `yum::plugin` defined type.

##### `ensure`

Data type: `Enum['present', 'absent']`



Default value: 'present'

##### `pkg_prefix`

Data type: `Optional[String]`



Default value: `undef`

##### `pkg_name`

Data type: `Optional[String]`



Default value: `undef`

### yum::versionlock

Locks package from updates.

* **Note** The resource title must use the format
"%{EPOCH}:%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}".  This can be retrieved via
the command `rpm -q --qf '%{EPOCH}:%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}'.
If "%{EPOCH}" returns as '(none)', it should be set to '0'.  Wildcards may
be used within token slots, but must not cover seperators, e.g.,
'0:b*sh-4.1.2-9.*' covers Bash version 4.1.2, revision 9 on all
architectures.

* **See also**
http://man7.org/linux/man-pages/man1/yum-versionlock.1.html

#### Examples

##### Sample usage

```puppet
yum::versionlock { '0:bash-4.1.2-9.el6_2.*':
  ensure => present,
}

Parameters

The following parameters are available in the yum::versionlock defined type.

ensure

Data type: Enum['present', 'absent', 'exclude']

Specifies if versionlock should be present, absent or exclude.

Default value: 'present'

Functions

yum::bool2num_hash_recursive

Type: Puppet Language

This functions converts the Boolean values of a Hash to Integers, either '0' or '1'. It does this recursively, decending as far as the language implemenation will allow. Note that Structs and Arrays will be ignored, even if they contain Hashes.

Examples

Usage

```puppet
Hash $foo = {
  bar => { 'a' => true, 'b' => 'b' },
  baz => false,
  qux => [{ 'c' => true }, { 'd' => false }],
}

yum::bool2num_hash_recursive($foo)

The above would return:

{
  bar => { 'a' => 1, 'b' => 'b' },
  baz => 0,
  qux => [{ 'c' => true }, { 'd' => false }],
}

#### `yum::bool2num_hash_recursive(Hash $arg)`

This functions converts the Boolean values of a Hash to Integers,
either '0' or '1'.  It does this recursively, decending as far as the
language implemenation will allow.  Note that Structs and Arrays will
be ignored, even if they contain Hashes.

Returns: `Hash`

##### Examples

###### Usage

```puppet

```puppet
Hash $foo = {
  bar => { 'a' => true, 'b' => 'b' },
  baz => false,
  qux => [{ 'c' => true }, { 'd' => false }],
}

yum::bool2num_hash_recursive($foo)

The above would return:

{
  bar => { 'a' => 1, 'b' => 'b' },
  baz => 0,
  qux => [{ 'c' => true }, { 'd' => false }],
}

##### `arg`

Data type: `Hash`

The hash on which to operate

## Data types

### Yum::VersionlockString

This type matches strings appropriate for use with yum-versionlock.
Its basic format, using the `rpm(8)` query string format, is
`%{EPOCH}:%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}`.  As a Regex, it
breaks down into five distinct parts, plus the seperators.

  # EPOCH: An unsigned integer
  type Yum::PackageEpoch   = Regexp[/[0-9]\*]+/]

  # NAME: Any valid package name (see https://github.com/rpm-software-management/rpm/blob/master/doc/manual/spec)
  type Yum::PackageName    = Regexp[/[0-9a-zA-Z\._\+%\{\}\*-]+/]

  # VERSION: Any valid version string. The only limitation here, according to the RPM manual, is that it may not contain a dash (`-`).
  type Yum::PackageVersion = Regexp[/[^-]+/]

  # RELEASE: Any valid release string. Only limitation is that it is not a dash (`-`)
  type Yum::PackageRelease = Regexp[/[^-]+/]

  # ARCH: Matches a string such as `el7.x86_64`.  This is actuall two sub-expressions.  See below.
  type Yum::PackageArch    = Regexp[/([0-9a-zZ-Z_\*]+)(?:\.(noarch|x86_64|i386|arm|ppc64|ppc64le|sparc64|ia64|alpha|ip|m68k|mips|mipsel|mk68k|mint|ppc|rs6000|s390|s390x|sh|sparc|xtensa|\*))?/]

The `%{ARCH}` sub-expression is composed of two sub-expressions
separated by a dot (`.`), where the second part is optional.  The RPM
specification calls the first field the `DistTag`, and the second the
`BuildArch`.

   # DistTag: Any string consiting of only letters, numbers, or an underscore, e.g., `el6`, `sl7`, or `fc24`.
   type Yum::PackageDistTag   = Regexp[/[0-9a-zZ-Z_\*]+/]

   # BuildArch: Any string from the list at https://github.com/rpm-software-management/rpm/blob/master/rpmrc.in.  Strings are roughly listed from most common to least common to improve performance.
   type Yum::PackageBuildArch = Regexp[/noarch|x86_64|i386|arm|ppc64|ppc64le|sparc64|ia64|alpha|ip|m68k|mips|mipsel|mk68k|mint|ppc|rs6000|s390|s390x|sh|sparc|xtensa/]

wildcard characters may not span the fields, may not cover the
seperators.  This is an undocumented but tested limitation of
yum-versionlock.

* **Note** Each field may contain wildcard characters (`*`), but the

#### Examples

##### A complete, well-formed string: `0:bash-4.1.2-9.el6_2.x86_64'

```puppet

A well-formed string that has dropped the optional BuildArch sub-field: 0:bash-4.1.2-9.el6_2
A well-formed string using wildcards: *0:bash*-4.*-*.*
An invalid string (wildcard spans the VERSION and RELEASE fields): `0:bash-4.*-el6.x86_64
An invlaid string (wildcard spans the VERSION, RELEASE, and ARCH fields): 0:bash-*

Alias of Pattern[/^([0-9\*]+):([0-9a-zA-Z\._\+%\{\}\*-]+)-([^-]+)-([^-]+)\.(([0-9a-zZ-Z_\*]+)(?:\.(noarch|x86_64|i386|arm|ppc64|ppc64le|sparc64|ia64|alpha|ip|m68k|mips|mipsel|mk68k|mint|ppc|rs6000|s390|s390x|sh|sparc|xtensa|\*))?)$/]

Tasks

init

Allows you to perform yum functions

Supports noop? false

Parameters

action

Data type: Enum[update, upgrade]

Action to perform

quiet

Data type: Optional[Boolean]

Run without output