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