Тёмный

Ansible Playbook for Cisco IOS Upgrade 

Roger Perkin
Подписаться 14 тыс.
Просмотров 22 тыс.
50% 1

In this video I will be using an Ansible Playbook for Cisco IOS Upgrade on a 2960 switch.
✅ Subscribe to my Channel and get more great tips
ru-vid.com?...
My Ansible Network Automation Course / www.rogerperkin.co.uk/
Check out my courses
www.rogerperkin.co.uk/network...
This will step you through every step of the way on how to perform this task.
Have you got 100’s or 1000’s of Cisco switches or routers to perform a software upgrade on?
Looking for a simple way to upgrade Cisco IOS remotely? Or perform the task without manually logging into each device?
Ansible is a great way to perform software upgrades on network devices.
This Ansible Playbook will upgrade your Cisco IOS switches with ease!
🎞️ - Video Chapters
00:00 Playbook Introduction
01:14 Check current image with Ansible ios_facts
02:40 Backup running-config
04:10 Ansible net_put module to copy image
06:36 Change boot variable
07:00 Reload Switch
07:51 Ansible cli_command module
10:36 Live Playbook run
#networkautomation #netdevops #ansible
NOTE: The advice given here is purely for educational purposes. Please test this upgrade process out before pressing the button on 100’s of devices. Every network environment is different. Ensure you are 100% happy with the process before updating multiple Cisco switches in a production environment. I cannot be held responsible for any outages caused by Cisco switches failing to reboot!

Опубликовано:

 

29 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 74   
@MrEDGE1984
@MrEDGE1984 2 года назад
Before this video Ansible was scary for me, now after watching this I can say I feel at home, Thanks ROger! Subscribed.
@RogerPerkin
@RogerPerkin 2 года назад
Excellent, plenty more to come - any topics you would like covered?
@MrEDGE1984
@MrEDGE1984 2 года назад
@@RogerPerkin Few more ansible videos would really help along!
@RogerPerkin
@RogerPerkin 2 года назад
@@MrEDGE1984 Sure, pretty wide topic area though - any vendors or tasks you are working on?
@kenmurphy4259
@kenmurphy4259 4 года назад
Great video Roger and like the Ansible cap! :)
@MahmoudTaha92
@MahmoudTaha92 2 года назад
Thank you for sharing this useful demo, it is awesome!
@afara2000
@afara2000 3 года назад
For reloading a Cisco IOS device, you'll need to hit "enter" or return key i.e., " " instead of 'y' in Ansible script. Although, 'y' may work but it's good to use proper commands.
@uche8961
@uche8961 4 года назад
Great video. Very practical. Just what I need as a beginner in ansible. You really won me over. Please do more of these practical stuffs.
@RogerPerkin
@RogerPerkin 4 года назад
More to come!
@Aldrin03
@Aldrin03 4 года назад
excellent work - i'm starting to study ansible to automate daily tasks! appreciate your videos!
@RogerPerkin
@RogerPerkin 4 года назад
Great to hear! - I have more tutorials on my website www.rogerperkin.co.uk/network-automation/ansible/
@mihaigrigore2136
@mihaigrigore2136 4 года назад
Excellent video, Roger! Thank you for sharing.
@RogerPerkin
@RogerPerkin 4 года назад
Thanks, glad it helped.
@gouravrelhan7372
@gouravrelhan7372 21 день назад
Thank for this video. Much appreciated Roger !! :)
@SadhamHussainsree
@SadhamHussainsree 2 года назад
Great video.Thank you for sharing your knowledge.
@DarkSideDiving
@DarkSideDiving 4 года назад
Very cool !!!
@sameerthorappa3356
@sameerthorappa3356 4 года назад
Excellent video...we appreciate your time 👍👍👍.
@RogerPerkin
@RogerPerkin 4 года назад
Thank you! Cheers!
@garyauer8070
@garyauer8070 3 года назад
Absolutely excellent thanks
@RogerPerkin
@RogerPerkin 3 года назад
Great, glad it helped!
@RohitPatil-qx9tf
@RohitPatil-qx9tf 2 года назад
Thanks for the video.. A very good script.. Please upload new videos for upgrade of the fortigate and palo alto devices
@RogerPerkin
@RogerPerkin 2 года назад
Ok thanks for the idea, I will look into that
@bantacad
@bantacad 2 года назад
Awesome video! In my opinion you can use command " write memory", which no require "Yes" for answer and for the network switch you can use console connection instead SSH. Cheers.
@RohitPatil-qx9tf
@RohitPatil-qx9tf 2 года назад
Hi Roger, I want to skip the upgrade if the current version and upgrade image are same.. But looks like it skip the debug message but start running other tasks.. ? Any inputs?
@edsonrocks
@edsonrocks 4 года назад
Thank you Roger, it's been a really useful demo. For a firmware upgrade routine like that I'd suggest checking the new firmware file md5 checksum before reloading the device just to prevent it turning into a brick that fails to reboot due to a corrupted file. Thank you for the video series, very cool, keep it up.
@RogerPerkin
@RogerPerkin 4 года назад
Edson, this was just me getting to grips with the basics of the operation. I am aware there are more checks that can be done like check space in flash before pushing and MD5 checksum checks. Glad you enjoyed it.
@edsonrocks
@edsonrocks 4 года назад
@@RogerPerkin I'm learning a lot with your videos. Thank you very much.
@martinbuffleo
@martinbuffleo 3 года назад
Great playbook. Worth adding and MD5 verify task, before reloading the router?
@koye290904
@koye290904 3 года назад
Great video Roger! How long would you say the entire upgrade process took from running the yml file in ansible to the completion of the upgrade? I intend to run this in a prod environment on over 30 network devices.
@rochdiferjani6778
@rochdiferjani6778 4 месяца назад
dear Roger could you please make a training video about aruba switch ! 🥰
@chrisdotbrown1
@chrisdotbrown1 4 года назад
Great video - more network ansible please, especially the impact of ansible changes on routing tables
@RogerPerkin
@RogerPerkin 4 года назад
Hi Chris, can you expand on that requirement a bit more? Ansible changes on routing tables are basically somebody making changes. Are you looking to compare routing tables before and after a specific change?
@chrisdotbrown1
@chrisdotbrown1 4 года назад
@@RogerPerkin the scenario would be if you wanted to change a route would you use the config module or command. Just trying to understand how smart the config module is.
@RogerPerkin
@RogerPerkin 4 года назад
I don’t think the Ansible config module is smart - it literally just performs the same command you would type on the CLI Are you looking for more of a predictive / changing routes based on certain network conditions?
@chrisdotbrown1
@chrisdotbrown1 4 года назад
@@RogerPerkin Not really just trying to get me head around good operational practice and maintenance and which modules are best for what. I am thinking, facts and command to perform incremental change and test success and then config to ensure it hasn't been changed. I get that config can also best use for initial setup. I think one of my observations with Ansible is that there is a lot of content on how to do change but less on best practice. Great video - make really clear some key technics.
@RogerPerkin
@RogerPerkin 4 года назад
@@chrisdotbrown1 Think of Ansible as a tool to make changes and config push / pulls in a predictive easy way. It's a great tool but if you want to get it to do clever stuff, you need to put clever config into it. Maybe you should look at Python and PYATS for something that will monitor your network for change and config drift. There is not one right tool for anything and there are so many ways of doing everything.
@umakantjena5154
@umakantjena5154 3 года назад
thanks Roger for this video. why I am getting this error . fatal: [R1]: FAILED! => {"changed": false, "msg": "path specified in src not found"} I tried ~ or / , file path correct but it just cant get it.
@suelee9346
@suelee9346 4 года назад
Thanks for the Video! Roger. Positives: This is good for Network Engineers who enjoys breathing through one nostril due to Corona Virus. This is good for someone who does not want to write Python codes. Not so positive: Using Ansible is like running on only 4 cylinders on a V8 car. Python might byte you back later. Why not use both nostrils (Python) or fire up all 8 cylinders (Python)?
@RogerPerkin
@RogerPerkin 4 года назад
I agree, Ansible is not the fastest way to do things but for IOS upgrades I have found it to be very reliable - which is more important for me!
@sbahb1396
@sbahb1396 3 года назад
Awesome video! Thank you Roger. A small question, do you covert this kind of upgrade for wireless controller and ASA in your course on your website? If yes I am really interested. I am currently working on upgrading our infrastructure devices (switches, WLC, ASA) it would be nice if you could share how to perform this kind of tasks with Ansible. Please let me know. Thank you again for the great video!
@RogerPerkin
@RogerPerkin 3 года назад
Hi sbah B, thank you for the comment. My course really covers from zero knowledge to running some basic playbooks. Once you get up and running there are so many use cases it would be impossible to cover them all. The process is the same you just need to tweak the playbook for your specific hardware. It all depends on how many deivces you have. For me the switch playbook was really worth writing as you can easily upgrade 100's or 1000's of switches with ease. For ASA or WLC it just depends how many you have and how often you want to upgrade them
@adonf
@adonf 2 года назад
Hello, was the advertised "next video" where you automate all this stuff ever released ? Or is it part of the pay course ? Anyway, thanks for this very informative video.
@jonathantx
@jonathantx 3 месяца назад
Is it possible to gather facts based on a wildcard? for example only on a given switch model?
@peterly7381
@peterly7381 3 года назад
Awesome and very intuitive video instruction. However, this is a router by router. If we we 10 routers at once, what's the best method? 10 separate session currently? or how would you do it in parallel? Thanks.
@RogerPerkin
@RogerPerkin 3 года назад
Hi Peter, this playbook was just to explain the basic process. If you have 10 devices to upgrade it's up to you how you want to tackle it. If you added all your devices into the hosts file they would all upgrade at once, you may want to just do 10 at a time or if you wanted to do 1 at at time just wind the forks value back in ansible.cfg. The next device would not start until the previous play had finished. For production devices this playbook is really to take all the manual steps out of the process and some customers prefer to take things slowly over a day others are happy to fire all at once.
@deepak7057
@deepak7057 3 года назад
cisco WS-C4948 not upgrade so plz help me
@ankukumar-hi2jt
@ankukumar-hi2jt 6 месяцев назад
Thanks @Roger Perkin for your video so lets suppose i have 100 devices to upgrade and i did them at once so how ansible knows which all devices are coming up and then do post validation as few devices can take more time then other
@RogerPerkin
@RogerPerkin 5 месяцев назад
You would put a delay on the playbook before you run the validation, you would just have to put a sensible figure in i.e wait 10 minutes?
@hygri
@hygri 4 года назад
Sweet tutorial Roger, much appreciated. Just a thought; could you sneak in a check to see if there is actually flash space available for the upgrade? I've been hit by that many a time :)
@RogerPerkin
@RogerPerkin 4 года назад
Great suggestion! I can add that in a later video - Make sure you subscribe to be alerted when it goes live
@hygri
@hygri 4 года назад
@@RogerPerkin Nice! Most definitely - I have, as they say , "got the bell on" :)
@RogerPerkin
@RogerPerkin 4 года назад
@Mr.b I have not deleted any videos, this is the only one I have on Jinja Templates - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-p0C90zIbe5s.html - all my other Ansible videos are in this playlist - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-hLhHZ_uju2Q.html
@packetsbulliespb3441
@packetsbulliespb3441 Год назад
Does Ansible copy the image to all members if we have a stack switch, or how does Ansible manage this?
@AJ-jm6zp
@AJ-jm6zp 3 года назад
awesome and very helpful :) subscribed for your great work. could you please share that ansible script please
@RogerPerkin
@RogerPerkin 3 года назад
Sure, you can find it here - github.com/rogerperkin/network-programmability/blob/master/SCRIPTS/Ansible/ios-upgrade.yml
@dhanasekar-uj2ch
@dhanasekar-uj2ch 4 года назад
Excellent video, one query can we pass the enable password and hoow to do that
@afara2000
@afara2000 3 года назад
You need to have "become: yes" and "become_method: enable" variables set in playbook or "ansible_become=yes" and "ansible_become_method=enable" in 'hosts' file and set "ansible_become_password=xyz" in your 'hosts' or inventory file. You can also use "-K" in CLI when you run playbook, it'll prompt you to manually enter enable password.
@jclm1rt
@jclm1rt 4 года назад
Very good video! Is it possible to do the same upgrade simultaneously on multiple switches?
@dhanasekar-uj2ch
@dhanasekar-uj2ch 4 года назад
Yes it is possible
@RogerPerkin
@RogerPerkin 4 года назад
Yes, this is the power of Ansible, you can limit the number of connections with forks in the ansible.cfg file I normally have it at 5 connections at a time, however it can be more. It's just up to you how many you want to have going at the same time. For switch upgrades I would normally have them going at a manageable number so you can monitor them. Some customers want all at once, others prefer one at a time.
@feargalledwidge806
@feargalledwidge806 4 года назад
Great video - but every time I try to replicate it - I get a failure in the net_put module. I get "An exception occurred during task execution. To see the full traceback, use -vvv. The error was: UnboundLocalError: local variable 'changed' referenced before assignment fatal: [TEST]: FAILED! => {"msg": "Unexpected failure during module execution.", "stdout": ""}. Ansible version is 2.9.19.
@aydinkocak3270
@aydinkocak3270 3 года назад
Hi I receive same error with centos but same playbook run without any error on ubuntu 20.04 LTS.
@neogeoh1
@neogeoh1 4 года назад
Sir... I Mount a python program to do this. I need this code to try it out. I will check your website otherwise please let me know where I can get it. I am new to Ansible and this will serve me as a great experiment. Thank you for sharing.
@RogerPerkin
@RogerPerkin 4 года назад
Hi, I am working on this and will be putting a new video out soon performing the task using Python
@JoshepGomez123
@JoshepGomez123 3 года назад
Ansible can be used to upgrade other Cisco OS (IOS-XR, IOS-XE, NXOS)? or is limited to IOS
@RogerPerkin
@RogerPerkin 3 года назад
Yes, you can use it to upgrade other Cisco OS, it's just IOS is easiest. If you understand the manual process to upgrade NXOS then using Ansible is just taking the steps and translating them.
@jhonvinod8988
@jhonvinod8988 4 года назад
Please upload iOS upgrade using python. Thank you
@RogerPerkin
@RogerPerkin 4 года назад
Sure, that was going to be my next video, performing the same operation using Python! Hit subscribe and you will be notified as soon as it goes live!
@marcosdxdydz
@marcosdxdydz 5 месяцев назад
lousy explanation
@ershadramezani6716
@ershadramezani6716 Год назад
Does anyone know why I'm getting this error with scp ?: fatal: [sw1-access]: FAILED! => {"changed": false, "destination": "flash:/test.txt", "msg": "Exception received: Error transferring file to flash:/test.txt: Initializing SCP session of remote file [flash:/test.txt] for write failed with error [b'Socket error: No such file or directory']"} Thanks in advance
Далее
Cisco IOS Automation with Ansible
31:22
Просмотров 53 тыс.
Automating my Homelab with Ansible
13:18
Просмотров 334 тыс.
Документы для озокомления😂
00:24
Parse Cisco IOS to JSON with Python and Netmiko
17:15
This web UI for Ansible is so damn useful!
20:07
Просмотров 466 тыс.
Ansible Network Automation
1:02:52
Просмотров 73 тыс.
You did WHAT with Ansible?!
20:56
Просмотров 139 тыс.
Managing 15,000 network devices with Ansible
35:55
Просмотров 45 тыс.
Ansible for Network Configuration Templates
21:02
Просмотров 59 тыс.
How to configure real Cisco switch with Ansible
13:51