title: Ansible: Access host/group vars from within custom module
body: <p>Is there a way how one can access host/group vars from within a <a href="http://docs.ansible.com/developing_modules.html" rel="noreferrer">custom written module</a>? I would like to avoid to pass all required vars as module parameters.</p>
  
  <p>My module is written in Python and I use the boilerplate. I checked pretty much all available vars but they are not stored anywhere:</p>
  
  <pre><code>def main():
      pprint(dir())
      pprint(globals())
      pprint(locals())
      for name in vars().keys():
          print(name)
  </code></pre>
  
  <p>Now my only hope is they are somehow accessible through the undocumented module utils.</p>
  
  <p>I guess it is not possible, since the module runs on the target machine and probably the facts/host/group vars are not transferred along with the module...</p>
  
  <p>Edit: Found the <a href="https://github.com/ansible/ansible/blob/a5ac9aafada0eeb541b0d8dbc506b66cd38b504b/lib/ansible/module_utils/basic.py" rel="noreferrer">module utils</a> now and it doesn't look promising.</p>