So lastly,
let me show you another sample playbook that's networking related at any rate.
I mean I mentioned in the theory part of this lesson,
it's somewhat anticlimactic to do a whole lesson on networking.
Really,
the only learning there is to do is if you're not up to speed with basic TCP/IP.
But other than that,
we've seen nothing at all out of the ordinary in terms
of network requirements and Ansible.
It's very light.
So this sample playbook takes up a very mundane task,
and that is I want to create a playbook that backs up the running
configuration from my Cisco catalyst switches,
yes, older switches, and backs them up to a network location or to a repository.
So it's just a simple garden variety playbook,
but it brings us back to home base in terms of remembering what Ansible is
all about is to make our lives easier because we now can set this playbook
to run using task scheduler or cron if you use visual cron or a Windows
version of cron or you know from there.
And these playbooks will run and keep the systems ideally
in the desired state of configuration, DSC.
So here we've got hosts.
So presumably we would have an inventory group with the IP
addresses or DNS names of these switches.
And then here we're using not Ansible but Cisco's own official modules.
And IOS is the name of the old operating system on Cisco hardware.
And in this case,
there's an ios_command module where you can just send in
telnet commands like show running‑config.
Remember that register captures that output,
and it captures it as an object because,
as you can see, in the next task here,
we're basically going to take that running‑config results here,
this register, and we're just going to do .stdout[0].
So we can actually look at properties and methods and
trigger events based on a registered object.
So that's pretty sweet.
And again,
we see an example of that Jinja interpolation syntax here where we're
bringing in FAT. What is the current host name that's being processed now
and make that backup file personally named.
And then we can just go on from there to push the files
into a repo or whatever else we're doing.
So all good news, I think. I hope you're a lot more comfortable,
not only with Ansible networking, but with Ansible across the board
than you were before you started this training course.