Seth implemented a very nice yum module for installing packages. (Thanks, Seth!)
Usage is listed on the examples page and the modules page, but in short:
package should be the latest version in the yum repo
ansible webservers -m yum pkg=cobbler state=latest
package should be a specific version
ansible webservers -m yum pkg=acme-2.0 state=installed
package should not be installed
ansible webservers -m yum pkg=acme state=removed
any version should be installed
ansible webservers -m yum pkg=acme state=installed
There are also various list commands as documented on the module page.
Try it out from the latest source code pull.
–Michael