blob: f3b09e72e16af3728b637454bbb34746637b122f [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
David K. Bainbridge0a7cdbb2017-07-14 11:36:13 -07004DOCKER_ENGINE="docker-ce"
David K. Bainbridge8b179042016-11-30 15:38:42 -08005DOCKER_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
David K. Bainbridge0a7cdbb2017-07-14 11:36:13 -070020docker rm -f $(docker ps -aq)
21docker rmi -f $(docker images -q)
22docker volume rm -f $(docker volume ls -q)
23docker network rm $(docker network ls -q)
24sudo apt-get remove --purge -y bind9 apache2 apt-cacher-ng $DOCKER_ENGINE ansible $(dpkg --get-selections | grep maas | cut -f1)
David K. Bainbridgea677d4e2016-09-11 20:01:32 -070025
26sudo rm -rf \
27 /etc/maas \
28 /etc/bind \
29 /etc/apache2 \
30 /var/www \
31 /var/log/maas \
32 /var/lib/maas \
33 /etc/apt/apt.conf.d/02apt-cacher-ng \
34 /etc/apt/sources.list.d/apt_dockerproject_org_repo.list \
35 /etc/apt/sources.list.d/ppa_juju_stable_trusty.list \
36 /etc/apt/sources.list.d/docker.list \
37 /etc/apt/sources.list.d/ppa_maas_stable_trusty.list \
38 /etc/apt/sources.list.d/ppa_ansible_ansible_trusty.list \
39 /etc/network/if-pre-up.d/nat \
David K. Bainbridge0a7cdbb2017-07-14 11:36:13 -070040 /etc/apt/apt.conf.d/03apt-cacher-ng \
David K. Bainbridge8b179042016-11-30 15:38:42 -080041 $DOCKER_REGISTRY
David K. Bainbridgea677d4e2016-09-11 20:01:32 -070042
43sudo apt-get update -y
44
45# remove NAT rules
46sudo iptables --table nat --delete POSTROUTING --out-interface eth3 -j MASQUERADE
47sudo iptables --delete FORWARD --in-interface mgmtbr -j ACCEPT