Okay so let's walk through the solution then. So the very first time we're
going to have to do
is a right-day playbook that is going to use the NNC-ally module to configure
the system's
ethernet connection to use a DNS server with the IPv6 address of 2001 DB8, ABCD
, colon colon 1.
So with that said what I will do here is I will go in and I'll create a
playbook let's just call
us maybe validation1.yml and I'm going to insert mode have my three hyphens and
I'll give this
playbook a name and just call it let's just say validation1. Now the host
within your network WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
within your network
that was not specified so you can target a particular device in your topology
or if you so wish you
can just target every device you're managing. Now I'll set my gather facts to
be false and now I
will define my tasks. The task name can just be configure IPv6 DNS settings and
now I'm going to
have to utilize the NMC-ally module. So recall if you want to use this
particular module you're
going to have to install it via Ansible Galaxy so make sure you've done that
before attempting to
use this particular module. So it's going to be community.general.nncally and WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
use this particular module. So it's going to be community.general.nncally and
now I'm going to have
to specify the colon name which is a required parameter recall. Now in my case
here the devices
which I'm managing they both have an ethernet interface off and if I just go
here to one of my
devices if I don't IP adder we can see on my device it is ENS16. If that is
different for your
particular configuration then be aware to change that value. So I'm going to
target ENS16. The
type of the connection is an ethernet interface and now here is a part that we WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
type of the connection is an ethernet interface and now here is a part that we
're going to have to
configure the DNS for IPv6. Now recall if we look at the actual documentation
if we search for
Ansible NMC-ally let's go to the docs here. If I just run a search for DNS we
can see we have
the option for DNS4 that is going to be for IPv4 we do not want that but look
at this right here
we have this option for DNS6. This is going to allow to specify DNS servers
with an IPv6 address
and it's going to take a list as a value which is going to be comprised of WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
and it's going to take a list as a value which is going to be comprised of
subsequent string values.
So this is the option we're going to have to use. So we'll type DNS6 in this
case here we'll have
a colon and we're going to have to specify a list so here is our hyphen. Now
the value is going to be
2001 colon DB8 colon ABCD colon colon 1 and all I'm going to do is say that the
state should be
present. So if I just save this right here and I try to run the actual playbook
and to enter give WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
and to enter give
it a moment and as we can see we do have a change on the devices. So let's go
to our devices let's
say NMC-ally corn show here is interface I'm going to target so let's be a
little bit more
specific and say ens 160 we get all of this information and if I scroll
throughout it when I get to
ipv6.dns look at what we actually have here we have the value that we just
configured and the
same is going to be true on the other device as well. So with that now done let
's now write
the second playbook so let's create a new one called validation 2.yml again let WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
the second playbook so let's create a new one called validation 2.yml again let
's follow the
same structure three hyphens give it a name let's just say validation to once
again we're not
specified who we need to target so I'll just target the all group and once
again I'm going to set
gather facts to be false. Now we're going to have to use the rail system role
to configure the
network ethernet connection to insert a static route of 172. 2010.0/24 with the
next hop of 172.61.1
and ensure the playbook is going to immediately activate this change so the
role we're going to
use is rail system role network and the first thing we're going to have to do WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
use is rail system role network and the first thing we're going to have to do
is to insert some
variable values so we will define our vars and the first vars is going to be
the network provider
remember we're going to have to use nm for our particular version and we'll
specify the network
connections variable so once again I'm going to target ens at 160 the type is
ethernet and what
I'm going to do is I'm going to specify the IP key and then the route key and
now here I'm going
to provide a list and now I specify the network I want to connect to or rather WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
to provide a list and now I specify the network I want to connect to or rather
the route that I
want to insert should I say so it's going to be the 172. 2010.0 and now I
specify its prefix
which is going to be a slash 24 mask and then I specify the next hop via the
gateway so the next
hop is going to be 172.16.1.1 and now what I'm going to do is to call my answer
able role so we just
specify the roles key and the role is going to be rail hyphen system hyphen
roles dot network so
this role is going to consume these variables and make the configuration change WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
this role is going to consume these variables and make the configuration change
and now what we want
to do is we want to as per the instructions ensure that the playbook is going
to immediately activate
this change so what I will do is I'll define some new tasks and the first task
let's just call this
activate the change and I will use the answerable built-in command module and
the argument is going
to be the command so the command is going to be nmcli corn up and again I could
just hard code the
value but if you so wish what you can do is use the better practice and that
would be to insert WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
would be to insert
an actual variable so that would just be network connections we take the first
element of the list
and then grab the name key so that's going to activate the change but we also
as per the instruction
the last thing we're going to have to do is to write a task that is going to
verify that the
changes have taken effect so for the verification let's add a new task we'll
just say send verification
command and we'll use the answerable built-in command module again and the
command I'm going to send
is simply going to be ip route and I'll register this output as a variable and WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
is simply going to be ip route and I'll register this output as a variable and
let's just call ip
route result and then we'll just finally print the result so use a debug module
with the var parameter
and I'm going to print out that result variable right here so let's save this
and we'll give it a
go so we'll run validation to dot yml and to enter the role begins to execute
we make the changes
and the playbook completes now if we scroll on up we can actually see the
result of our commands
here as the STD out printing the result of that particular command and inside
that output we can WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
that output we can
actually see the presence of the route itself 172. 2010 /24 via 172.61.1 and if
we scroll on up
we'll get to the second device the blue box right here and similarly in the
standard out we can
also see the presence of the same route right there so that is us for our
validation challenge
on networking with Ansible I hope this has been informative for you and I'd
like to thank you for