Ansible Playbook Example to Backup Cisco Router or Switch Config

preview_player
Показать описание
This Ansible Playbook Example will show you how to backup a Cisco Router configuration file using Ansible

If you are looking for some Ansible network automation use cases this is a perfect start.

Using Ansible 2.7 I will walk through the playbook I used every day to backup Cisco Routers and Switches

GITHUB:

If you want to clone the repo above you can get the playbook and others as well so you can start using Ansible for Network Automation on your Cisco Devices.

This Ansible network playbook playbook can also be adjusted to backup Nexus, ASA, Junpier or any other devices by just changing the Ansible Module in use.

To backup a Nexus device you need to use the nxos_command module
Рекомендации по теме
Комментарии
Автор

Enjoyed the video? Subscribe, Give it a Thumbs Up and Comment Below.
(I actually read EVERY single legit comment from my loyal fans)

RogerPerkin
Автор

Roger, thank you for this.
I am starting to use Ansible for config and backup.
What is the best way to implement it in a CI/CD ? in a network's perspective.
Thanks,

jg_
Автор

If we need to directly export the backup to external tftp/ftp servers how would that be done . Can you show that use case pls !

himanshumishra
Автор

Hi Roger,
Thanks very much for sharing this awesome video.
I need help with writing ansible script that can log into HP-procurve & Aruba switch where there are 2 levels of authentication:
step1: ssh to device with un/pw = user1/pass1
when you type "enable", you are prompted a second authentication with both username and password.
step2: you enter username2; then password2; and you are finally in privilege mode where you can issue commands. It's not like Cisco when you just enter the "enable password" or secret; you need to enter both "enable_username" and password.
Any idea how to write ansible script that can login.
Thanks in advance for your time and support.
Oumar

dakissia
Автор

Hi, i see the hosts is CSR-Router in the copy task (02:48), why the copy destination is located in the localhost (Ansible server) but not CSR-Router Hosts? Because I do the same thing but the task will check the router local path instead of my ansible server.

bigdeal
Автор

Is there a way to configure a Cisco router to pull a configuration from an Ansible server?

timkerr
Автор

Awesome video, please keep them coming. It is difficult to find content for Ansible specifically aimed at network engineering.

Most of what I have been able to find so far is dated.

emirh.
Автор

after running ansible, the process does not finish when I get htop information. I get the results right but without ending the process. what should I do ?

MrHairfire
Автор

hi roger, please make a video for backup router with telnet access

djuneardysaputra
Автор

how are you ssh into router ? I dont see that part in video.

ushah
Автор

Why does nobody ever show how to save the configuration files to a remote repository? It doesn't seem very useful to me to save the files locally.

aaroncoulter
Автор

How do you solved the Problem when the 1, 2, 3 CRT have different Passwords to Login in.

Joey-vwei
Автор

Hi Roger, i've got error message below,
FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'stdout'"}.

it happen because on my router list, i've got old version ios that cannot run some 'show command', is there any command to ignore those error and continue with other valid command without cancel all task on that old ios router?

thanks in advance

dzulfiqaralghifari
Автор

can you please make a video of error handling ??
while we running playbook, if any error occur it will fails...then it might fire error like "fatal: [IOS-ROUTER1]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'stdout

error may be IP not reachable, ssh error, authentication error etc...

sameerthorappa
Автор

Thanks for the info. How do you do the reverse and add one of the backups conf and replace the current config with that backup?

Danndahouse
Автор

Hi Roger, I did your entire ansible course and it was great.
Quick question, how can I deploy these backups from ansible?
like what's the equivalent of copy run start that I need to do to get this backup from the video to the actual routers

NotLWSH
Автор

Great vid: I'm having an error - {"msg": "unable to set terminal parameters"} and i think it has something to do with the ios ">terminal lenght 0". I noticed you don't have that in your commands.Wouldn't the 'show run' need to be paged thru if not using the 'term len 0' command? Or is Ansible supposed to know to page thru it? Thanks.

eggybaby
Автор

Why not use the backup and backup_options parameters provided by ios_config?

enderst
Автор

You are just great thanks for your videos. I learned a lot. Sorry, but maybe you can help me . Can you make a video about extreme switches in order to make a backup from its configuration. Good Day.

Javus
Автор

First of all a big Thumbs up .. what about the scheduling part ? how can we schedule the same. I encounter cronjob is not suited for ansible ?

abaazit