Ansible Network Automation

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys welcome to another episode of OSPF packet I'm super excited that you guys chose to join in and see what's going on especially in this time of a craziness that's going on in the country my wife and I actually decided that we needed to set goals during what we thought was gonna be just a two-week time at home and wow it's turned into so much more than that but during the two-week this first two weeks my from my goal was to learn write and publish an ansible playbook so I I did it I am dug in I learned ansible not water Nance well that's that's a huge thing but I've I've learned a little bit about the instable and I've taken the skills that I've acquired and I've built a playbook around ansible to automate the deployment of ten routers that join together in an OS in in an OSPF topology that I pulled down from I&E so it's a pretty cool pretty cool topology it's pretty cool to play with it's got five OSPF areas there's just normal areas there's nothing crazy about it it's just but it is really cool that I can type one command and deploy a topology of ten routers just one one command hit enter BAM it's done it took a lot of work to build it to get it there but now if I need to deploy my lab topology to mess around although SPF I just go pour a cup of coffee come back in my lab is ready to go for me so that's pretty cool hope that you enjoyed that you find it useful and maybe it inspires you to dig into something that you didn't know before and maybe you cannot make a video on it or publish something or write something that's beneficial for your job or something like that so anyway I hope that this is a helpful to you so let's check it out so over here I've decided that I'm gonna use vs code Visual Studio code to write my scripts and things for ansible it's it's a really useful tool the color codes things that give you areas where things are wrong it tells you about that what they might be helps you correct your code and things like that along the way so it's really really neat um I've got a script thing here I actually have a I have the script thing here so I've got a master lab deployment DLL file ansible written a lot of yeah mo is the is the code or the file type that's written here so I've got a master deployment got deployment file here that deploys four different smaller files to deploy everything that I need and this is actually the topology here that I'm using for everything so we're gonna deploy a dmvpn tall an area zero with one link here in area zero several different areas to so zero through four are the areas that are getting deployed um for that so you can find that on II's website if you're interested in getting getting that topology together um so first I'm going to publish global configuration global configuration is things that I want to be on all of the routers regardless of what area or what whatever they might have on them so this is this is definitely a cool cool thing that we can publish the global template if you will to all the routers these things that they all will need such as like a a login banner and loopback zero interface or just a little back interface to serve as a point of reference for a router ID if you if you weren't going to hard code it at some point um so you build the set the login banners for all of the routers here and then there's the specific stuff the tunnel routers that are in that topology it's one through five on those particular ones I need to build the ISO camp policy and the IP ii transform sets and the ipsec profile those are things that go on all of those routers so i bundled them in global config under a different thing and I'm noticing problems here I've got this to set the login manner but I didn't change the name of this place oh just the sets ice the camp and IPSec properties for robbers so yeah as I'm going through this we'll find things to fix so there's there's this config and you're I'm looking at this config and like okay that's cool and all but how does it know what to apply it to and you see there's this line here so there's a connection that you make then use we're using that we're COI we're not gonna gather any any facts about the routers to start with and we actually have these hosts here the pole from a specific place in in the file structure of the of the one Xbox or whatever it is that you're running hansel from and so there's actually a host file that we're gonna build and yeah mulana show you this while we're here you so I chose the demo because typically you would want to input your variables which here for this I have them in plain text but you would never want to do this and a production of our only for testing you even want to use something like ansible vault or something like that to hide your passwords and store them securely so that you don't have plaintext passwords sitting in files but for the for this example in order to make it a little easier I chose to leave them in plain text assistant gonna be testing and dev only so back to the inventory file we've got here is there's a structure that we follow all then there's children and under that they're in a lab and children of that or routers under that and how the house for the routers are these this IP range and then there's ten routers I've got to find underneath of this that are just the IP addresses that are associated to them so if I wanted a couple up one at a time or what have you and then you can see here I actually called out the tummy routers or 21 through 25 so you can group things here you could make like if you were having Oh s PF and EIGRP and bgp you could set routers that have BGP in a group and name those so this router here 24 and 24 here and 24 here is the same router this is just ways to group them in the inventory file so it's it definitely takes some getting used to with the spacing and things like that but it's definitely powerful to be able to do that and then the variables file under group far is all so I've named the file all and it recognizes that from here so that means that these variables apply to every host under here regardless my variables are the ansible network OS is iOS and then the user name is gonna be then all I'm gonna change this for well actually I already got it on them this isn't working live on my things so this is fun this is where you put your username and your password here I actually gave the user privilege level 15 on my router so that it would automatically go and I didn't have to worry about getting into enable loader good what's in the ansible is called become I'm gonna have to worry about that because my username would automatically go into purple as old 15 so that's all there is to the variables and the house and the inventory file is called the house there if you're a Windows person I'm sure you're very familiar or even when I saw this you're familiar with the host file so I've got my master love deployment which is what we're gonna run and it runs these files global config then the next one is gonna hit is the router config and this is our dagger goes through each router individual router1 and it gives the loopback an IP address and it configures a router ID under each process and so it does that here same for all of these it's going to configure a router ID and the process and give an IP address to the look-back and that's gonna go through all ten of my routers and do that same configuration on all of them and then if we go back to the master lab deployment the next of the segment config and this is where I this is where a lot of this is built out but you've got and capsule this is how you encapsulate the sub interfaces that I used for the topology and so there's different modules iOS config and then the lines that go under it the parents that they have so this is interface Ethernet 0 0 not 146 and then the lines underneath that are gonna be this so that's how you build things up underneath up underneath the different lines that you see it's not quite like typing it out in the CLI because it's reversed almost do like you've got all of these commands exist underneath the interface tall zero command and that lives on all of these first five routers and to build up the segments on each on each router and gave IP addresses to them so it's pretty that's a this is the longest file I think that's in here it's the 363 lines and then the last piece is the actual OSPF config this is where it goes through and on I applied the interface to the tunnel tunnel interface here and I went through and I actually touched the router IDs again so there's router IDs on these guys and I applaud the OSPF area to the different interfaces according to the topology that was there so I'm going to I'm gonna actually log into my instable box that sees all of these actually before I do that I'm gonna through and show you real quick so if I connect to all ten of my routers you sell my banner is already there and I've got these interfaces are already there yeah my interfaces are already there owns all these guys and everything like that so those interfaces are are all already there so I'm gonna actually can fig replace I've got a file that I've stored out here I've connectivity dot txt yes we're gonna replace that with everything now if I show you a brief I should see that those are all deleted they're not there and if I out everything and close my tabs when I connect back to a host I don't get sorry I don't get my blogging banner you see they've been deleted there's literally the only thing that's in this topology to start with is my username privilege 15 and they have an enable secret but that's not necessary i SS 8 just turned on and I have an interface on these routers that's piped down to my local network so I have connectivity to them that's literally the only thing here tell me what you would do this with like DHCP so when you plug it in you can have a zero touch deployment to to a switch or a router or something like that so all these guys are blank we've got nothing on them we're gonna go back to our ansible box here I'm gonna navigate to my folder I'm gonna run ansible - playbook and my playbook is mastered run scroll lavish for a moment not you know and I am going to run that and while this is running it does take a while I think I timed it the other day it took about four and a half [Music] four and a half maybe five minutes to get through the entire thing but it's gonna get through this entire piece here and uh we will get back to it after it runs through this and I will show you the topology that has built out and you can see it's going through it it's at the login banner configured the login it's configuring login banner showing the things that has changed and you see so you will see some of this I'll speed this screen up and we'll get through this I'll be back with you once it is completed [Music] man we're getting close the OSPF config on the last router everything has changed status that is good and we're about to get an output that shows everything that the BAM look at that that is beautiful so the play recap shows us that connect to these 10 routers have found 15 it did 15 actions and it changed 15 things nothing was unreachable nothing failed that my friends is beautiful we just automated the deployment of 10 routers in an area OSPF configuration single command I went and got a drink and I got something out of the car for my wife and now my topology is ready for me to start webbing with OSPF so let's check this out if I get out of my log out of my Raspberry Pi let's connect up to our 10 routers and see what we got going oh look at that I've already so there's my banner shows up on all 10 routers out of the gate and if you remember the topology we've got router tens over here and we router nines over here and so I'm gonna ping from the loopback interface on router 10 to the loopback interface on a router 9 and see if we have connectivity oh it configured everything look at that this is so good so I should be able to now ping 99.99 and it should work oh it does it's so good this is this is so cool like everything is here I I have my OSPF areas I have all of my routes in her area around sex turnarounds for the things that are redistributed this is this is beautiful my entire topology is built all the way through what's up let's just transfer out to that IP just to prove that it is actually going through all of these hops so I hit the router router five router three router seven and router nine yeah it's jumping all the way through the topology that is so cool it's so cool to be able to automate this stuff I I get excited about this stuff I get nerded out about the stuff this is awesome I I'm just over them I'm over the moon about how I was able to like I I spent maybe five days probably five solid evenings nights up until maybe 2:00 in the morning a couple of times playing around this stuff studying it but I'd say all in all in I'm probably I'm probably 18 hours all in of time spent on messing around with this stuff and I'm automating 10 a 10 router lab with a full OSPF well it's it is really really cool to me so check this out if you go to github.com slash OSPF packet slash ansible - OSPF - lab this is where you can get the files that I have used I've got I read me that shows the what I the images that I used and danceable version that I'm using the type of Linux that I was using the Python versions are using everything's there kind of gives you the assumptions I'm still working on some of the installation pieces and all the stuff like that but if you if you're interested in knowing how I got the virtual router set up you have to check out another video that I've got out called Eve ng on VMware Workstation I'm running VMware Workstation free on a laptop that's sitting right over there and it's running wireless connection and I'm piping everything over to the wireless network larrya network I'm running through all this stuff over here over here that you can see and so I'm just getting everything connected in together that way so that I can lab this stuff up it's it is really cool and it definitely will translate to the real world as I've learned these things you can bring them to to my employer show it's really cool this definitely increases my value to my employer I think it's a this is a fantastic way to grow your skillset by laughing things up it doesn't get any better than doing the hands-on practice so take a look at the scripts that I've got out there take a look at all take a look at these things I hope this video has been awesome for you and it's been inspirational to you to get out there and learn just the 18 hours I'm I'm literally automating an entire lab topology for me to be able to get in and do some really cool stuff and I don't have to waste time trying to get things built back up I can just automate it it's done I build it and I'm ready to go so this is this is really cool I hope it helps you out if you don't mind just go subscribe to the channel I hope you like the content click the bell get some extra information I'm gonna have some links after this to the different videos that I've got they can show you how to get the e stood up on your laptop running on VMware Workstation if you so check that out I hope you like it like the video leave some comments tell me how your journeys going I'd love to hear from you especially while everybody is kind of trapped inside of their houses right now with all the stuff going on with the pandemic we're dealing with so I love to hear from you thanks guys I hope you're doing well catch you later [Music]
Info
Channel: ospfpacket
Views: 965
Rating: undefined out of 5
Keywords: ospfpacket, ansible, ansible playbook, network, cisco, ccnp, ccna, cisco training, ccna training, ccnp training, network automation, automation, technology, eve, eve-ng, vmware, vmware workstation, training, network training
Id: lkMCbm_XGhM
Channel Id: undefined
Length: 19min 27sec (1167 seconds)
Published: Sat Apr 04 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.