blob: 5adf79e93ef6a08d60490fc076c845d4d819b822 [file] [log] [blame]
David K. Bainbridgea677d4e2016-09-11 20:01:32 -07001#!/bin/bash
2
David K. Bainbridge8b179042016-11-30 15:38:42 -08003KEEP_DOCKER=0
4DOCKER_ENGINE="docker-engine"
5DOCKER_REGISTRY="/docker-registry /docker-registry-mirror"
6CONTAINER_LIST=$(docker ps -qa)
David K. Bainbridgea677d4e2016-09-11 20:01:32 -07007
David K. Bainbridge8b179042016-11-30 15:38:42 -08008while [ $# -gt 0 ]; do
9 case $1 in
10 -k|--keep-docker)
11 KEEP_DOCKER=1
12 DOCKER_ENGINE=
13 DOCKER_REGISTRY=
14 CONTAINER_LIST=$(docker ps --format '{{.ID}} {{.Names}}' | grep -v ' registry$' | grep -v ' registry-mirror$' | awk '{print $1}')
15 ;;
16 esac
17 shift
18done
19
20CONTAINER_LIST=$(docker ps --format '{{.ID}} {{.Names}}' | grep -v ' registry$' | grep -v ' registry-mirror$' | awk '{print $1}')
21
22docker kill $CONTAINER_LIST
23docker rm -f $CONTAINER_LIST
24if [ $KEEP_DOCKER -eq 0 ]; then
25 docker rmi -f $(docker images -aq)
26fi
27
28sudo apt-get remove --purge -y bind9 apache2 $DOCKER_ENGINE ansible $(dpkg --get-selections | grep maas | cut -f1)
David K. Bainbridgea677d4e2016-09-11 20:01:32 -070029
30sudo rm -rf \
31 /etc/maas \
32 /etc/bind \
33 /etc/apache2 \
34 /var/www \
35 /var/log/maas \
36 /var/lib/maas \
37 /etc/apt/apt.conf.d/02apt-cacher-ng \
38 /etc/apt/sources.list.d/apt_dockerproject_org_repo.list \
39 /etc/apt/sources.list.d/ppa_juju_stable_trusty.list \
40 /etc/apt/sources.list.d/docker.list \
41 /etc/apt/sources.list.d/ppa_maas_stable_trusty.list \
42 /etc/apt/sources.list.d/ppa_ansible_ansible_trusty.list \
43 /etc/network/if-pre-up.d/nat \
David K. Bainbridge8b179042016-11-30 15:38:42 -080044 $DOCKER_REGISTRY
David K. Bainbridgea677d4e2016-09-11 20:01:32 -070045
46sudo apt-get update -y
47
48# remove NAT rules
49sudo iptables --table nat --delete POSTROUTING --out-interface eth3 -j MASQUERADE
50sudo iptables --delete FORWARD --in-interface mgmtbr -j ACCEPT