This link hints at existence of a module but I am unable to implement it. Any solution is anticipated.
If you're using Ansible 2.13 or later, you can use the clean
parameter:
- ansible.builtin.apt:
clean: yes
become: yes
In older versions, you can use the command
module:
- command: apt-get clean
become: yes