On SaltStack one can execute:
salt -G 'os:CentOS' test.version
-G means filter managed nodes using grains. SaltStack's Grains is an equivalent of Ansible's facts. SaltStack is caching grains on controller, so this functionality is not a problem. Ansible has some facts caching too but it looks like there is not much use of it. Is something like this possible with Ansible?
I know it can be done using custom dynamic inventory modules or by embedding some code inside playbook, but I'm looking for something more ad-hoc.