#!/bin/bash
# Maintainer: Martin Weise <martin.weise@tuwien.ac.at>
# Short:      Removes the core VMs
# Synopsis:   ./bin/teardown

echo -e "TEARDOWN [Start] ***************************************************************"

# Start the Ansible automated debug
ansible-playbook "./teardown.yml"

status=$?
if [ $status -eq 0 ]; then
  echo -e "TEARDOWN [Done] ****************************************************************"
  echo -e "\e[92mok: [localhost]\e[39m\n"
  echo ""
  echo -e "In case you want to set-up the reference implementation in the future, you have"
  echo -e "to manually delete the SSH host keys in ~/.ssh/known_hosts"
  exit 0
else
  echo -e "TEARDOWN [Done] ****************************************************************"
  echo -e "\e[91mfailed: playbook returned non-zero exit code\e[39m"
  exit 1
fi
