community.openwrt.sysctl module – Manage sysctl entries on OpenWrt targets
Note
This module is part of the community.openwrt collection (version 1.1.0).
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.openwrt.
To use it in a playbook, specify: community.openwrt.sysctl.
Synopsis
The community.openwrt.sysctl module manages sysctl configuration on OpenWrt systems.
It can modify both the running kernel parameters and the persistent configuration file.
Note
This module has a corresponding action plugin.
Parameters
Parameter |
Comments |
|---|---|
Ignore errors when the sysctl key is unknown. Choices:
|
|
The sysctl key to manage. |
|
Whether to reload the sysctl configuration after making changes. Only applies when Choices:
|
|
Whether the sysctl entry should be present or absent in the configuration file. Choices:
|
|
The sysctl configuration file to modify. Default: |
|
Whether to set the value in the running kernel. If Choices:
|
|
The value to set for the sysctl key. Required when |
Attributes
Attribute |
Support |
Description |
|---|---|---|
Support: full |
Can run in |
|
Support: none |
Returns details on what has changed (or possibly needs changing in |
|
Platform: OpenWrt |
Target platform for this module. |
Examples
- name: Enable IP forwarding
community.openwrt.sysctl:
name: net.ipv4.ip_forward
value: '1'
state: present
- name: Set kernel parameter and apply immediately
community.openwrt.sysctl:
name: net.ipv4.tcp_syncookies
value: '1'
sysctl_set: true
- name: Remove a sysctl entry
community.openwrt.sysctl:
name: net.ipv6.conf.all.forwarding
state: absent
- name: Set value without reloading
community.openwrt.sysctl:
name: vm.swappiness
value: '10'
reload: false
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The sysctl key that was managed. Returned: always Sample: |
|