Hi,
I have defined under group_vars, something like the following :
---
dc001_sysctl:
net.ipv4.ip_local_port_range: 32768 61000
net.ipv4.tcp_fin_timeout: 30
net.ipv4.tcp_keepalive_time: 1800
...
...
net.ipv4.neigh.default.gc_thresh1: 2048
net.ipv4.neigh.default.gc_thresh2: 4096
net.ipv4.neigh.default.gc_thresh3: 8192
the template of the /etc/sysctl.conf looks something like the following:
{% for parameter,value in dc001_sysctl.getenteries() %}
{{ parameter }}= {{ value }}
{% endfor %}
my question if I prefer to do this using the sysctl module, what is the best way to iterate over these dictionary values in a systctl module task? my reasoning is to protect against some one have changed the sysctl from the command line without updating the sysctl.conf file or it is in the sysctl.file but was not reloaded.
kind regards
Walid
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
net.ipv4.ip_local_port_range: 32768 610
net.ipv4.tcp_fin_timeout: 30
- sysctl: name={{ item[0] }} value= {{ item[1] }}
with_items: pana_sys_ctl|dictsort
Regards,
Benno
- debug: var= {{ item.name }}
#### works fine- my_pairs
##### or this also works fine- " {{ my_pairs }}"
- my_pairs
This would be iterpreted as a list with one member variable who was a hash, so I'd expect this to cause some problems.
Generally if I'm traversing a list I would do "with_items: mylist" pretty much every time.
Why the second form works is actually what I'd have a question about, it's probably a bit of a weird side effect :)
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAN4dctoDxmPS%2BymFOrsYVngdHW0r5Wzem8aarsovdjZbhQ8-Ug%40mail.gmail.com.