blob: f3b09e72e16af3728b637454bbb34746637b122f [file] [log] [blame]
#!/bin/bash
KEEP_DOCKER=0
DOCKER_ENGINE="docker-ce"
DOCKER_REGISTRY="/docker-registry /docker-registry-mirror"
CONTAINER_LIST=$(docker ps -qa)
while [ $# -gt 0 ]; do
case $1 in
-k|--keep-docker)
KEEP_DOCKER=1
DOCKER_ENGINE=
DOCKER_REGISTRY=
CONTAINER_LIST=$(docker ps --format '{{.ID}} {{.Names}}' | grep -v ' registry$' | grep -v ' registry-mirror$' | awk '{print $1}')
;;
esac
shift
done
docker rm -f $(docker ps -aq)
docker rmi -f $(docker images -q)
docker volume rm -f $(docker volume ls -q)
docker network rm $(docker network ls -q)
sudo apt-get remove --purge -y bind9 apache2 apt-cacher-ng $DOCKER_ENGINE ansible $(dpkg --get-selections | grep maas | cut -f1)
sudo rm -rf \
/etc/maas \
/etc/bind \
/etc/apache2 \
/var/www \
/var/log/maas \
/var/lib/maas \
/etc/apt/apt.conf.d/02apt-cacher-ng \
/etc/apt/sources.list.d/apt_dockerproject_org_repo.list \
/etc/apt/sources.list.d/ppa_juju_stable_trusty.list \
/etc/apt/sources.list.d/docker.list \
/etc/apt/sources.list.d/ppa_maas_stable_trusty.list \
/etc/apt/sources.list.d/ppa_ansible_ansible_trusty.list \
/etc/network/if-pre-up.d/nat \
/etc/apt/apt.conf.d/03apt-cacher-ng \
$DOCKER_REGISTRY
sudo apt-get update -y
# remove NAT rules
sudo iptables --table nat --delete POSTROUTING --out-interface eth3 -j MASQUERADE
sudo iptables --delete FORWARD --in-interface mgmtbr -j ACCEPT