Hi,
testing ansible (thanks for this amazing SW!)
I would like to be able to switch ON or OFF a kernel parameter via some code similar to:
- name: Make sure the following item is turned ON
action: sysctl value=1 name=$item state=present
with_items: - ‘net.ipv4.icmp_echo_ignore_all’
that works well.
to avoid code duplication that just differ by “value=0”
I’m wondering about any possibility to have something like:
-
vars:
toggle: 1 -
name: Make sure the following item are turned ON
action: sysctl value=$toggle name=$item state=present
with_items: -
'net.ipv4.icmp_echo_ignore_all
so the value to be set is not hardcoded - but calculated/inferred, to be able to switch it from 1 on 0 (enable/disable)
(use case: switch the value to: 1 - currentValue to activate/deactivate the ping )
I’ve not been able to make this working and suspect this is not working
What am I missing ?
thanks for your help.
Phil.