title: vagrant manage hosts dhcp
body: <p>I want to automatically add/remove an entry alias to/from my <code>/etc/hosts</code> file based on the project's dirname and VM's IP address every time I run <code>vagrant up</code> / <code>vagrant destroy</code>. There are some plugins doing this but without support for dhcp. </p>
  
  <p>I'm building the dirname using <code>machine_name = File.basename(File.expand_path('..', Dir.pwd)) + '.local'</code>.</p>
  
  <p>The other piece of the puzzle that I'm missing is a way to get the VM's dhcp assigned IP address in the Vagrantfile and update /etc/hosts file on the host machine.</p>
  
  <p>My goal is to spin-up a VM without editing it's name and/or IP in the Vagrantfile and /etc/hosts. </p>
  
  <p>I'm using Vagrant 1.7.4, VirtualBox 5.x and Puppet 4.2.</p>
  
  <p>Any ideas?</p>