What is the "vagrant-host-manager start id" in the /etc/hosts file?

695 Views Asked by At

I am using Vagrant(1.7.2), VirtualBox(4.3.26), along with puphpet on a project. I am using the vagrant plugin vagrant-host-manager to programmatically write to my /etc/hosts file on vagrant up and vagrant halt.

I notice that the plugin provides information in the comments of /etc/hosts

## vagrant-hostmanager-start id: 26c12a6f-22fd-4053-g193-77707p90318 (obfuscated id)

I thought perhaps that the id string was going contain the name of my running virtual machine, as it would appear in the VirtualBox GUI. That appears not to be the case. I would like to know how I may associate the above id to one my several machines.

I want to know this because I have several VM's containing the same IP address and set of host names, therefore I cannot easily discern which VM has written what.

1

There are 1 best solutions below

0
On

I was looking for the same, the ID is written by https://github.com/devopsgroup-io/vagrant-hostmanager/blob/2b75b7f00f4b929023c7d6e3cd70d75b334c560b/lib/vagrant-hostmanager/hosts_file/updater.rb#L166 to the hosts file.

The information is read from #{@global_env.local_data_path}/hostmanager/id and if that file does not exist, a new ID is generated by invoking SecureRandom.uuid

Basically if you need to know the ID, just read it from the .vagrant/hostmanager/id file relative to your Vagrantfile