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 ?
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.
Hi Dheeraj,
You can also checkout the Ansible.utils filter plugin usable_range (ref: https://github.com/ansible-collections/ansible.utils/blob/main/docs/ansible.utils.usable_range_filter.rst#ansibleutilsusable_range).
Regards,
Sumit Jaiswal (he/him)
Github/IRC: justjais
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.