title: Cannot get ansible to recognize group variables
body: <p>I'm trying to set up environment specific variables in ansible (e.g. production, staging, development). For some reason, ansible is not picking up variables in group_vars/[environment].</p>
  
  <p>I'm using ansible 1.9.1</p>
  
  <p>Here's a stripped down example of what I'm trying to do.</p>
  
  <p>Directory structure:</p>
  
  <pre><code>.
  ├── group_vars
  │   └── staging
  ├── hosts
  │   └── staging
  └── site.yml
  </code></pre>
  
  <p>group_vars/staging:</p>
  
  <pre><code>test_var: "this is a test"
  </code></pre>
  
  <p>site.yml:</p>
  
  <pre><code>---
  - hosts: localhost
    tasks:
    - debug: msg="test variable = {{ test_var }}"
  </code></pre>
  
  <p>hosts/staging is an empty file</p>
  
  <p>Output of running <code>ansible-playbook -i hosts/staging site.yml</code>:</p>
  
  <pre><code>PLAY [localhost] **************************************************************
  
  GATHERING FACTS ***************************************************************
  ok: [localhost]
  
  TASK: [debug msg="test variable = {{ test_var }}"] ****************************
  fatal: [localhost] =&gt; One or more undefined variables: 'test_var' is undefined
  
  FATAL: all hosts have already failed -- aborting
  
  PLAY RECAP ********************************************************************
             to retry, use: --limit @/Users/jcowley/site.retry
  
  localhost                  : ok=1    changed=0    unreachable=1    failed=0
  </code></pre>
  
  <p>If I move group_vars/staging to group_vars/all, it works as expected and outputs the value of test_var. But I'm trying to understand how I can separate environments per the documentation in Ansible's <a href="https://docs.ansible.com/playbooks_best_practices.html#how-to-differentiate-stage-vs-production" rel="noreferrer">Best Practices</a></p>