Network Scan in Ansible

35 views
Skip to first unread message

Dheeraj W

unread,
May 25, 2021, 10:22:59 PM5/25/21
to Ansible Project
HI Guys , I have been assigned a task to find all the routers in the management range lets say 10.250.0.0/20 and script is expected to to start from first ip and run an interation til the last ip and ruunning show command like show version to fetch their version number and other vital parameters, so this task assumes all the routers are in this range, its just that we don't know which ip is assigned to what? can I run a script to find all reachable routers in this range and ssh into them, fetch the info and save the output to a folder? I know it can easily be done in Python, however, I am not sure, if ansible gives that option without running those loops ?

Brian Coca

unread,
May 26, 2021, 11:21:22 AM5/26/21
to Ansible Project
See the nmap inventory plugin and snmp_facts module as alternate ways
to get most of this info.

The 'tree' callback plugin allows you to dump all results in a file
'per host', this with the 'raw' or 'telnet' (if no ssh) actions might
be of help.





--
----------
Brian Coca

Sumit Jaiswal

unread,
Jun 3, 2021, 8:51:14 AM6/3/21
to 'deewon' via Ansible Project
Hi Dheeraj,



Regards,
Sumit Jaiswal (he/him)
Github/IRC: justjais

--
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-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CACVha7cYaJignnbhpnSTBMWLRV8421%2Brf_DXcaUEDk-dyESAew%40mail.gmail.com.


Parth Patel

unread,
Jun 3, 2021, 9:03:27 AM6/3/21
to ansible...@googlegroups.com
If you intend not to use ansible.
you can try using combination of nonir, pyATS CLI parsers to fetch required details from show version or any CLI commands.



Reply all
Reply to author
Forward
0 new messages