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