How to i collect remote hosts kernel parameters using ansible. I’m looking to below type collect info of remote hosts . setup module doesn’t collect this info .
And sysctl module is to edit , can i use sysctl module just to list the parameters and not to modify anything ?
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
fs.file-max = 209702
net.core.optmem_max = 10000000
net.core.rmem_default = 10000000
net.core.rmem_max = 10000000
net.core.wmem_default = 10000000
net.core.wmem_max = 10000000
net.ipv4.conf.all.rp_filter = 1
net.ipv4.tcp_max_tw_buckets = 2000000
net.ipv4.tcp_mem = 30000000 30000000 30000000
net.ipv4.tcp_rmem = 30000000 30000000 30000000
net.ipv4.tcp_wmem = 30000000 30000000 30000000
net.ipv4.ip_local_port_range = 32768 65000
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_sack = 1
net.ipv4.igmp_max_memberships = 4096
kernel.pid_max = 131072
kernel.pid_max = 131072
Regards
Vikrant
Probably best done in one long cmd, for example:
hosts: all
vars:
params:
net.ipv4.ip_forward
net.ipv4.conf.default.rp_filter
net.ipv4.conf.default.accept_source_route
kernel.sysrq
kernel.core_uses_pid
net.ipv4.tcp_syncookies
kernel.msgmnb
kernel.msgmax
kernel.shmmax
kernel.shmall
fs.file-max
net.core.optmem_max
net.core.rmem_default
net.core.rmem_max
net.core.wmem_default
net.core.wmem_max
net.ipv4.conf.all.rp_filter
net.ipv4.tcp_max_tw_buckets
net.ipv4.tcp_mem
net.ipv4.tcp_rmem
net.ipv4.tcp_wmem
net.ipv4.ip_local_port_range
net.ipv4.ip_forward
net.ipv4.conf.default.rp_filter
net.ipv4.tcp_timestamps
net.ipv4.tcp_fin_timeout
net.ipv4.tcp_keepalive_time
net.ipv4.tcp_window_scaling
net.ipv4.tcp_sack
net.ipv4.igmp_max_memberships
kernel.pid_max
kernel.pid_max
tasks:
racke
(Stefan Hornburg)
February 17, 2020, 1:47pm
3
How to i collect remote hosts kernel parameters using ansible. I'm looking to below type collect info of remote hosts .
setup module doesn't collect this info .
And sysctl module is to edit , can i use sysctl module just to list the parameters and not to modify anything ?
According to its documentation, no.
But you can read the current values with
command: sysctl -a
register: sysctl_settings
Regards
Racke
vbotka
(Vladimir Botka)
February 17, 2020, 2:31pm
4
Optionally ask sysctl to print values only and set dictionary of the
parameters and values. For example
- command: "sysctl -n {{ params | join(' ') }}"
register: sysctl_out
- set_fact:
sysctl_dict: "{{ dict(params|zip(sysctl_out.stdout_lines)) }}"
HTH,
-vlado