[jenkins-ci PATCH v2] guests: Clean up packages after update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
Changes from [v1]:

  * call 'yum autoremove' when possible.

[v1] https://www.redhat.com/archives/libvir-list/2018-April/msg00970.html

 guests/tasks/base.yml | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
index 53cbd65..616db0a 100644
--- a/guests/tasks/base.yml
+++ b/guests/tasks/base.yml
@@ -117,6 +117,34 @@
   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
+  command: yum autoremove -y
+  args:
+    warn: no
+  when:
+    - package_format == 'rpm'
+    - not ( os_name == 'CentOS' and
+            os_version == '6' )
+
+- 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux