Created: 2018-11-27 — modified: 2018-11-27 — tags: Vagrant
How to cleanup vagrant global-status? TL;DR: vagrant global-status --prune
Vagrant is a very useful tool to quickly spin up VM environments, given Vagrantfile.
It simplifies creating VMs to simple
vagrant up command, that does everything for you.
For example, we in CFEngine provide such environments for testing - they create VMs, install CFengine, bootstrap it to each other - and then you can just
vagrant ssh hub to get into VM to explore, or open Mission Portal and enjoy.
So, to use Vagrant, you must be in directory with a Vagrantfile.
vagrant global-status is a command that shows you all VMs created by Vagrant, no matter in what directory they were created.
But sometimes, if you played too much, you could delete the directory with Vagrantfile - after that you can delete VM from your usual VM manager interface (usually, VirtualBox) - and it seems to be almost cleaned up, except that
vagrant global-status still prints it.
How can you clean it? Easy:
vagrant global-status --prune
And all non-existing VMs will be gone!