ansible-role-firewall
ansible-role-firewall copied to clipboard
Version comparision for RedHat based distributions
In file tasks/persist-redhat.yml
to compare version number it's better to use filter |int >= 7
and |int < 7
- then the comparision will work correctly also for versions bigger than 9
. This change will make this role working properly also on Fedora 28 servers - as it happened to me..
It's mentioned here:
Tip: Sometimes you’ll get back a variable that’s a string and you’ll want to do a math operation comparison on it. You can do this like so:
tasks:
- shell: echo "only on Red Hat 6, derivatives, and later" when: ansible_facts['os_family'] == "RedHat" and ansible_facts['lsb']['major_release']|int >= 6