David K. Bainbridge | f307101 | 2016-08-04 09:29:55 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | J=$(which juju) |
| 4 | |
| 5 | if [ ! -z $J ]; then |
| 6 | juju remove-machine --force 12 |
| 7 | juju remove-machine --force 11 |
| 8 | juju remove-machine --force 10 |
| 9 | |
| 10 | RETRY=30 |
| 11 | while [ $RETRY -gt 0 -a $(juju status --format=tabular | grep "^10\|^11\|^12" | wc -l) -ne 0 ]; do |
| 12 | echo -n "." |
| 13 | RETRY=$(expr $RETRY - 1) |
| 14 | sleep 2 |
| 15 | done |
| 16 | echo |
| 17 | fi |
| 18 | |
| 19 | UVT=$(which uvt-kvm) |
| 20 | test -z $UVT || uvt-kvm list | xargs uvt-kvm destroy |
| 21 | |
David K. Bainbridge | 7ae4f19 | 2016-09-29 09:01:38 -0700 | [diff] [blame] | 22 | sudo apt-get remove --purge -y $(dpkg --get-selections | grep "nagioas\|juju\|nova\|neutron" | awk '{print $1}') &&sudo apt-get autoremove -y && sudo rm -rf /etc/juju /etc/neutron /home/ubuntu/.juju && sudo find / -name "*juju*" -exec rm -r \{\} \; && sudo rm -f /var/lib/uvtool/libvirt/images/* |
David K. Bainbridge | f307101 | 2016-08-04 09:29:55 -0700 | [diff] [blame] | 23 | |
| 24 | OVS=$(which ovs-vsctl) |
| 25 | |
| 26 | if [ ! -z $OVS ]; then |
| 27 | sudo ovs-vsctl del-br br-int |
| 28 | fi |
| 29 | |
| 30 | sudo ifdown fabric |
| 31 | sleep 3 |
| 32 | sudo ifup eth0 |
| 33 | sleep 3 |
| 34 | |
| 35 | IP=$(ifconfig fabric | grep "inet addr" | awk '{print $2}' | cut -d: -f2) |
| 36 | |
| 37 | case $(echo "$IP" | cut -d. -f3) in |
| 38 | 1) |
| 39 | TO=$(echo "$IP" | awk -F. '{printf("%s.%s.2.0/24", $1, $2)}') |
| 40 | GW=$(echo "$IP" | awk -F. '{printf("%s.%s.%s.254", $1, $2, $3)}') |
| 41 | ;; |
| 42 | 2) |
| 43 | TO=$(echo "$IP" | awk -F. '{printf("%s.%s.1.0/24", $1, $2)}') |
| 44 | GW=$(echo "$IP" | awk -F. '{printf("%s.%s.%s.254", $1, $2, $3)}') |
| 45 | ;; |
| 46 | esac |
| 47 | |
| 48 | sudo route add -net $TO gw $GW |