Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 1 | #!/bin/bash -xe |
Jiri Broulik | 0b21167 | 2018-04-11 09:35:47 +0200 | [diff] [blame] | 2 | |
| 3 | apt-get purge salt-formula-* -y |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 4 | apt-get -y autoremove --purge |
| 5 | apt-get -y clean |
azvyagintsev | a07a5d7 | 2018-06-05 18:33:50 +0300 | [diff] [blame] | 6 | |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 7 | rm -rf /var/lib/ntp/ntp.conf.dhcp || true |
Jiri Broulik | 0b21167 | 2018-04-11 09:35:47 +0200 | [diff] [blame] | 8 | rm -rf /var/lib/apt/lists/* |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 9 | rm -rv /etc/apt/sources.list.d/* || true |
| 10 | echo > /etc/apt/sources.list || true |
| 11 | rm -vf /usr/sbin/policy-rc.d || true |
azvyagintsev | a07a5d7 | 2018-06-05 18:33:50 +0300 | [diff] [blame] | 12 | |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 13 | echo "cleaning up reclass" |
| 14 | rm -rf /srv/salt/reclass || true |
| 15 | rm -rf /srv/salt/scripts || true |
| 16 | rm -rf /usr/share/salt-formulas/env || true |
| 17 | # |
| 18 | mkdir -p /srv/salt/reclass/ |
| 19 | mkdir -p /usr/share/salt-formulas/reclass/service/ |
| 20 | mkdir -p /usr/share/salt-formulas/env/ |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 21 | |
| 22 | echo "cleaning up hostname" |
| 23 | sed -i "/.*ubuntu.*/d" /etc/hosts |
| 24 | sed -i "/.*salt.*/d" /etc/hosts |
| 25 | |
| 26 | echo "cleaning up guest additions" |
| 27 | rm -rf VBoxGuestAdditions_*.iso VBoxGuestAdditions_*.iso.? || true |
| 28 | |
| 29 | echo "cleaning up dhcp leases" |
| 30 | rm -rf /var/lib/dhcp/* || true |
| 31 | |
| 32 | echo "cleaning up udev rules" |
| 33 | rm -f /etc/udev/rules.d/70-persistent-net.rules || true |
| 34 | rm -rf /dev/.udev/ || true |
| 35 | rm -f /lib/udev/rules.d/75-persistent-net-generator.rules || true |
| 36 | |
| 37 | echo "cleaning up minion_id for salt" |
| 38 | rm -f /etc/salt/minion_id || true |
| 39 | |
| 40 | echo "cleaning up resolvconf" |
| 41 | sed -i '/172\.18\.208\.44/d' /etc/resolvconf/resolv.conf.d/base |
| 42 | |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 43 | # stop and disable services, for healthy zerodisk |
| 44 | # They should be enabled after cfg01 init |
| 45 | stop_services="postgresql.service salt-api salt-master salt-minion jenkins maas-rackd.service maas-regiond.service" |
| 46 | for s in ${stop_services} ; do |
| 47 | systemctl stop ${s} || true |
| 48 | systemctl disable ${s} || true |
| 49 | done |
| 50 | |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 51 | echo 3 > /proc/sys/vm/drop_caches |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 52 | sync |