

- name: Remove useless packages from the cache
  ansible.builtin.apt:
    autoclean: yes

- name: Remove dependencies that are no longer required
  ansible.builtin.apt:
    autoremove: yes

- name: Run the equivalent of "apt-get clean" as a separate step
  apt:
    clean: yes
aP