Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x
- Puppet >= 7.0.0 < 9.0.0
- , , , , , , ,
Tasks:
- reload
Start using this module
Add this module to your Puppetfile:
mod 'silug-zram', '1.1.0'
Learn more about managing modules with a PuppetfileDocumentation
zram
Overview
This module configures zram swap using udev rules (no init scripts or systemd units needed).
Module Description
Want to know more about zram? Read the Linux kernel documentation.
Setup
What zram affects
Creates the following files:
- /lib/udev/zram
- /etc/udev/rules.d/01-zram.rules
- /etc/modprobe.d/zram.conf
Finally, it loads the zram module.
Setup Requirements
This module requires puppetlabs-stdlib and puppet-kmod.
Beginning with zram
Make sure you are using a kernel that includes the zram module.
Usage
class { 'zram': }
Reference
The zram
class accepts the following parameters:
-
numdevices
Number of zram devices. Defaults to the number of processors ($facts['processorcount']
). -
disksize
Size of zram devices. Defaults to half of memory divided bynumdevices
.
See REFERENCE.md
for more details.
Limitations
This module has been tested on a number of systems. (See
metadata.json
for a full list.) It should work on any
Linux distribution that includes the zram kernel module.
Development
Send me a pull request on GitHub.
Reference
Table of Contents
Classes
zram
: Configures and loads zram kernel modulezram::config
: Configuration for thezram
modulezram::install
: Add or remove packages to enable zram managementzram::load
: Loads the zram kernel module
Tasks
reload
: Reloads the zram kernel module
Classes
zram
zram
This module configures zram using udev rules (no init scripts or systemd units needed).
Examples
include zram
Parameters
The following parameters are available in the zram
class:
numdevices
Data type: Integer
Number of zram devices. Defaults to the number of processors ($facts['processorcount']
).
Default value: $facts['processors']['count']
disksize
Data type: Integer
Size of zram devices. Defaults to half of memory divided by numdevices
.
Default value: (($facts['memory']['system']['total_bytes'] / 2) / $numdevices
ensure
Data type:
Enum[
'present',
'absent'
]
Set to absent
to remove zram.
Default value: 'present'
swapoff
Data type: Boolean
When ensure
is absent
, attempt to disable zram swap before
unloading the kernel module. Without this set, you will need to
proactively run swapoff
on each /dev/zram*
device or reboot
following a failed unload attempt.
Default value: false
swapoff_timeout
Data type: Optional[Integer[0]]
Timeout for the swapoff
command. (See the
exec
timeout
attribute documentation
for details.)
Default value: undef
zram::config
Configuration for the zram
module
Parameters
The following parameters are available in the zram::config
class:
ensure
Data type:
Enum[
'present',
'absent'
]
Set to absent
to remove the configuration
Default value: $zram::ensure
file_ensure
Data type:
Enum[
'file',
'absent'
]
Set to absent
to remove the configuration files
Default value:
$ensure ? {
'absent' => 'absent',
default => 'file'
zram::install
Add or remove packages to enable zram management
Parameters
The following parameters are available in the zram::install
class:
required
Data type:
Variant[
Undef,
String[1],
Array[String[1]]
]
Packages required for zram to function
Default value: undef
conflicts
Data type:
Variant[
Undef,
String[1],
Array[String[1]]
]
Packages that conflict with zram
Default value: undef
required_ensure
Data type: String[1]
ensure
attribute of required
packages
Default value: 'installed'
conflicts_ensure
Data type: String[1]
ensure
attribute of conflicts
packages
Default value: 'absent'
ensure
Data type:
Enum[
'present',
'absent'
]
Set to absent
to skip package operations
Default value: $zram::ensure
zram::load
Loads the zram kernel module
Parameters
The following parameters are available in the zram::load
class:
ensure
Data type:
Enum[
'present',
'absent'
]
Set to absent
to unload the kernel module
Default value: $zram::ensure
swapoff
Data type: Boolean
When ensure
is absent
, attempt to disable zram swap before
unloading the kernel module
Default value: $zram::swapoff
swapoff_timeout
Data type: Optional[Integer[0]]
Timeout for the swapoff
command
Default value: $zram::swapoff_timeout
Tasks
reload
Reloads the zram kernel module
Supports noop? true
Parameters
verbose
Data type: Optional[Boolean]
Enable verbose output
What are tasks?
Modules can contain tasks that take action outside of a desired state managed by Puppet. It’s perfect for troubleshooting or deploying one-off changes, distributing scripts to run across your infrastructure, or automating changes that need to happen in a particular order as part of an application deployment.
Tasks in this module release
Dependencies
- puppetlabs-stdlib (>= 4.25.0 < 10.0.0)
- puppet-kmod (>= 2.1.0 < 5.0.0)
- puppetlabs-augeas_core (>= 1.0.0 < 2.0.0)