I use DigitalOcean and I want to use only one droplet, so I'd always work only with one ip (per LTS distro release). The benefit is not having the replace IP address in various software like Putty, WinSCP, PHPmyadmin, DigitalOcean DNS management tool (DNSMT), and maybe some other software, especially when training with different droplets or when I want to fully reinstall from whatever reason.
I don't do any Kernel/Shell customizations whatsoever.
How to rebuild a DigitalOcean droplet without using "rebuild" of the DigitalOcean API?
Or at least, what's the closest way to get that?
As for "the closest way" I thought of the following script, which might be missing something:
#!/bin/bash
apt-get purge everything_installed_from_apt_so_far -y
rm -rf every_inode_added_so_far
find /var/mail/* /var/log/* -type f -exec truncate -s 0 {} \;
apt autoremove -y && apt clean -y
Of course, one could use a long one-liner curl DigitalOcean API call or use a DigitalOcean snapshot ("droplet state save", which costs money) right after creating the droplet, but I'm looking for a global way, not dependent on DigitalOcean, which is also minimal in the sense of Bash-only.