If you see a similar error message as the following when running Ansible on a Fedora 23 machines, there is an easy fix.

ansible_fedora23_dnf

It is very likely that a package “python2-dnf” is missing. This package is required for Python script to interact with DNF package manager.

ansible_fedora24_dnf

There is a good article available at fedoramagazine.org about running Ansible on Fedora 23. (I only found this later, and it’s very informative.)