Switch system-reseal script to shell 88/8288/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Mon, 8 Jan 2018 02:35:31 +0000 (21:35 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Mon, 8 Jan 2018 03:47:59 +0000 (22:47 -0500)
While it would be nice to do things the Ansible way the "file"
method unnecessarily takes too long to remove files in a loop.
In this case we should just handle the cleanup with a quick script
which will run significantly more quickly.

Change-Id: I09145b1ece235ea523cf30fd9c8e13efdcbdb8fb
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
provision/baseline.yaml
provision/docker.yaml
provision/system-reseal.sh [new file with mode: 0644]
provision/system-reseal.yaml [deleted file]

index 84dde1b..ac7a12e 100644 (file)
@@ -62,4 +62,4 @@
       become: yes
 
     - name: System Reseal
-      include_tasks: system-reseal.yaml
+      script: system-reseal.sh
index beaec67..1f3e26c 100644 (file)
@@ -13,4 +13,4 @@
 
   post_tasks:
     - name: System Reseal
-      include_tasks: system-reseal.yaml
+      script: system-reseal.sh
diff --git a/provision/system-reseal.sh b/provision/system-reseal.sh
new file mode 100644 (file)
index 0000000..cb2704e
--- /dev/null
@@ -0,0 +1,89 @@
+#!/bin/bash
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2016 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+# Cleans up VM as preparation for image snapshotting
+
+# vim: sw=2 ts=2 sts=2 et :
+
+rm -rf ~/.viminfo \
+    /etc/Pegasus/*.cnf \
+    /etc/Pegasus/*.crt \
+    /etc/Pegasus/*.csr \
+    /etc/Pegasus/*.pem \
+    /etc/Pegasus/*.srl \
+    /etc/ssh/ssh*key* \
+    /root/.ssh/* \
+    /root/anaconda-ks.cfg \
+    /root/anaconda-post.log \
+    /root/initial-setup-ks.cfg \
+    /root/install.log \
+    /root/install.log.syslog \
+    /tmp/* \
+    /var/cache/fontconfig/* \
+    /var/cache/gdm/* \
+    /var/cache/man/* \
+    /var/lib/AccountService/users/* \
+    /var/lib/cloud/* \
+    /var/lib/fprint/* \
+    /var/lib/logrotate.status \
+    /var/log/*.log* \
+    /var/log/BackupPC/LOG \
+    /var/log/ConsoleKit/* \
+    /var/log/anaconda.syslog \
+    /var/log/anaconda/* \
+    /var/log/apache2/*_log \
+    /var/log/apache2/*_log-* \
+    /var/log/apt/* \
+    /var/log/aptitude* \
+    /var/log/audit/* \
+    /var/log/btmp* \
+    /var/log/ceph/*.log \
+    /var/log/chrony/*.log \
+    /var/log/cron* \
+    /var/log/cups/*_log \
+    /var/log/debug* \
+    /var/log/dmesg* \
+    /var/log/exim4/* \
+    /var/log/faillog* \
+    /var/log/gdm/* \
+    /var/log/glusterfs/*glusterd.vol.log \
+    /var/log/glusterfs/glusterfs.log \
+    /var/log/httpd/*log \
+    /var/log/installer/* \
+    /var/log/jetty/jetty-console.log \
+    /var/log/journal/* \
+    /var/log/lastlog* \
+    /var/log/libvirt/libvirtd.log \
+    /var/log/libvirt/lxc/*.log \
+    /var/log/libvirt/qemu/*.log \
+    /var/log/libvirt/uml/*.log \
+    /var/log/lightdm/* \
+    /var/log/mail/* \
+    /var/log/maillog* \
+    /var/log/messages* \
+    /var/log/ntp \
+    /var/log/ntpstats/* \
+    /var/log/ppp/connect-errors \
+    /var/log/rhsm/* \
+    /var/log/sa/* \
+    /var/log/secure* \
+    /var/log/setroubleshoot/*.log \
+    /var/log/spooler* \
+    /var/log/squid/*.log \
+    /var/log/syslog* \
+    /var/log/tallylog* \
+    /var/log/tuned/tuned.log \
+    /var/log/wtmp* \
+    /var/named/data/named.run
+
+# Force a system sync and sleep to get around any SSD issues
+echo "Forcing sync and sleep for 10sec"
+sync
+sleep 10
diff --git a/provision/system-reseal.yaml b/provision/system-reseal.yaml
deleted file mode 100644 (file)
index 4c3d3ce..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
----
-- name: System reseal
-  file:
-    path: '{{del}}'
-    state: absent
-  with_items:
-    - ~/.viminfo
-    - /etc/Pegasus/*.cnf
-    - /etc/Pegasus/*.crt
-    - /etc/Pegasus/*.csr
-    - /etc/Pegasus/*.pem
-    - /etc/Pegasus/*.srl
-    - /etc/ssh/ssh*key*
-    - /root/.ssh/*
-    - /root/anaconda-ks.cfg
-    - /root/anaconda-post.log
-    - /root/initial-setup-ks.cfg
-    - /root/install.log
-    - /root/install.log.syslog
-    - /tmp/*
-    - /var/cache/fontconfig/*
-    - /var/cache/gdm/*
-    - /var/cache/man/*
-    - /var/lib/AccountService/users/*
-    - /var/lib/cloud/*
-    - /var/lib/fprint/*
-    - /var/lib/logrotate.status
-    - /var/log/*.log*
-    - /var/log/BackupPC/LOG
-    - /var/log/ConsoleKit/*
-    - /var/log/anaconda.syslog
-    - /var/log/anaconda/*
-    - /var/log/apache2/*_log
-    - /var/log/apache2/*_log-*
-    - /var/log/apt/*
-    - /var/log/aptitude*
-    - /var/log/audit/*
-    - /var/log/btmp*
-    - /var/log/ceph/*.log
-    - /var/log/chrony/*.log
-    - /var/log/cron*
-    - /var/log/cups/*_log
-    - /var/log/debug*
-    - /var/log/dmesg*
-    - /var/log/exim4/*
-    - /var/log/faillog*
-    - /var/log/gdm/*
-    - /var/log/glusterfs/*glusterd.vol.log
-    - /var/log/glusterfs/glusterfs.log
-    - /var/log/httpd/*log
-    - /var/log/installer/*
-    - /var/log/jetty/jetty-console.log
-    - /var/log/journal/*
-    - /var/log/lastlog*
-    - /var/log/libvirt/libvirtd.log
-    - /var/log/libvirt/lxc/*.log
-    - /var/log/libvirt/qemu/*.log
-    - /var/log/libvirt/uml/*.log
-    - /var/log/lightdm/*
-    - /var/log/mail/*
-    - /var/log/maillog*
-    - /var/log/messages*
-    - /var/log/ntp
-    - /var/log/ntpstats/*
-    - /var/log/ppp/connect-errors
-    - /var/log/rhsm/*
-    - /var/log/sa/*
-    - /var/log/secure*
-    - /var/log/setroubleshoot/*.log
-    - /var/log/spooler*
-    - /var/log/squid/*.log
-    - /var/log/syslog*
-    - /var/log/tallylog*
-    - /var/log/tuned/tuned.log
-    - /var/log/wtmp*
-    - /var/named/data/named.run
-  loop_control:
-    loop_var: del
-  become: yes
-
-- name: Force system sync and sleep for 10 seconds
-  block:
-    - shell: sync
-    - pause:
-        seconds: 10