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? 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0c3bfb5c-333f-47dc-93a9-de1eba18bfe9o%40googlegroups.com.

Reply via email to