# How to print only the failed telnet connections from my localhost

**URL:** <https://forum.ansible.com/t/how-to-print-only-the-failed-telnet-connections-from-my-localhost/33274>\
**Category:** Ansible Project\
**Created:** [June 29, 2020, 6:13pm UTC](https://forum.ansible.com/t/how-to-print-only-the-failed-telnet-connections-from-my-localhost/33274 "2020-06-29T18:13:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shifa\_Shaikh](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Shifa\_Shaikh](https://forum.ansible.com/u/Shifa_Shaikh)\
**Post date:** [June 29, 2020, 6:13pm UTC](https://forum.ansible.com/t/how-to-print-only-the-failed-telnet-connections-from-my-localhost/33274/1 "2020-06-29T18:13:54Z")

</div>

Below is my playbook that helps check telnet connections from my localhost to all remote hosts.

`

- wait\_for:

host: “{{ item }}”

port: 22

state: started # Port should be open

delay: 0 # No wait before first check (sec)

timeout: 2 # Stop checking after timeout (sec)

ignore\_errors: yes

register: netstatoutput

delegate\_to: localhost

with\_items: “{{ groups[‘all\_hosts’] }}”

`

I get a lot of unnecessary stuff dumped in the logs when i debug like below:

`

- debug:

msg: “{{ netstatoutput }}”  
`

I just need all the failed telnet IPs printed in the debug and nothing else like below:

`  
“msg”: “Timeout when waiting for [10.9.172.62:22](http://10.9.72.62:22/)”  
“msg”: “Timeout when waiting for [10.9.72.66:22](http://10.9.72.62:22/)”  
“msg”: “Timeout when waiting for [10.9.172.42:22](http://10.9.72.62:22/)”

…  
`

Can you please suggest how can I?
