Hello all,
I want to use sysctl module to enable / disable ping.
When I wrote a action as "sysctl: name=net.ipv4.icmp_echo_ignore_all value=0 reload=yes state=present ", indeed it cannot enable ping. I don’t know why?
The command is wrong?
Best regards,
Guo Yan
When you said you cannot enable ping, what behavior did you witness?
Also what version of Ansible are you using and what platform are you running the command on?
Thanks!
Make the remote host ping disable: [root@devhost ~]# sysctl -w net.ipv4.icmp_echo_ignore_all=1
Run playbook task action: sysctl: name=net.ipv4.icmp_echo_ignore_all value=0 reload=yes state=present
Try to ping the remote host: It is still failed. ( I expect the remote host ping enable)
[test@test test]$ ping 192.168.126.155PING 192.168.126.155 (192.168.126.155) 56(84) bytes of data.
^C
— 192.168.126.155 ping statistics —
5 packets transmitted, 0 received, 100% packet loss, time 4430ms
My ansible version is:
[test@test test]$ ansible --version
ansible 1.5 (devel 27199dc219) last updated 2013/12/03 21:01:10 (GMT -500)
Walid
(Walid)
March 6, 2014, 3:36am
4
did you check on the host the state of the sysctl parameter before and after the ansible run?
tannerjc
(James Tanner)
March 6, 2014, 4:35am
5
Firewalls and various other factors aside, please verify 2 things:
the line exists in sysctl.conf after running the module
the property is set when you run “sysctl net.ipv4.icmp_echo_ignore_all”
If those two items are true, the module is working as expected.
It is very strange. I do two cases:
Case 1:
Use command “sysctl -w net.ipv4.icmp_echo_ignore_all=1 ” to disable ping
Use playbook sysctl module to enable ping, enabling ping would be failed .
Command sysctl -w net.ipv4.icmp_echo_ignore_all=1 doesn’t change /etc/sysctl.conf file. In this case, sysctl module also doesn’t change /etc/sysctl.conf.
Case 2:
Update /etc/sysctl.conf to set net.ipv4.icmp_echo_ignore_all=1
2. Execute sysctl -p to disable ping
Use playbook sysctl module to enable ping, enabling ping would be succesful .
In this case, sysctl module changes /etc/sysctl.conf.