blob: 07a1a9db6402ecdaa841c38da48f3ddab72f3e77 [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
Petr Ruzicka73063502018-07-11 09:21:13 +020013
14echo "removeing all previously accepted salt keys"
15salt-key -D -y || true
16
azvyagintsev0adfe682018-06-13 16:29:40 +030017echo "cleaning up reclass"
18rm -rf /srv/salt/reclass || true
19rm -rf /srv/salt/scripts || true
20rm -rf /usr/share/salt-formulas/env || true
21#
22mkdir -p /srv/salt/reclass/
23mkdir -p /usr/share/salt-formulas/reclass/service/
24mkdir -p /usr/share/salt-formulas/env/
Jiri Broulik4ea221c2018-04-10 13:48:06 +020025
26echo "cleaning up hostname"
27sed -i "/.*ubuntu.*/d" /etc/hosts
28sed -i "/.*salt.*/d" /etc/hosts
29
30echo "cleaning up guest additions"
31rm -rf VBoxGuestAdditions_*.iso VBoxGuestAdditions_*.iso.? || true
32
33echo "cleaning up dhcp leases"
34rm -rf /var/lib/dhcp/* || true
35
36echo "cleaning up udev rules"
37rm -f /etc/udev/rules.d/70-persistent-net.rules || true
38rm -rf /dev/.udev/ || true
39rm -f /lib/udev/rules.d/75-persistent-net-generator.rules || true
40
41echo "cleaning up minion_id for salt"
42rm -f /etc/salt/minion_id || true
43
44echo "cleaning up resolvconf"
45sed -i '/172\.18\.208\.44/d' /etc/resolvconf/resolv.conf.d/base
46
azvyagintsev0adfe682018-06-13 16:29:40 +030047# stop and disable services, for healthy zerodisk
48# They should be enabled after cfg01 init
49stop_services="postgresql.service salt-api salt-master salt-minion jenkins maas-rackd.service maas-regiond.service"
50for s in ${stop_services} ; do
51 systemctl stop ${s} || true
52 systemctl disable ${s} || true
53done
54
Jiri Broulik4ea221c2018-04-10 13:48:06 +020055echo 3 > /proc/sys/vm/drop_caches
azvyagintsev0adfe682018-06-13 16:29:40 +030056sync