# when check comparing stdout against numeric value?

**URL:** <https://forum.ansible.com/t/when-check-comparing-stdout-against-numeric-value/18496>\
**Category:** Ansible Project\
**Created:** [June 14, 2015, 12:27pm UTC](https://forum.ansible.com/t/when-check-comparing-stdout-against-numeric-value/18496 "2015-06-14T12:27:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nusenu1](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@Nusenu1](https://forum.ansible.com/u/Nusenu1)\
**Post date:** [June 14, 2015, 12:27pm UTC](https://forum.ansible.com/t/when-check-comparing-stdout-against-numeric-value/18496/1 "2015-06-14T12:27:09Z")

</div>

Hi,

I'm checking the current sysctl value of kern.maxfiles and would like  
to rise this sysctl setting, if it is below 20000 [1]:

- - name: Ensure system-wide runtime file descriptor limits are  
reasonable (OpenBSD)  
sudo: yes  
command: "sysctl kern.maxfiles=20000"  
when: currentlimits.stdout \< 20000

but even though kern.maxfiles is 7030 the setting is skipped due to  
'when' check:

from debug var output:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"stdout": "7030",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"stdout\_lines": [  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"7030"

is it supposed to be possile to compare stdout with '\<' against a  
numeric value?

If I invert the check  
stdout \> 20000  
it actually runs even though 7030 is not greater than 20000.

Is '\>' non-numeric?

thanks!

[1]  
[https://github.com/nusenu/ansible-relayor/blob/master/tasks/openbsd\_install.yml#L22](https://github.com/nusenu/ansible-relayor/blob/master/tasks/openbsd_install.yml#L22)

---

<div class="post-metadata">

**Author:** ![Shawn\_Ferry](https://avatars.discourse-cdn.com/v4/letter/s/f0a364/32.png) [@Shawn\_Ferry](https://forum.ansible.com/u/Shawn_Ferry)\
**Post date:** [June 14, 2015, 2:35pm UTC](https://forum.ansible.com/t/when-check-comparing-stdout-against-numeric-value/18496/2 "2015-06-14T14:35:50Z")

</div>

Try this  
when: currentlimits.stdout|int \< 20000

---

<div class="post-metadata">

**Author:** ![Nusenu1](https://avatars.discourse-cdn.com/v4/letter/n/db5fbb/32.png) [@Nusenu1](https://forum.ansible.com/u/Nusenu1)\
**Post date:** [June 14, 2015, 8:42pm UTC](https://forum.ansible.com/t/when-check-comparing-stdout-against-numeric-value/18496/3 "2015-06-14T20:42:28Z")

</div>

> Try this when: currentlimits.stdout|int \< 20000

that fixed it,  
thank you!
