Forge Home

sysctl

Enforce Linux kernel configuration with sysctl

507 downloads

136 latest version

4.7 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

  • 0.6.1 (latest)
  • 0.6.0
  • 0.5.3
  • 0.5.2
released Jan 21st 2024
This version is compatible with:
  • Puppet Enterprise 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
  • , , , , ,

Start using this module

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

Add this module to your Puppetfile:

mod 'h0tw1r3-sysctl', '0.6.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add h0tw1r3-sysctl
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install h0tw1r3-sysctl --version 0.6.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

h0tw1r3/sysctl — version 0.6.1 Jan 21st 2024

sysctl

Table of Contents

  1. Description
  2. Setup
  3. Usage
  4. Limitations

Description

[sysctl] is used to modify kernel parameters at runtime. The parameters available on Linux are those listed under /proc/sys/. Procfs is required for sysctl support in Linux.

This module supports setting parameter values that are persistent across reboots by managing the system [sysctl] configuration files.

sysctl::variable resource declares the "private" resource, sysctl::define, which is exported and eventually collected by the sysctl class.

Setup

What sysctl affects

  • /etc/sysctl.conf
  • /etc/sysctl.d/*.conf
  • optionally execute sysctl at runtime to enforce values

Beginning with sysctl

To make use of the sysctl::variable resource, the sysctl class must be included in your puppet manifest.

include sysctl

Usage

Manage a parameter with a resource:

sysctl::variable { 'net.ipv4.ip_forward':
  ensure => '1',
}

Manage multiple parameters with hiera:

sysctl::variable:
  net.ipv4.ip_forward:
    ensure: 1
  net.ipv6.bindv6only:
    ensure: 1
    enforce: false
  net.ipv4.tcp_congestion_control:
    ensure: absent
  net.core.somaxconn:
    ensure: 65535
    comment: increased to accommodate traffic handling requirements

Separate multi-value variables with a single space:

sysctl::variable { 'net.ipv4.tcp_rmem':
  ensure => '4096 65536 16777216',
}

Remove the sysctl configuration for a variable:

sysctl::variable { 'vm.swappiness':
  ensure => absent,
}

Ensure variables are set in a consistent order using the prefix parameter:

sysctl::variable { 'net.ipv4.ip_forward':
  ensure => '1',
  prefix => '60',
}

Limitations

Testing! Could use many more unit tests.

Credit

Inspired by Matthias Saou's thias/puppet-sysctl module.