From 6e1c8da3843c9ea524dc5543537483a49657f010 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 28 Dec 2025 19:17:25 +0300 Subject: [PATCH] Feat(debian): Add `clean-apt` playbook --- playbooks/debian/clean-apt.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 playbooks/debian/clean-apt.yaml diff --git a/playbooks/debian/clean-apt.yaml b/playbooks/debian/clean-apt.yaml new file mode 100644 index 0000000..8e80033 --- /dev/null +++ b/playbooks/debian/clean-apt.yaml @@ -0,0 +1,23 @@ +- name: Update Debian systems with apt + hosts: "{{ hosts | default('all') }}" + become: yes + gather_facts: false + tasks: + - name: Clean apt + apt: + clean: true + + - name: Find apt files + find: + paths: /var/lib/apt/lists + patterns: '*' + excludes: lock + depth: 1 + register: apt_list + - name: Clean apt files + file: + path: "{{ item.path }}" + state: absent + with_items: "{{ apt_list.files }}" + loop_control: + label: "{{ item.path }}" -- 2.47.3