Skip to content

Latest commit

 

History

History
844 lines (497 loc) · 18.8 KB

REFERENCE.md

File metadata and controls

844 lines (497 loc) · 18.8 KB

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

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:
---
yum::manage_os_default_repos: true
Add Hiera data to disable management of the CentOS Base repo:
---
yum::manage_os_default_repos: true
yum::repo_exclusions:
    - 'base'
Ensure the CentOS base repo is removed from the agent system(s):
---
yum::manage_os_default_repos: true
yum::repos:
    base:
        ensure: 'absent'
Add a custom repo:
---
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:
---
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 By default on CentOS 7 the following format is used. "%{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:bsh-4.1.2-9.' covers Bash version 4.1.2, revision 9 on all architectures. By default on CentOS 8 and newer the resource title to just set the package name. If a version is set on CentOS 7 then it behaves like CentOS 8

  • See also

Examples

Sample usage on CentOS 7
yum::versionlock { '0:bash-4.1.2-9.el7.*':
  ensure => present,
}
Sample usage on CentOS 8
yum::versionlock { 'bash':
  ensure => present,
  version => '4.1.2',
  release => '9.el8',
  epoch   => '0',
  arch    => 'noarch',
}
Sample usage on CentOS 7 with new style version, release, epoch, name parameters.
yum::versionlock { 'bash':
  ensure => present,
  version => '3.1.2',
  release => '9.el7',
  epoch   => '0',
  arch    => 'noarch',
}

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'

version

Data type: Optional[Yum::RpmVersion]

Version of the package if CentOS 8 mechanism is used. This must be set for dnf based systems (e.g CentOS 8). If version is set then the name var is assumed to a package name and not the full versionlock string.

Default value: undef

release

Data type: Yum::RpmRelease

Release of the package if CentOS 8 mechanism is used.

Default value: '*'

arch

Data type: Variant[Yum::RpmArch, Enum['*']]

Arch of the package if CentOS 8 mechanism is used.

Default value: '*'

epoch

Data type: Integer[0]

Epoch of the package if CentOS 8 mechanism is used.

Default value: 0

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
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
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::RpmArch

Output of rpm -q --queryformat '%{arch}\n' package

Alias of Enum['noarch', 'x86_64', 'i386', 'arm', 'ppc64', 'ppc64le', 'sparc64', 'ia64', 'alpha', 'ip', 'm68k', 'mips', 'mipsel', 'mk68k', 'mint', 'ppc', 'rs6000', 's390', 's390x', 'sh', 'sparc', 'xtensa']

Yum::RpmName

Can be alphanumeric or contain . _ + % { } -. Output of rpm -q --queryformat '%{name}\n package Examples python36-foobar, netscape

Alias of Pattern[/\A([0-9a-zA-Z\._\+%\{\}-]+)\z/]

Yum::RpmRelease

It may not contain a dash. Output of rpm -q --queryformat '%{release}\n' package. Examples 3.4 3.4.el6, 3.4.el6_2

Alias of Pattern[/\A([^-]+)\z/]

Yum::RpmVersion

It may not contain a dash. Output of rpm -q --queryformat '%{version}\n' package. Examples 3.4, 2.5.alpha6

Alias of Pattern[/\A([^-]+)\z/]

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'
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, 'list updates']

Action to perform

quiet

Data type: Optional[Boolean]

Run without output