The package cache can grow to eat up a lot of disk space, and
not removing unused packages can lead to upgrade issues down
the line for fast moving distributions such as Fedora Rawhide.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/tasks/base.yml | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
index 53cbd65..f419433 100644
--- a/guests/tasks/base.yml
+++ b/guests/tasks/base.yml
@@ -117,6 +117,25 @@
when:
- package_format == 'pkg'
+- name: Clean up packages after update
+ command: yum clean packages -y
+ args:
+ warn: no
+ when:
+ - package_format == 'rpm'
+
+- name: Clean up packages after update
+ apt:
+ autoclean: yes
+ autoremove: yes
+ when:
+ - package_format == 'deb'
+
+- name: Clean up packages after update
+ shell: pkg clean -y && pkg autoremove -y
+ when:
+ - package_format == 'pkg'
+
- name: Configure hostname
hostname:
name: '{{ inventory_hostname }}'
--
2.14.3