# port in ansible facts?

**URL:** <https://forum.ansible.com/t/port-in-ansible-facts/13142>\
**Category:** Ansible Project\
**Created:** [July 17, 2013, 5:27pm UTC](https://forum.ansible.com/t/port-in-ansible-facts/13142 "2013-07-17T17:27:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pierre\_Thibault](https://avatars.discourse-cdn.com/v4/letter/p/bc79bd/32.png) [@Pierre\_Thibault](https://forum.ansible.com/u/Pierre_Thibault)\
**Post date:** [July 17, 2013, 5:27pm UTC](https://forum.ansible.com/t/port-in-ansible-facts/13142/1 "2013-07-17T17:27:22Z")

</div>

Hello,

Is it possible to know what port has been used for the Ansible connection on the remote node. I don’t know if this information is available.

---

<div class="post-metadata">

**Author:** ![Jesse\_Keating](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@Jesse\_Keating](https://forum.ansible.com/u/Jesse_Keating)\
**Post date:** [July 17, 2013, 5:38pm UTC](https://forum.ansible.com/t/port-in-ansible-facts/13142/2 "2013-07-17T17:38:52Z")

</div>

When running with -vvv that data is shown on screen.

-jlk

---

<div class="post-metadata">

**Author:** ![Pierre\_Thibault](https://avatars.discourse-cdn.com/v4/letter/p/bc79bd/32.png) [@Pierre\_Thibault](https://forum.ansible.com/u/Pierre_Thibault)\
**Post date:** [July 17, 2013, 5:44pm UTC](https://forum.ansible.com/t/port-in-ansible-facts/13142/3 "2013-07-17T17:44:02Z")

</div>

I would like to be able to access this information from a playbook too.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [July 17, 2013, 5:46pm UTC](https://forum.ansible.com/t/port-in-ansible-facts/13142/4 "2013-07-17T17:46:42Z")

</div>

SSH\_CLIENT or SSH\_CONNECTION env variables on target host should have that info.

---

<div class="post-metadata">

**Author:** ![Jesse\_Keating](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@Jesse\_Keating](https://forum.ansible.com/u/Jesse_Keating)\
**Post date:** [July 17, 2013, 5:49pm UTC](https://forum.ansible.com/t/port-in-ansible-facts/13142/5 "2013-07-17T17:49:30Z")

</div>

ansible\_ssh\_port might get that for you.

[http://www.ansibleworks.com/docs/patterns.html#list-of-reserved-inventory-parameters](http://www.ansibleworks.com/docs/patterns.html#list-of-reserved-inventory-parameters)

-jlk

---

<div class="post-metadata">

**Author:** ![Pierre\_Thibault](https://avatars.discourse-cdn.com/v4/letter/p/bc79bd/32.png) [@Pierre\_Thibault](https://forum.ansible.com/u/Pierre_Thibault)\
**Post date:** [July 17, 2013, 7:12pm UTC](https://forum.ansible.com/t/port-in-ansible-facts/13142/6 "2013-07-17T19:12:02Z")

</div>

Thank you.
