azvyagintsev | 29410ee | 2018-07-12 20:02:30 +0300 | [diff] [blame] | 1 | #!/bin/bash -xe |
| 2 | |
azvyagintsev | 547dcae | 2018-07-27 13:58:26 +0300 | [diff] [blame^] | 3 | apt-get purge -y salt-formula-* |
azvyagintsev | 29410ee | 2018-07-12 20:02:30 +0300 | [diff] [blame] | 4 | |
azvyagintsev | 73fff7f | 2018-07-19 23:11:36 +0300 | [diff] [blame] | 5 | salt-call saltutil.clear_cache || true |
| 6 | |
azvyagintsev | 29410ee | 2018-07-12 20:02:30 +0300 | [diff] [blame] | 7 | echo "removing all previously accepted salt keys" |
| 8 | salt-key -D -y || true |
| 9 | |
| 10 | echo "cleaning up reclass" |
| 11 | rm -rf /srv/salt/reclass || true |
| 12 | rm -rf /srv/salt/scripts || true |
| 13 | rm -rf /usr/share/salt-formulas/env || true |
| 14 | # |
| 15 | mkdir -p /srv/salt/reclass/ |
| 16 | mkdir -p /usr/share/salt-formulas/reclass/service/ |
| 17 | mkdir -p /usr/share/salt-formulas/env/ |
| 18 | |
| 19 | # stop and disable services, for healthy zerodisk |
| 20 | # They should be enabled after VCP init |
azvyagintsev | 73fff7f | 2018-07-19 23:11:36 +0300 | [diff] [blame] | 21 | stop_services="salt-minion salt-master salt-api" |
azvyagintsev | 29410ee | 2018-07-12 20:02:30 +0300 | [diff] [blame] | 22 | for s in ${stop_services} ; do |
| 23 | systemctl stop ${s} || true |
| 24 | # Enable this, after refactoring salt:control:virtng |
| 25 | # systemctl disable ${s} || true |
| 26 | done |
| 27 | |
azvyagintsev | 73fff7f | 2018-07-19 23:11:36 +0300 | [diff] [blame] | 28 | # remove all keys at all |
| 29 | rm -rf /etc/salt/pki/* || true |
| 30 | |
azvyagintsev | 547dcae | 2018-07-27 13:58:26 +0300 | [diff] [blame^] | 31 | # Remove salt-master from apt01 |
| 32 | if [[ "$(hostname)" == *"apt01"* ]] ; then |
| 33 | apt-get purge -y salt-master |
| 34 | rm -rfv /etc/salt/master.d || true |
| 35 | fi |
| 36 | |
azvyagintsev | 29410ee | 2018-07-12 20:02:30 +0300 | [diff] [blame] | 37 | # Clear\drop cache's |
| 38 | sync |
| 39 | echo 3 > /proc/sys/vm/drop_caches |