Hi,
I’m trying to add the following to /etc/sysctl.conf
vm.dirty_ratio=10
vm.dirty_background_ratio=5
I am using the following code:
- sysctl:
with_items:
- { name: vm.dirty_ratio, value: 10, state: present }
- { name: vm.dirty_background_ratio, value: 5, state: present }
tags: sysctl
That isn't working correctly!
Any ideas on what I am missing?
Thanks
with_items is a property to the task and not module.
with_items run the task as many times as there are elements.
For each run you have the content of the element in a varialble called item, so in your case you have item.name, item.value and item.present.
You need to provide these values to the sysctl module so it now what it should configure.
name: '{{ item.name }}'
value: '{{ item.value }}'
state is default present so you can leave that out or add it if you like.