add sysctl state
This commit is contained in:
parent
535428d302
commit
adc327c92e
8
states/sysctl/defaults.yaml
Normal file
8
states/sysctl/defaults.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
sysctl:
|
||||||
|
config: {}
|
||||||
|
10-kube:
|
||||||
|
net.ipv4.ip_forward: 1
|
||||||
|
net.ipv6.conf.all.forwarding: 1
|
||||||
|
net.ipv6.conf.all.disable_ipv6: 0
|
||||||
|
net.core.bpf_jit_enable: 1
|
17
states/sysctl/init.sls
Normal file
17
states/sysctl/init.sls
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{%- from "sysctl/map.jinja" import sysctl with context %}
|
||||||
|
{%- for file,sysctls in sysctl.config.items() %}
|
||||||
|
sysctl-values:
|
||||||
|
file.keyvalue:
|
||||||
|
- name: /etc/sysctl.d/{{ file }}.conf
|
||||||
|
- key_values:
|
||||||
|
{%- for key,value in sysctls.items() %}
|
||||||
|
{{ key }}: {{ value }}
|
||||||
|
{%- endfor %}
|
||||||
|
- separator: '='
|
||||||
|
- uncomment: '# '
|
||||||
|
- key_ignore_case: True
|
||||||
|
- append_if_not_found: True
|
||||||
|
|
||||||
|
sysctl-apply:
|
||||||
|
cmd.run:
|
||||||
|
- name: "sysctl --system"
|
3
states/sysctl/kernelmap.yaml
Normal file
3
states/sysctl/kernelmap.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
Linux:
|
||||||
|
os: "linux"
|
14
states/sysctl/map.jinja
Normal file
14
states/sysctl/map.jinja
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{%- import_yaml "sysctl/defaults.yaml" as default_settings -%}
|
||||||
|
|
||||||
|
{%- import_yaml "sysctl/kernelmap.yaml" as kernelmap -%}
|
||||||
|
{%- import_yaml "sysctl/osarchmap.yaml" as osarchmap -%}
|
||||||
|
|
||||||
|
{%- set defaults = salt['grains.filter_by'](default_settings,
|
||||||
|
default='sysctl',
|
||||||
|
merge=salt['grains.filter_by'](osarchmap, grain='osarch',
|
||||||
|
merge=salt['grains.filter_by'](kernelmap, grain='kernel')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
-%}
|
||||||
|
|
||||||
|
{%- set sysctl = salt['pillar.get']('sysctl', default=defaults, merge=True) -%}
|
24
states/sysctl/osarchmap.yaml
Normal file
24
states/sysctl/osarchmap.yaml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
amd64:
|
||||||
|
arch: "amd64"
|
||||||
|
|
||||||
|
x86_64:
|
||||||
|
arch: "amd64"
|
||||||
|
|
||||||
|
386:
|
||||||
|
arch: "386"
|
||||||
|
|
||||||
|
arm64:
|
||||||
|
arch: "arm64"
|
||||||
|
|
||||||
|
aarch64:
|
||||||
|
arch: "arm64"
|
||||||
|
|
||||||
|
armv6l:
|
||||||
|
arch: "arm"
|
||||||
|
|
||||||
|
armv7l:
|
||||||
|
arch: "arm"
|
||||||
|
|
||||||
|
armhf:
|
||||||
|
arch: "arm"
|
Loading…
Reference in New Issue
Block a user