Below is my playbook that does telnet from my localhost to destination 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.72.162:22”
“msg”: “Timeout when waiting for 10.9.72.166:22”
“msg”: “Timeout when waiting for 10.9.42.162:22”
…
`
Can you please suggest how can I?