I am trying to extract the major distro version (which ansible_facts holds as a string) and store it as an integer for later < or > comparison to an integer. When I do this:
set_fact:
distromajor: "{{ ansible_facts['distribution_major_version'] | int }}"
I find distromajor holds "7" instead of 7. So later comparisons fail. In fact, the only way I can get it to work is to compare like this:
(distromajor|int >=6) and (distromajor|int <= 8)
Is this expected behaviour? Why can I not save the distro major version as an int?
The closest SO question does not explain why a later integer comparison FAILS without reconverting the distromajor variable to int at time of comparison.