# Access inventory file content during connection plugin run

**URL:** <https://forum.ansible.com/t/access-inventory-file-content-during-connection-plugin-run/31363>\
**Category:** Ansible Developer\
**Created:** [September 25, 2019, 3:47pm UTC](https://forum.ansible.com/t/access-inventory-file-content-during-connection-plugin-run/31363 "2019-09-25T15:47:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandru\_Obretin](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Alexandru\_Obretin](https://forum.ansible.com/u/Alexandru_Obretin)\
**Post date:** [September 25, 2019, 3:47pm UTC](https://forum.ansible.com/t/access-inventory-file-content-during-connection-plugin-run/31363/1 "2019-09-25T15:47:19Z")

</div>

Hi,

I have developed a httpapi connection plugin for Ansible and whenever I execute a playbook (_ansible-playbook playbook.yml -i hosts_) I run inside an extra _ansible-inventory --list_ command to read the vars associated to the inventory.

Is there any alternative to access the vars for the current host? Or is there a way to find during the execution the argv of “ansible-playbook playbook.yml -i hosts” to identify where the hosts file is located?

Regards,  
Alex
