# Terminal connection plugin: access to host or play inventory details?

**URL:** <https://forum.ansible.com/t/terminal-connection-plugin-access-to-host-or-play-inventory-details/1146>\
**Category:** Get Help\
**Tags:** dev, plugin\
**Created:** [September 27, 2023, 9:30am UTC](https://forum.ansible.com/t/terminal-connection-plugin-access-to-host-or-play-inventory-details/1146 "2023-09-27T09:30:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zpe-reneneumann](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/zpe-reneneumann/32/846_2.png) [@zpe-reneneumann](https://forum.ansible.com/u/zpe-reneneumann)\
**Post date:** [September 27, 2023, 9:30am UTC](https://forum.ansible.com/t/terminal-connection-plugin-access-to-host-or-play-inventory-details/1146/1 "2023-09-27T09:30:25Z")

</div>

Hi,

I’m currently trying to create a terminal connection plugin. The goal is to connect to a console port via a terminal server. So the plugin must be able to deal with the initial terminal connection and have to authenticate against the device.  
I have have current sample working overall, but I’m stuck on how I can handle the credentials?

The inventory data for ansible)user and password are used for the ssh session to the terminal server itself, so I need a 2nd pair of credentials which I can ideally define in the inventory. How can I either pass this 2nd set of credentials to the plugin or how can the plugin look this info up?

I was hoping that the “\_connection.\_play\_context” would help, but I am unsure how to add information to it?

Any help or hint would be greatly appreciated.

Regards  
Rene

---

<div class="post-metadata">

**Author:** ![maxamillion](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/maxamillion/32/98_2.png) [@maxamillion](https://forum.ansible.com/u/maxamillion)\
**Post date:** [September 29, 2023, 5:28pm UTC](https://forum.ansible.com/t/terminal-connection-plugin-access-to-host-or-play-inventory-details/1146/2 "2023-09-29T17:28:40Z")

</div>

Checkout this example here from the ibm.isam collection: [https://github.com/IBM-Security/isam-ansible-collection/blob/master/plugins/connection/isam.py#L37](https://github.com/IBM-Security/isam-ansible-collection/blob/master/plugins/connection/isam.py#L37)

That docstring is important because ansible-core will parse that docstring and populate variables based on the docstring as effectively an arg spec for the connection plugin. It’s admittedly a bit obtuse and I don’t think it’s well documented, if at all, but I ended up finding that in the code at some point and recommended that method to the ibm.isam developers who were asking about it in the past.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![flowerysong](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/flowerysong/32/2305_2.png) [@flowerysong](https://forum.ansible.com/u/flowerysong)\
**Post date:** [October 3, 2023, 10:00pm UTC](https://forum.ansible.com/t/terminal-connection-plugin-access-to-host-or-play-inventory-details/1146/3 "2023-10-03T22:00:13Z")

</div>

The documentation for plugin options is located at [Developing plugins — Ansible Documentation](https://docs.ansible.com/ansible/latest/dev_guide/developing_plugins.html#plugin-configuration-documentation-standards)

While there’s room for improvement, I don’t think it’s particularly poorly documented (compared to, say, [how to use the standard module utilities](https://docs.ansible.com/ansible/latest/dev_guide/developing_module_utilities.html#standard-module-utilities) 🙂)
