set_fact not working with when condition

I have a role, and in the defaults/main.yml I have the following variable set:

`

ansible_distribution_major_version is a string, and you are comparing it to an integer of 6.

You can do one of a few things:

when: ansible_distribution_major_version|int > 6

or

when: ansible_distribution_major_version is version(‘6’, ‘gt’)

https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html#version-comparison

Ah, great thanks Matt! I went down that path before submitting this, but my syntax was wrong. Thanks again!