https://github.com/deric/puppet-sysctl_conf
Hiera based sysctl.conf management
https://github.com/deric/puppet-sysctl_conf
Last synced: about 1 year ago
JSON representation
Hiera based sysctl.conf management
- Host: GitHub
- URL: https://github.com/deric/puppet-sysctl_conf
- Owner: deric
- Created: 2019-11-05T09:04:22.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-25T13:09:07.000Z (almost 2 years ago)
- Last Synced: 2025-04-11T07:10:29.974Z (about 1 year ago)
- Language: Ruby
- Size: 102 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Puppet sysctl_conf
[](https://forge.puppetlabs.com/deric/sysctl_conf) [](https://github.com/deric/puppet-sysctl_conf/actions/workflows/main.yml) [](https://forge.puppetlabs.com/deric/sysctl_conf/scores)
Configure Linux kernel parameters at runtime via Puppet's Hiera based `sysctl.conf` management.
## Description
By default for each key (e.g. `net.ipv4.ip_forward`) creates a corresponding configuration file (e.g. `/etc/sysctl.d/net.ipv4.ip_forward.conf`) with given value (`net.ipv4.ip_forward = 1`). `sysctl` configuration is applied immediately.
```yaml
sysctl_conf::values:
net.ipv4.ip_forward:
value: 1
```
## Setup
Either include `sysctl_conf` directly in your node's definition:
```puppet
include sysctl_conf
```
or via Hiera call, e.g.:
```puppet
lookup('classes', {merge => unique}).include
```
then make sure to include `sysctl_conf` in `classes` definition:
```yaml
classes:
- sysctl_conf
```
### Merge behavior
Cofigure [merge behavior](https://puppet.com/docs/puppet/latest/hiera_merging.html) suitable for you needs:
```yaml
lookup_options:
sysctl_conf::values:
merge: deep
```
## Usage
- set simple value:
```yaml
sysctl_conf::values:
vm.overcommit_memory:
value: 1
```
- ignore non-activated configuration option
```yaml
sysctl_conf::values:
"net.ipv6.conf.%{networking.primary}.disable_ipv6":
value: 1
silent: true
```
- delete entry
```yaml
sysctl_conf::values:
kernel.keys.root_maxkeys:
ensure: absent
```
- don't persist configuration on disk
```yaml
sysctl_conf::values:
net.ipv6.conf.all.disable_ipv6:
value: 1
persist: false
```
- add comment
```yaml
sysctl_conf::values:
vm.swappiness:
value: 0
comment: 'disable swap'
```
- don't apply changes with `sysctl` command (will be applied upon next reboot)
```yaml
sysctl_conf::values:
kernel.sem:
value: '250 32000 256 256'
apply: false
```
- custom configuration file
```yaml
net.ipv4.ip_forward:
kernel.sem:
value: 1
target: '/etc/sysctl.d/forwarding.conf'
```
## Documentation
Generate documentation:
```
$ rake strings:generate
```
in markdown:
```
$ puppet strings generate --format markdown --out sysctl_conf.md
```