Ansible IOS_Config Module: Part 2 Pushing configuration from txt file

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we're going to be covering some basic config deployment onto a Cisco router using ansible I'm going to start in this csr route sir I've got three CSR Reuters running for this example and I'm just going to show you the configuration on here and limit it to the user name you can see I've got six users here Roger two three four five and six what we're gonna do is add another user but we want to add that user across all of these devices if I check show run including username I've got user 6 up to here and on this return I've got user six there we're going to use ansible for this purpose and I've got a playbook which I've called push file it's going to step you through the playbook and show you what it does though this playbook is gonna run against all the hosts are in my group CSR Reuters now if we skip into my hosts file you can see in my group CSR Reuters I've got three Reuters which the s are one two and three which we looked at earlier the connection is going to be network CLI and we're not going to be gathering facts now this is the main meat of the playbook and we're using the iOS config module this is the descriptive name I've given to the play and I'm saying that I want to configure these routers with whatever is in this source which is in network ban ability config switch text and then once we're done we're gonna save the running config and the iOS config has a an option to save when modified so if the config has been modified and it will get saved so if I go back now to this area so the config switch text which is yeah though in here this is my configuration that I want to push let's just remove these now this is just a straight text file so I can actually type anything I want in here that is Sisko configuration so I'm going to say Roger 10 that's what I'm going to configure so I want to push this config username Roger 10 password Cisco to all of those devices though we're just going to jump into the terminal now this is my ansible host and I'm going to run that playbook by typing the command ansible playbook push file dot llamo and what this is going to do is connect to each of those routers in turn well in actual fact what it's actually going to do is try and connect to all three at the same time and so what we'll try and connect to five devices at once and we can see that we've got a changed and we've got an orange status which means it has made a config change on those devices now I'm saving the config on the router so I've got three tasks that all completed successfully now if I run this again because of the idem potency of the ansible playbook this task will run once more but this time the ansible will reach out and determine that this change does not need to be made as it is already there so you can see that the config goes all green and when it comes back it will say changed zero so it it's the task completed successfully but the change status was zero so what it did is check those Reuters but didn't actually make a change now if we go back to our roots and I show that command again we can see now that I do have a new username on this router or Roger 10 and we'll just check CSR to and it's there and it's also on CSR 3 so that's a very simple way that you can push lines of configuration in a text file out to multiple devices using ansible thank you for watching and if you like these videos please subscribe as I do post a few on ansible different topics and I look forward to seeing you in the next video
Info
Channel: Roger Perkin
Views: 5,557
Rating: 4.939394 out of 5
Keywords: roger perkin, ansible, network automaiton, ios_config module, ansible cisco, ansible for network engineers
Id: R1ZdUEDQucs
Channel Id: undefined
Length: 5min 18sec (318 seconds)
Published: Fri Oct 26 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.