Ansible:Do task if host belongs to specific operating system and version

Some times we require to run specific commands on specific operating systems. This is because some commands will work in one distribution and other will not work. Ansible is good at dealing with this type of situations with three variables