when check comparing stdout against numeric value?

670 views
Skip to first unread message

nusenu

unread,
Jun 14, 2015, 8:27:32 AM6/14/15
to ansible...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

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:
"stdout": "7030",
"stdout_lines": [
"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

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJVfXMcAAoJEFv7XvVCELh0NiQP/im/9oGsx2AfKnX3Tysdl+cO
krAOpLIO4OUlgxsJtDAi5imKAMHXzYko8O5H/FmpuEmTsTIZkaFPkogdrc6f5Iad
8X0VdiHAPHKFNvQZQmPODNuZycYm53xDT3kCmS6nlxC0v0Ls7+9EdtjN9Td+YLYC
iMqmPQ0+XpEnY1eD4ivyj9vICc1WgADnUsXHrIicWkvm98BQjCF3m6/tbF80Rd+l
n2UJSdKAdQQPFD4qr46zBKaq2QJJrCwOj/Pbxv7aIdjNX7kDN1KWmTWfEYcHpwGr
z0wE/bpWbYGCY9bkhuyx+ALwvcOBIjJ2dXU1MrkNCiy+zK221nznhhDwVQKZqjdA
6tZeeAhlEG0DAEPb9m3NCWjpjsa04Wxyxm+e/daXHOCDqQe56tGbuaWh7M3yeUGo
zWZYJhnqwajhKRvijEN52zigNXheOQGnkCBJyA+efbbYTv5yKe6tKPZqJerV/C9z
cfolboUqySA50QwqS1FHltfZKhM6OM3pSk5oNHwLbN8EZ1Mi6VGkv/P/RV7zt4vp
p2uRg6sgHLmSOn5Cm/h72P8X45m7TIoBwySZQMQ7y9SuhhVectrd+FP0IZ+O5EWI
af8KvD6NzqAyrDQSR1rOtGcvllqyaMMrPbjOfkXTj0clyOnx6F+Ena06oU4/sR1k
1Nx7SgtuiERorf6VTFSY
=oleT
-----END PGP SIGNATURE-----

Shawn Ferry

unread,
Jun 14, 2015, 10:36:06 AM6/14/15
to ansible...@googlegroups.com
Try this
when: currentlimits.stdout|int < 20000

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/557D731D.6030505%40openmailbox.org.
For more options, visit https://groups.google.com/d/optout.

nusenu

unread,
Jun 14, 2015, 4:42:44 PM6/14/15
to ansible...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

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

that fixed it,
thank you!
-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJVfeczAAoJEFv7XvVCELh0F1kP/j4tJmIMIOG6ku7gW/kpfeSK
6LczntIwU6cSK3jhHkFJKheUTtqesvd+1dltIzHbtlnKLFb7F4uujibPF8ufhZKB
i6PCcSmcDJCy1p09qJXqN2B2LnlxsSL1vWShtz6npGPTaV6rnfgozKYODr4armzj
NiTksyB8O9HeIWtTePkpajYRdeQkY3jhb+MUTwfJC0WXm/p3FheywIXKdFwHhPGT
kvsbe9NtSc9YWL9whD65MKyDR99jhGTK1s4abHaXAaRjWgTRn9rlCbfmM3+/jzQ2
AVzVSu86u6pdEneGDf39YFSGNi4HxG2GJGYGcReLruSDqLHoHLqiMlWY8+MCtt97
UN1OiMUDXHcKfru7jWBLc42BuK8dHAJuBS+LdBbf6prwuJqPBofsrl9AybxUrMQg
4PNnrwlPgzvUJLlwPo96QlehhrVUiz6N9uUOUiw5jxt6q6cjHZK+BxX6EGrokQzg
muadoafGw5xsWLWQ6a+oQVb9jIOqyKMIId0sdRAj7cNLDt/haMNnvU8NbOf/X0Mc
L9VZNDwkFu8x+MXzRzw8h0eR0bM4LmISoVqJh7ZHqeqMfYIdHln+5cVOR/ITCFfo
GT6MfxdY85PLuwQEOgv859dVGBcMHbSYMqjgvPG2gX4qXk3NCD6j1bv/uPrVRmPt
Es5eZYN2nQeJYI5yyXUS
=6O+0
-----END PGP SIGNATURE-----
Reply all
Reply to author
Forward
0 new messages