If you are not familiar with modules, check out Ansible - Getting Started with Modules.
The yum module is used to install packages on a Red Hat distribution of Linux on the managed node (e.g. the target system). When state: absent is used, the package will be uninstalled. In this example, if the wget package will be removed.
- name: yum remove wget yum: name: wget state: absent