# apt autoclean/autoremove not working?

**URL:** <https://forum.ansible.com/t/apt-autoclean-autoremove-not-working/35885>\
**Category:** Ansible Project\
**Created:** [October 16, 2021, 9:18pm UTC](https://forum.ansible.com/t/apt-autoclean-autoremove-not-working/35885 "2021-10-16T21:18:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [October 16, 2021, 9:18pm UTC](https://forum.ansible.com/t/apt-autoclean-autoremove-not-working/35885/1 "2021-10-16T21:18:34Z")

</div>

Hii

On my Debian (11) systems I end up having many deb files in /var/cache/apt/archives, and I’m trying to get the apt module to clean those up at the end of a playbook.  
But I can’t get this to work using the documented options. None of the below tasks removes the files:

- name: Removed unused package from the cache  
apt:  
autoclean: yes

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

I have added update\_cache to them, but also to no avail.  
Any ideas?

Using

command: apt-get clean

does what I want, but that feels like throwing in the towel…

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [October 17, 2021, 7:28am UTC](https://forum.ansible.com/t/apt-autoclean-autoremove-not-working/35885/2 "2021-10-17T07:28:56Z")

</div>

OK, I incorrectly assumed ‘autoclean’ is the same as ‘clean’.  
The latter is not supported: [https://github.com/ansible/ansible/issues/38920](https://github.com/ansible/ansible/issues/38920)  
I’ll use the ‘command’ workaround for now.

thx
