# access to host\_vars and group\_vars from new Inventory plugin

**URL:** <https://forum.ansible.com/t/access-to-host-vars-and-group-vars-from-new-inventory-plugin/31494>\
**Category:** Ansible Developer\
**Created:** [October 19, 2019, 1:56pm UTC](https://forum.ansible.com/t/access-to-host-vars-and-group-vars-from-new-inventory-plugin/31494 "2019-10-19T13:56:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Artem\_Gromov](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@Artem\_Gromov](https://forum.ansible.com/u/Artem_Gromov)\
**Post date:** [October 19, 2019, 1:56pm UTC](https://forum.ansible.com/t/access-to-host-vars-and-group-vars-from-new-inventory-plugin/31494/1 "2019-10-19T13:56:58Z")

</div>

Hi,

I am trying to develop custom inventory plugin.

And I wonder if its possible to access vars defined in host\_vars and group\_vars from parse method of this plugin.

All i can get are vars ‘inventory\_file’, ‘inventory\_dir’ and nothing like vars from host\_vars files.

---

<div class="post-metadata">

**Author:** ![Artem\_Gromov](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@Artem\_Gromov](https://forum.ansible.com/u/Artem_Gromov)\
**Post date:** [October 19, 2019, 1:57pm UTC](https://forum.ansible.com/t/access-to-host-vars-and-group-vars-from-new-inventory-plugin/31494/2 "2019-10-19T13:57:49Z")

</div>

I am using  
ansible 2.8.1  
config file = /home/artgromov/arcadia/logbroker/juggler/ansible-juggler/ansible.cfg  
configured module search path = [u’/home/artgromov/arcadia/logbroker/juggler/ansible-juggler/plugins/library’]  
ansible python module location = /home/artgromov/.local/share/virtualenvs/ansible-juggler-GeUFfaTC/lib/python2.7/site-packages/ansible  
executable location = /home/artgromov/.local/share/virtualenvs/ansible-juggler-GeUFfaTC/bin/ansible  
python version = 2.7.15 (default, Oct 15 2018, 15:26:09) [GCC 8.2.1 20180801 (Red Hat 8.2.1-2)]

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 11, 2019, 9:39pm UTC](https://forum.ansible.com/t/access-to-host-vars-and-group-vars-from-new-inventory-plugin/31494/3 "2019-11-11T21:39:40Z")

</div>

You have access to host and group vars defined by previous inventory  
sources, but the host\_vars/group\_vars files are not available, since  
those are processed after all inventory is defined.

You could call the vars plugins directly but it is not something I advise.
