title: Running an ansible playbook on localhost but referring to inventory's group_var
body: <p>I am trying to run a playbook locally but I want all the vars in the role's task/main.yml file to refer to a group_var in a specific inventory file.</p>
  
  <p>Unfortunately the playbook is unable to access to the group_vars directory as if fail to recognize the vars specified in the role.</p>
  
  <p>The command ran is the following:</p>
  
  <p><code>/usr/local/bin/ansible-playbook --connection=local /opt/ansible/playbooks/create.yml -i ./inventory-file</code> </p>
  
  <p>but fails to find the group_vars in the /group_vars directory at the same directory level of the inventory file</p>
  
  <pre><code>fatal: [127.0.0.1]: FAILED! =&gt; {
      "msg": "The task includes an option with an undefined variable. The error was: 'admin_user_name' is undefined\n\nThe error appears to have been in '/opt/roles/create/tasks/main.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: create org\n  ^ here\n"
  }
  </code></pre>
  
  <p>This is my configuration:</p>
  
  <pre><code>ansible-playbook 2.7.5
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/opt/ansible-modules']
    ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.6.3 (default, Oct  3 2017, 21:45:48) [GCC 7.2.0]
  </code></pre>
  
  <p>Any help is appreciated.</p>
  
  <p>Thanks,
  dom</p>