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
- , , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'h0tw1r3-sysctl', '0.6.1'
Learn more about managing modules with a PuppetfileDocumentation
sysctl
Table of Contents
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.
Reference
Table of Contents
Classes
Defined types
Public Defined types
sysctl::variable
: manage a kernel variable with sysctl
Private Defined types
sysctl::define
: collected resource to manage a variable
Classes
sysctl
The sysctl class.
Examples
include sysctl
Parameters
The following parameters are available in the sysctl
class:
variable
Data type: Variant[Hash,Undef]
hash of variables to set, typically defined in hiera
purge
Data type: Boolean
purge conf_dir of any non-puppet managed files
symlink99
Data type: Boolean
symlink sysctl.conf to conf_dir/99-sysctl.conf
binary
Data type: Stdlib::Absolutepath
full path of sysctl executable
use_dir
Data type: Boolean
manage per-variable files in conf_dir
conf_dir
Data type: Stdlib::Absolutepath
full path to sysctl conf.d directory
owner
Data type: Variant[String,Integer,Undef]
set file owner
group
Data type: Variant[String,Integer,Undef]
set file group
mode
Data type: Variant[String,Undef]
set file mode
Defined types
sysctl::variable
manage a kernel variable with sysctl
Parameters
The following parameters are available in the sysctl::variable
defined type:
variable
Data type: Optional[String]
kernel variable to manage, defaults to the resource title
Default value: $title
ensure
Data type: Variant[String,Integer,Undef]
value to assign, use absent or undef to remove
Default value: undef
prefix
Data type: Optional[String]
prefix to conf.d variable filename
Default value: undef
suffix
Data type: String
suffix to conf.d variable filename
Default value: '.conf'
content
Data type: Optional[String]
set value from content instead of ensure not supported if use_dir is disabled
Default value: undef
source
Data type: Optional[String]
set value from a source instead of ensure not supported if use_dir is disabled
Default value: undef
enforce
Data type: Boolean
ensure value is set at puppet runtime
Default value: true
comment
Data type: Optional[Variant[String,Array[String]]]
comment to add to file
Default value: undef
Dependencies
- puppetlabs/stdlib (>= 6.6.0 < 10.0.0)
Copyright (C) 2023 Jeffrey Clark Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.