Backup and Tech support using Ansible
Using Ansible to collect backup files ,show tech and see the versions of Cisco switches.
Inventory file:-
Create an inventory file
[switches]
R1 ansible_host=10.60.51.1
[switches:vars]
ansible_connection=network_cli
ansible_network_os=ios
ansible_user=admin
ansible_password=cisco
ansible_become=yes
ansible_become_method=enable
Create a Yaml File:-
Backup and show tech file will be saved on the root folder.
---
- name: Cisco ios devices
hosts: switches
gather_facts: no
connection: network_cli
tasks:
- name: Backup
ios_command:
commands:
- show running-config
- show tech-support
register: cisco_config
- name: Save the config
copy:
content: ""
dest: "~/_backup.txt"
- name: Get show tech support
copy:
content: ""
dest: "~/_show_tech.txt"
- name: CHECK CURRENT VERSION
ios_facts:
- debug:
msg:
- "Current version is "
...
Run Ansible Playbook:-
ansible-playbook -i inventory version.yaml

networks
via CRAZY NETWORKING https://ift.tt/FvjC8uX
February 6, 2022 at 03:31AM
Nithin Eluvathingal