- name: GATHER IP PROTOCOLS INFO
ios_command:
commands: "show ip protocols"
ignore_errors: yes
register: show_ip_protocols
- name: TAKE BACKUP
ios_command:
commands:
- show run
- show version
- sh ip int brief
- sh int description
register: device_backup
- name: SAVE BACKUP TO A FILE NAMED WITH DEVICE HOSTNAME
copy: content="{{ device_backup.stdout | join ('\n') }}" dest="./iosupgrade/{{ ansible_net_hostname }}.txt"
- block:
- name: TAKE EIGRP NEIGBOUR BACKUP IF EIGRP PROTOCOL IS RUNNING
ios_command:
commands:
- show ip eigrp nei
register: device_backup2
- name: SAVE EIGRP BACKUP TO A FILE NAMED WITH DEVICE HOSTNAME
copy: content="{{ device_backup2.stdout | join ('\n') }}" dest="./iosupgrade/{{ ansible_net_hostname }}-eigrpBackup.txt"
when:
- "'eigrp' in show_ip_protocols.stdout[0]"