How to compare kernel (or other) version numbers in Ansible

To Print the host IP address if the kernel version is less than 3

Ansible Version : 2.0.0.2

---
- hosts: all
  vars:
   kernel_version: "{{ ansible_kernel }}"
  tasks:
   - name: 'kernel version from facts'
     debug:
      msg: '{{ansible_all_ipv4_addresses}} {{ansible_kernel}}'
     when: ansible_kernel |  version_compare('3','<')

**

In 2.5 version_compare was renamed to version

**


There is a test for it:

{{ ansible_distribution_version is version('12.04', '>=') }}

{{ sample_version_var is version('1.0', operator='lt', strict=True) }}