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:
- name: find out sysctl values
shell: sysctl {{ params | join(' ') }}
register: sysctl_out
- debug: var=sysctl_out
On Mon, 17 Feb 2020 at 13:47, Vikrant Agarwal <[email protected]>
wrote:
> 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
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAFn3J16xSQXGvmrrzQO1%2BcGS-Ppy_Gah%2ByH09AA4Ezdxh%3D_Xxg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAFn3J16xSQXGvmrrzQO1%2BcGS-Ppy_Gah%2ByH09AA4Ezdxh%3D_Xxg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAL8fbwOsPukGdpNEhe23h_2JFUUjK2m8h1Qf2y2YESewZP9yLg%40mail.gmail.com.