Jurudocs
Jurudocs

Reputation: 9185

Is it possible to determine the id of vagrant vm in the vagrantfile?

I read that it's possible to create a file with the name "id" and with the written id inside and put it into .vagrant/... directory. But is it also possible to determine the id in the vagrantfile?

Upvotes: 2

Views: 3825

Answers (1)

Frederic Henri
Frederic Henri

Reputation: 53793

As Vagrantfile is a ruby script you can always read the id file from Vagrantfile

Vagrant.configure(2) do |config|
  p "read uuid " + File.read(".vagrant/machines/default/virtualbox/index_uuid")
  p "read id " + File.read(".vagrant/machines/default/virtualbox/id")

Upvotes: 3

Related Questions