Access inventory file content during connection plugin run

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