--- ## This playbook collects the device facts and prints out key information. It supports only basice device features and does not supply full information ## for devices which feature VRFs or multi-instance capabilities. - name: Audit devices and print key information hosts: evengkit gather_facts: false connection: network_cli roles: - common tasks: - name: Collect device configuration cisco.ios.ios_facts: gather_subset: all - name: Print device identity info debug: msg: "{{ ansible_facts.net_hostname }} is reachable and the OS is {{ ansible_facts.net_version }}. SN is {{ ansible_facts.net_serialnum }}. Model is {{ansible_facts.net_model }}" - name: Collect interface, routing and device runtime information fo L3 devices cisco.ios.ios_command: commands: - show ip interface brief - show interface description - '{% if "2960" not in ansible_facts.net_model %} show ip route {% else %} show run | i default-gateway {% endif %}' - show ip arp - show version register: runtime_information - name: Print interface information debug: var: runtime_information.stdout_lines[0] - name: Print interface description debug: var: runtime_information.stdout_lines[1] - name: Print routing information debug: var: runtime_information.stdout_lines[2] - name: Print ARP information debug: var: runtime_information.stdout_lines[3] - name: Print device information debug: var: runtime_information.stdout_lines[4]