# Ansible Not Properly Evaluating Filter Using Less Than For OS Version

**URL:** <https://forum.ansible.com/t/ansible-not-properly-evaluating-filter-using-less-than-for-os-version/35324>\
**Category:** AWX Project\
**Created:** [June 9, 2021, 8:58pm UTC](https://forum.ansible.com/t/ansible-not-properly-evaluating-filter-using-less-than-for-os-version/35324 "2021-06-09T20:58:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcus\_Hayhurst](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@Marcus\_Hayhurst](https://forum.ansible.com/u/Marcus_Hayhurst)\
**Post date:** [June 9, 2021, 8:58pm UTC](https://forum.ansible.com/t/ansible-not-properly-evaluating-filter-using-less-than-for-os-version/35324/1 "2021-06-09T20:58:41Z")

</div>

I’m attempting to get Ansible to check CentOS and RedHat OS versions. If the version is less than 7.9 then it will list: Hostnames - OS Version in an email. However, Ansible does not appear to be evaluating this properly because I receive an email list of machines with version 7.9.:

**VMGUEST03 - REDHAT 7.8**  
**VMGUEST01 - REDHAT 7.9**  
**VMGUEST02 - REDHAT 7.8**

Does anyone know how I can correct this?

Here’s my Playbook:

- name: COLLECT INFORMATION ON ALL MACHINES  
set\_fact:  
machine\_info:  
“{% for host in ansible\_play\_batch %}{% if ansible\_facts.distribution\_version | float \< 7.9 %}{{ hostvars[host][‘ansible\_hostname’] }} - {{ hostvars[host][‘ansible\_distribution’] }} {{ hostvars[host][‘ansible\_distribution\_version’] }}  
{% endif %}{% endfor %}”  
run\_once: yes  
ignore\_errors: True
