# Sysctl

**URL:** <https://forum.ansible.com/t/sysctl/26979>\
**Category:** Ansible Project\
**Created:** [March 13, 2018, 8:48am UTC](https://forum.ansible.com/t/sysctl/26979 "2018-03-13T08:48:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vino\_B](https://avatars.discourse-cdn.com/v4/letter/v/839c29/32.png) [@Vino\_B](https://forum.ansible.com/u/Vino_B)\
**Post date:** [March 13, 2018, 8:48am UTC](https://forum.ansible.com/t/sysctl/26979/1 "2018-03-13T08:48:19Z")

</div>

Hi All,

Request your help, on the below code, i wanted to check whether the sysctl paramater “vm.nr\_hugepages” has any numeric value .

- name: Check whether System Settings are Optimized  
command: sysctl -n {{ item.pname }}  
register: net\_param  
failed\_when: net\_param.stdout != item.value  
with\_items:

- { pname: ‘net.core.rmem\_max’, value: “16777216” }

- { pname: ‘vm.nr\_hugepages’, value: ‘regex[0-9]’ } \<==== Issue

changed\_when: false  
ignore\_errors: True

From,  
Vino.B

---

<div class="post-metadata">

**Author:** ![Vino\_B](https://avatars.discourse-cdn.com/v4/letter/v/839c29/32.png) [@Vino\_B](https://forum.ansible.com/u/Vino_B)\
**Post date:** [March 13, 2018, 4:52pm UTC](https://forum.ansible.com/t/sysctl/26979/2 "2018-03-13T16:52:58Z")

</div>

Hi All,

Any help is much appreciated.

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [March 13, 2018, 5:06pm UTC](https://forum.ansible.com/t/sysctl/26979/3 "2018-03-13T17:06:32Z")

</div>

Why reinventing the wheel, there’s already a function for this in jinja… numeric

[http://jinja.pocoo.org/docs/2.9/templates/#number](http://jinja.pocoo.org/docs/2.9/templates/#number)

You probably have to do two different steps… It depends exactly on what you want (perhaps not what you write)

Regards,

---

<div class="post-metadata">

**Author:** ![Vino\_B](https://avatars.discourse-cdn.com/v4/letter/v/839c29/32.png) [@Vino\_B](https://forum.ansible.com/u/Vino_B)\
**Post date:** [March 14, 2018, 5:23am UTC](https://forum.ansible.com/t/sysctl/26979/4 "2018-03-14T05:23:33Z")

</div>

Hi Jeans,

Thank you very much.
