# How to access host vars from within a connection plugin

**URL:** <https://forum.ansible.com/t/how-to-access-host-vars-from-within-a-connection-plugin/17705>\
**Category:** Ansible Developer\
**Created:** [March 9, 2015, 10:01pm UTC](https://forum.ansible.com/t/how-to-access-host-vars-from-within-a-connection-plugin/17705 "2015-03-09T22:01:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tim5](https://avatars.discourse-cdn.com/v4/letter/t/e9c0ed/32.png) [@tim5](https://forum.ansible.com/u/tim5)\
**Post date:** [March 9, 2015, 10:01pm UTC](https://forum.ansible.com/t/how-to-access-host-vars-from-within-a-connection-plugin/17705/1 "2015-03-09T22:01:53Z")

</div>

An arbitrary host var can be set in my hostfiles/inventory file:

[www]  
[myserver.blah.com](http://myserver.blah.com) ansible\_connection=MY\_NEW\_CONNECTION someVar1=abc

Now… in plugins/connection\_plugins/MY\_NEW\_CONNECTION.py…  
how do i access someVar1?

I’m looking at the ssh.py example and i see an **init** function, but i traced  
out all those incoming vars and dont see it.

[https://github.com/ansible/ansible/blob/devel/lib/ansible/runner/connection\_plugins/ssh.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/runner/connection_plugins/ssh.py)

Thank you.

---

<div class="post-metadata">

**Author:** ![tim5](https://avatars.discourse-cdn.com/v4/letter/t/e9c0ed/32.png) [@tim5](https://forum.ansible.com/u/tim5)\
**Post date:** [March 9, 2015, 10:09pm UTC](https://forum.ansible.com/t/how-to-access-host-vars-from-within-a-connection-plugin/17705/2 "2015-03-09T22:09:29Z")

</div>

SOLVED from previous answer…
