title: Vagrant: Ansible set hosts entries via provision
body: <p>i have a question again. I'm looking for a possibility to set hosts entries for domains in vagrant ansible without using my local and guest hosts files.</p>
  
  <p>I read something about the inventory file, so tried it. The following content is in the file itself:</p>
  
  <pre><code>[myvm]
  the-vm.local
  </code></pre>
  
  <p>Here is the error I got from </p>
  
  <pre><code>==&gt; myvm: Running provisioner: ansible...
  ANSIBLE_FORCE_COLOR=true ANSIBLE_HOST_KEY_CHECKING=false PYTHONUNBUFFERED=1 ansible-playbook --private-key=/Users/me/.vagrant.d/insecure_private_key --user=vagrant --limit='myvm' --inventory-file=ansible/hosts -v ansible/playbook.yml
  
  PLAY [all] ******************************************************************** 
  
  GATHERING FACTS *************************************************************** 
  fatal: [the-vm.local] =&gt; SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue
  
  TASK: [Required packages present] ********************************************* 
  FATAL: no hosts matched or all hosts have already failed -- aborting
  
  
  PLAY RECAP ******************************************************************** 
         to retry, use: --limit @/Users/me/playbook.retry
  
  the-vm.local               : ok=0    changed=0    unreachable=1    failed=0   
  
  Ansible failed to complete successfully. Any error output should be
  visible above. Please fix these errors and try again.
  </code></pre>
  
  <p>Any clue how to solve that or is there any other way to do it? </p>
  
  <p>Thanks in upfront!</p>