Is it possible to have multi os , playbook without having factor or ohai on remote nodes ?
I have used $ansible_distribution successfully to detect OS in my playbook , when i try only_if … But i am not able to use the same to have OS specific variables, like using yum or apt based on OS, and select packages for yum or apt based on variables.
You don’t need ohai for $ansible_distribution. That’s alrady provided by facts. If your play optionally disabled facts (by writing gather_facts: no), then you won’t be able to them.