blob: 2b5ccbc0ea21b2854c65776af1fa44d20e8b8e8c [file] [log] [blame]
Jiri Broulik4ea221c2018-04-10 13:48:06 +02001#!/bin/bash -xe
Jiri Broulik0b211672018-04-11 09:35:47 +02002
3apt-get purge salt-formula-* -y
Jiri Broulik4ea221c2018-04-10 13:48:06 +02004apt-get -y autoremove --purge
5apt-get -y clean
azvyagintseva07a5d72018-06-05 18:33:50 +03006
azvyagintsev0adfe682018-06-13 16:29:40 +03007rm -rf /var/lib/ntp/ntp.conf.dhcp || true
Jiri Broulik0b211672018-04-11 09:35:47 +02008rm -rf /var/lib/apt/lists/*
azvyagintsev0adfe682018-06-13 16:29:40 +03009rm -rv /etc/apt/sources.list.d/* || true
10echo > /etc/apt/sources.list || true
11rm -vf /usr/sbin/policy-rc.d || true
azvyagintseva07a5d72018-06-05 18:33:50 +030012
azvyagintsev0adfe682018-06-13 16:29:40 +030013echo "cleaning up reclass"
14rm -rf /srv/salt/reclass || true
15rm -rf /srv/salt/scripts || true
16rm -rf /usr/share/salt-formulas/env || true
17#
18mkdir -p /srv/salt/reclass/
19mkdir -p /usr/share/salt-formulas/reclass/service/
20mkdir -p /usr/share/salt-formulas/env/
Jiri Broulik4ea221c2018-04-10 13:48:06 +020021
22echo "cleaning up hostname"
23sed -i "/.*ubuntu.*/d" /etc/hosts
24sed -i "/.*salt.*/d" /etc/hosts
25
26echo "cleaning up guest additions"
27rm -rf VBoxGuestAdditions_*.iso VBoxGuestAdditions_*.iso.? || true
28
29echo "cleaning up dhcp leases"
30rm -rf /var/lib/dhcp/* || true
31
32echo "cleaning up udev rules"
33rm -f /etc/udev/rules.d/70-persistent-net.rules || true
34rm -rf /dev/.udev/ || true
35rm -f /lib/udev/rules.d/75-persistent-net-generator.rules || true
36
37echo "cleaning up minion_id for salt"
38rm -f /etc/salt/minion_id || true
39
40echo "cleaning up resolvconf"
41sed -i '/172\.18\.208\.44/d' /etc/resolvconf/resolv.conf.d/base
42
azvyagintsev0adfe682018-06-13 16:29:40 +030043# stop and disable services, for healthy zerodisk
44# They should be enabled after cfg01 init
45stop_services="postgresql.service salt-api salt-master salt-minion jenkins maas-rackd.service maas-regiond.service"
46for s in ${stop_services} ; do
47 systemctl stop ${s} || true
48 systemctl disable ${s} || true
49done
50
Jiri Broulik4ea221c2018-04-10 13:48:06 +020051echo 3 > /proc/sys/vm/drop_caches
azvyagintsev0adfe682018-06-13 16:29:40 +030052sync