title: Getting Ansible example (jboss-standalone) to work with Vagrant
body: <p>I need some assistance with getting <a href="https://github.com/ansible/ansible-examples.git" rel="nofollow">https://github.com/ansible/ansible-examples.git</a> / jboss-standalone to work with Vagrant.  I think I am making the same mistake, with my Vagrant configuration.</p>
  
  <p>My Vagrantfile is here:</p>
  
  <pre><code>VAGRANTFILE_API_VERSION = "2"
  
  Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    config.vm.box = "chef/centos-6.6"
  
    config.vm.network "forwarded_port", guest: 80, host: 8080
    config.vm.hostname = "webserver1"
  
    config.vm.provision :ansible do |ansible|
    ansible.playbook = "site.yml"
    ansible.verbose = "vvvv"
    ansible.inventory_path = "/Users/miledavenport/vagrant-ansible/jboss-standalone/hosts"
    end
  end
  </code></pre>
  
  <p>My hosts file is here:</p>
  
  <pre><code># Generated by Vagrant
  default ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222
  
  [jboss-servers]
  webserver1
  
  [webserver1]
  127.0.0.1              ansible_connection=local
  
  
  
  [localhost]
  127.0.0.1
  </code></pre>
  
  <p>I am fairly new to using ansible, and want to "play" with Ansible, by using Vagrant.</p>
  
  <p>"vagrant up" produces the following error:</p>
  
  <pre><code>TASK: [jboss-standalone | Install Java 1.7 and some basic dependencies] ******* 
  FATAL: no hosts matched or all hosts have already failed -- aborting
  </code></pre>
  
  <p>"vagrant ssh" works OK.</p>
  
  <p>site.yml is:</p>
  
  <pre><code>---
  # This playbook deploys a simple standalone JBoss server.
  
  - hosts: jboss-servers
  user: root
  
  roles:
    - jboss-standalone
  </code></pre>
  
  <p>I don't understand why I am getting the error:
      FATAL: no hosts matched </p>
  
  <p>The hosts contains webserver1, which is the same as the Vagrantfile hostname.</p>
  
  <p>Can someone please help me to resolve this error.</p>
  
  <p>Thanks :)</p>
  
  <p>Miles.</p>