yum
: A class to install and manage Yum configuration.yum::clean
: A $(yum clean all) Exec to be notified if desired.yum::plugin::post_transaction_actions
: Class to install post_transaction pluginyum::plugin::versionlock
: This class installs versionlock pluginyum::settings
: Simple settings to use
yum::config
: This definition manages yum.confyum::copr
: This definition manages Copr (Cool Other Package Repo) repositories.yum::gpgkey
: imports/deleted public GPG key for RPM. Key can be stored on Puppet's fileserver or as inline content.yum::group
: This definition installs or removes yum package group.yum::install
: Installs/removes rpms from local file/URL via yum install command.yum::plugin
: This definition installs Yum plugin.yum::post_transaction_action
: Creates post transaction configuratons for dnf or yum.yum::versionlock
: Locks package from updates.
dnf_module_stream
: Manage DNF module streams
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
Yum::RpmArch
: Valid rpm architectures.Yum::RpmName
: Valid rpm name.Yum::RpmNameGlob
: Valid rpm name with globs.Yum::RpmRelease
: Valid rpm release fields.Yum::RpmVersion
: Valid rpm version fields.Yum::VersionlockString
: This type matches strings appropriate for use with yum-versionlock. Its basic format, using therpm(8)
query string format, is `%{EPOCH}:%{
init
: Allows you to perform yum functions
A class to install and manage Yum configuration.
---
yum::manage_os_default_repos: true
---
yum::manage_os_default_repos: true
yum::repo_exclusions:
- 'base'
---
yum::manage_os_default_repos: true
yum::repos:
base:
ensure: 'absent'
---
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'
---
yum::manage_os_default_repos: true
yum::repos:
base:
baseurl: 'https://repos.example.com/CentOS/base/'
mirrorlist: '--'
---
yum::groups:
'Development Tools':
ensure: present
'System Tools':
ensure: present
The following parameters are available in the yum
class:
clean_old_kernels
keep_kernel_devel
config_options
repos
managed_repos
manage_os_default_repos
os_default_repos
repo_exclusions
gpgkeys
utils_package_name
groups
Data type: Boolean
Whether or not to purge old kernel version beyond the keeponly_limit
.
Default value: true
Data type: Boolean
Whether or not to keep kernel devel packages on old kernel purge.
Default value: false
Data type: Hash[String, Variant[String, Integer, Boolean, Sensitive[String], Hash[String, Variant[String, Integer, Boolean, Sensitive[String]]]]]
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
. Sensitive value will disable the show_diff
.
Default value: {}
Data type: 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: {}
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: []
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
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: []
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: []
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: {}
Data type: String
Name of the utils package, e.g. 'yum-utils', or 'dnf-utils'.
Default value: 'yum-utils'
Data type: Stdlib::CreateResources
A hash of yum::group instances to manage.
Default value: {}
A $(yum clean all) Exec to be notified if desired.
Class to install post_transaction plugin
- See also
- https://dnf-plugins-core.readthedocs.io/en/latest/post-transaction-actions.html
- DNF Post Transaction Items
- https://dnf-plugins-core.readthedocs.io/en/latest/post-transaction-actions.html
class{'yum::plugin::post_transaction_actions':
ensure => present,
}
The following parameters are available in the yum::plugin::post_transaction_actions
class:
Data type: Enum['present', 'absent']
Should the post_transaction actions plugin be installed
Default value: 'present'
This class installs versionlock plugin
class { 'yum::plugin::versionlock':
ensure => present,
}
The following parameters are available in the yum::plugin::versionlock
class:
Data type: Enum['present', 'absent']
specifies if versionlock should be present or absent
Default value: 'present'
Data type: Boolean
specifies if yum clean all should be called after edits. Defaults false.
Default value: false
Data type: String
filepath for the versionlock.list, default based on your system.
Simple settings to use
The following parameters are available in the yum::settings
class:
Data type: Enum['/etc/yum.conf','/etc/dnf/dnf.conf']
Augeas location of the dnf or yum configuration file. The default is set into hiera according to the package_provider being yum or dnf.
This definition manages yum.conf
yum::config { 'installonly_limit':
ensure => 2,
}
yum::config { 'debuglevel':
ensure => absent,
}
The following parameters are available in the yum::config
defined type:
Data type: Variant[Boolean, Integer, Enum['absent'], String, Sensitive[String]]
specifies value or absent keyword
Data type: String
alternative conf. key (defaults to name)
Default value: $title
This definition manages Copr (Cool Other Package Repo) repositories.
yum::copr { 'copart/restic':
ensure => 'enabled',
}
The following parameters are available in the yum::copr
defined type:
Data type: String
Name of repository, defaults to title.
Default value: $title
Data type: Boolean
Wheter required plugin for dnf/yum should be installed by this resource.
Default value: true
Data type: Enum['enabled', 'disabled', 'removed']
Specifies if repo should be enabled, disabled or removed.
Default value: 'enabled'
imports/deleted public GPG key for RPM. Key can be stored on Puppet's fileserver or as inline content.
yum::gpgkey { '/etc/pki/rpm-gpg/RPM-GPG-KEY-puppet-smoketest1':
ensure => 'present',
content => '-----BEGIN PGP PUBLIC KEY BLOCK-----
...
-----END PGP PUBLIC KEY BLOCK-----';
}
The following parameters are available in the yum::gpgkey
defined type:
Data type: String
alternative file location (defaults to name)
Default value: $name
Data type: Enum['present', 'absent']
specifies if key should be present or absent
Default value: 'present'
Data type: Optional[String]
the actual file content
Default value: undef
Data type: Optional[String]
source (e.g.: puppet:///)
Default value: undef
Data type: String
file owner
Default value: 'root'
Data type: String
file group
Default value: 'root'
Data type: String
file mode
Default value: '0644'
This definition installs or removes yum package group.
yum::group { 'X Window System':
ensure => 'present',
}
The following parameters are available in the yum::group
defined type:
Data type: Enum['present', 'installed', 'latest', 'absent', 'purged']
specifies if package group should be present (installed) or absent (purged)
Default value: 'present'
Data type: Optional[Integer]
exec timeout for yum groupinstall command
Default value: undef
Data type: Array[String[1]]
options provided to yum groupinstall command
Default value: []
Installs/removes rpms from local file/URL via yum install command.
- Note This can be better than using just the rpm provider because it will pull all the dependencies.
yum::install { 'epel-release':
ensure => 'present',
source => 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm',
}
The following parameters are available in the yum::install
defined type:
Data type: String
file or URL where RPM is available
Data type: Enum['present', 'installed', 'absent', 'purged']
the desired state of the package
Default value: 'present'
Data type: Optional[Integer]
optional timeout for the installation
Default value: undef
Data type: Boolean
optional argument, will reinstall if rpm verify fails
Default value: false
This definition installs Yum plugin.
yum::plugin { 'versionlock':
ensure => 'present',
}
The following parameters are available in the yum::plugin
defined type:
Data type: Enum['present', 'absent']
specifies if plugin should be present or absent
Default value: 'present'
Data type: Optional[String]
the package prefix for the plugins
Default value: undef
Data type: Optional[String]
the actual package name
Default value: undef
Creates post transaction configuratons for dnf or yum.
- See also
- https://dnf-plugins-core.readthedocs.io/en/latest/post-transaction-actions.html
- DNF Post Transaction Items
- https://dnf-plugins-core.readthedocs.io/en/latest/post-transaction-actions.html
yum::post_transaction_action{'touch file on ssh package update':
key => 'openssh-*',
state => 'any',
command => 'touch /tmp/openssh-installed',
}
The following parameters are available in the yum::post_transaction_action
defined type:
Data type: String[1]
Name variable a string to label the rule
Default value: $title
Data type: Variant[Enum['*'],Yum::RpmNameGlob,Stdlib::Unixpath]
Package name, glob or file name file glob.
Data type: Enum['install', 'update', 'remove', 'any', 'in', 'out']
Can be install
, update
, remove
or any
on YUM based systems.
Can be in
, out
or any
on DNF based systems.
Default value: 'any'
Data type: String[1]
The command to run
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
yum::versionlock { '0:bash-4.1.2-9.el7.*':
ensure => present,
}
yum::versionlock { 'bash':
ensure => present,
version => '4.1.2',
release => '9.el8',
epoch => 0,
arch => 'noarch',
}
yum::versionlock { 'bash':
ensure => present,
version => '3.1.2',
release => '9.el7',
epoch => 0,
arch => 'noarch',
}
The following parameters are available in the yum::versionlock
defined type:
Data type: Enum['present', 'absent', 'exclude']
Specifies if versionlock should be present
, absent
or exclude
.
Default value: 'present'
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
Data type: Yum::RpmRelease
Release of the package if CentOS 8 mechanism is used.
Default value: '*'
Data type: Variant[Yum::RpmArch, Enum['*']]
Arch of the package if CentOS 8 mechanism is used.
Default value: '*'
Data type: Integer[0]
Epoch of the package if CentOS 8 mechanism is used.
Default value: 0
This type allows Puppet to enable/disable streams via DNF modules
dnf_module_stream { 'mariadb':
stream => default,
}
dnf_module_stream { 'mariadb':
stream => '10.5',
}
dnf_module_stream { 'mariadb':
stream => absent,
}
The following properties are available in the dnf_module_stream
type.
Valid values: present
, default
, absent
, %r{.+}
Module stream that should be enabled
String - Specify stream present - Keep current enabled stream if any, otherwise enable default one default - Enable default stream absent - No stream (resets module)
The following parameters are available in the dnf_module_stream
type.
Valid values: %r{.+}
DNF module to be managed
The specific backend to use for this dnf_module_stream
resource. You will seldom need to specify this --- Puppet will
usually discover the appropriate provider for your platform.
Valid values: %r{.+}
Resource title
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.
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 }],
}
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
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 }],
}
Data type: Hash
The hash on which to operate
Output of rpm -q --queryformat '%{arch}\n' package
Alias of Enum['noarch', 'x86_64', 'i386', 'aarch64', 'arm', 'ppc64', 'ppc64le', 'sparc64', 'ia64', 'alpha', 'ip', 'm68k', 'mips', 'mipsel', 'mk68k', 'mint', 'ppc', 'rs6000', 's390', 's390x', 'sh', 'sparc', 'xtensa']
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/]
Can be alphanumeric or contain .
_
+
%
{
}
-
*
.
Examples python36-*, *netscape
Alias of Pattern[/\A([*0-9a-zA-Z\._\+%\{\}-]+)\z/]
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/]
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/]
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[/[^-]+/]
lint:ignore:140chars
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|*))?/]
lint:endignore
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_*]+/]
lint:ignore:140chars 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/] lint:endignore
wildcard characters may not span the fields, may not cover the seperators. This is an undocumented but tested limitation of yum-versionlock.
lint:ignore:140chars
- Note Each field may contain wildcard characters (
*
), but the
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|\*))?)$/]
Allows you to perform yum functions
Supports noop? false
Data type: Enum[update, upgrade, 'list updates']
Action to perform
Data type: Optional[Boolean]
Run without output