Just a tiny remark: When you have the above, mostly one will want/need to use another user than root, at least to access the system.
Instead of using -u root one may prefer to add --sudo, so that the non-root ansible user will try to execute the command using sudo.
eg:
ansible ws01 -m yum -a 'pkg=vim-enhanced state=installed' -i hosts -u remadmin --sudo
Where remadmin is a user that can do keybased ssh to the system ws01 and is a nopasswd sudoer.