#!/bin/bash set -e echo "updating all packages and removing unnecessary ones" apt update apt-get clean #apt upgrade -y #apt autoremove -y echo "stopping joule and lumen" service joule stop nginx -s stop echo "1] Remove the databases" sudo -u postgres psql <<END_OF_SQL DROP DATABASE joule; DROP DATABASE rails; END_OF_SQL echo "3] Erasing module and stream configurations" rm -f /etc/joule/module_configs/*.conf rm -f /etc/joule/stream_configs/*.conf echo "4] Removing default key material" rm -f /etc/joule/security/* rm -f /opt/api/config/secrets.yml echo "5] Enabling first_boot service" systemctl enable first_boot.service echo "5] Clearing command history" history -c rm -rf /root/puppet rm -rf /root/.joule rm -rf ~/.joule echo "6] Removing puppet" sudo apt remove puppet-agent echo "From cubic remove the ubuntu user with [deluser --remove-home ubuntu]" deluser systemd-coredump echo "If any user shows up below delete with deluser command:" history -c cat /etc/passwd | grep 999