Debian Codegraph @

ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_static_routes_module.rst

raw
1 .. _cisco.iosxr.iosxr_static_routes_module:
2
3
4 *******************************
5 cisco.iosxr.iosxr_static_routes
6 *******************************
7
8 **Resource module to configure static routes.**
9
10
11 Version added: 1.0.0
12
13 .. contents::
14 :local:
15 :depth: 1
16
17
18 Synopsis
19 --------
20 - This module manages static routes on devices running Cisco IOS-XR.
21
22
23
24
25 Parameters
26 ----------
27
28 .. raw:: html
29
30 <table border=0 cellpadding=0 class="documentation-table">
31 <tr>
32 <th colspan="5">Parameter</th>
33 <th>Choices/<font color="blue">Defaults</font></th>
34 <th width="100%">Comments</th>
35 </tr>
36 <tr>
37 <td colspan="5">
38 <div class="ansibleOptionAnchor" id="parameter-"></div>
39 <b>config</b>
40 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
41 <div style="font-size: small">
42 <span style="color: purple">list</span>
43 / <span style="color: purple">elements=dictionary</span>
44 </div>
45 </td>
46 <td>
47 </td>
48 <td>
49 <div>A dictionary of static route options.</div>
50 </td>
51 </tr>
52 <tr>
53 <td class="elbow-placeholder"></td>
54 <td colspan="4">
55 <div class="ansibleOptionAnchor" id="parameter-"></div>
56 <b>address_families</b>
57 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
58 <div style="font-size: small">
59 <span style="color: purple">list</span>
60 / <span style="color: purple">elements=dictionary</span>
61 </div>
62 </td>
63 <td>
64 </td>
65 <td>
66 <div>A dictionary specifying the address family to which the static route(s) belong.</div>
67 </td>
68 </tr>
69 <tr>
70 <td class="elbow-placeholder"></td>
71 <td class="elbow-placeholder"></td>
72 <td colspan="3">
73 <div class="ansibleOptionAnchor" id="parameter-"></div>
74 <b>afi</b>
75 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
76 <div style="font-size: small">
77 <span style="color: purple">string</span>
78 / <span style="color: red">required</span>
79 </div>
80 </td>
81 <td>
82 <ul style="margin: 0; padding: 0"><b>Choices:</b>
83 <li>ipv4</li>
84 <li>ipv6</li>
85 </ul>
86 </td>
87 <td>
88 <div>Specifies the top level address family indicator.</div>
89 </td>
90 </tr>
91 <tr>
92 <td class="elbow-placeholder"></td>
93 <td class="elbow-placeholder"></td>
94 <td colspan="3">
95 <div class="ansibleOptionAnchor" id="parameter-"></div>
96 <b>routes</b>
97 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
98 <div style="font-size: small">
99 <span style="color: purple">list</span>
100 / <span style="color: purple">elements=dictionary</span>
101 </div>
102 </td>
103 <td>
104 </td>
105 <td>
106 <div>A dictionary that specifies the static route configurations.</div>
107 </td>
108 </tr>
109 <tr>
110 <td class="elbow-placeholder"></td>
111 <td class="elbow-placeholder"></td>
112 <td class="elbow-placeholder"></td>
113 <td colspan="2">
114 <div class="ansibleOptionAnchor" id="parameter-"></div>
115 <b>dest</b>
116 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
117 <div style="font-size: small">
118 <span style="color: purple">string</span>
119 / <span style="color: red">required</span>
120 </div>
121 </td>
122 <td>
123 </td>
124 <td>
125 <div>An IPv4 or IPv6 address in CIDR notation that specifies the destination network for the static route.</div>
126 </td>
127 </tr>
128 <tr>
129 <td class="elbow-placeholder"></td>
130 <td class="elbow-placeholder"></td>
131 <td class="elbow-placeholder"></td>
132 <td colspan="2">
133 <div class="ansibleOptionAnchor" id="parameter-"></div>
134 <b>next_hops</b>
135 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
136 <div style="font-size: small">
137 <span style="color: purple">list</span>
138 / <span style="color: purple">elements=dictionary</span>
139 </div>
140 </td>
141 <td>
142 </td>
143 <td>
144 <div>Next hops to the specified destination.</div>
145 </td>
146 </tr>
147 <tr>
148 <td class="elbow-placeholder"></td>
149 <td class="elbow-placeholder"></td>
150 <td class="elbow-placeholder"></td>
151 <td class="elbow-placeholder"></td>
152 <td colspan="1">
153 <div class="ansibleOptionAnchor" id="parameter-"></div>
154 <b>admin_distance</b>
155 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
156 <div style="font-size: small">
157 <span style="color: purple">integer</span>
158 </div>
159 </td>
160 <td>
161 </td>
162 <td>
163 <div>The administrative distance for this static route.</div>
164 <div>Refer to vendor documentation for valid values.</div>
165 </td>
166 </tr>
167 <tr>
168 <td class="elbow-placeholder"></td>
169 <td class="elbow-placeholder"></td>
170 <td class="elbow-placeholder"></td>
171 <td class="elbow-placeholder"></td>
172 <td colspan="1">
173 <div class="ansibleOptionAnchor" id="parameter-"></div>
174 <b>description</b>
175 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
176 <div style="font-size: small">
177 <span style="color: purple">string</span>
178 </div>
179 </td>
180 <td>
181 </td>
182 <td>
183 <div>Specifies the description for this static route.</div>
184 </td>
185 </tr>
186 <tr>
187 <td class="elbow-placeholder"></td>
188 <td class="elbow-placeholder"></td>
189 <td class="elbow-placeholder"></td>
190 <td class="elbow-placeholder"></td>
191 <td colspan="1">
192 <div class="ansibleOptionAnchor" id="parameter-"></div>
193 <b>dest_vrf</b>
194 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
195 <div style="font-size: small">
196 <span style="color: purple">string</span>
197 </div>
198 </td>
199 <td>
200 </td>
201 <td>
202 <div>The destination VRF.</div>
203 </td>
204 </tr>
205 <tr>
206 <td class="elbow-placeholder"></td>
207 <td class="elbow-placeholder"></td>
208 <td class="elbow-placeholder"></td>
209 <td class="elbow-placeholder"></td>
210 <td colspan="1">
211 <div class="ansibleOptionAnchor" id="parameter-"></div>
212 <b>forward_router_address</b>
213 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
214 <div style="font-size: small">
215 <span style="color: purple">string</span>
216 </div>
217 </td>
218 <td>
219 </td>
220 <td>
221 <div>The IP address of the next hop that can be used to reach the destination network.</div>
222 </td>
223 </tr>
224 <tr>
225 <td class="elbow-placeholder"></td>
226 <td class="elbow-placeholder"></td>
227 <td class="elbow-placeholder"></td>
228 <td class="elbow-placeholder"></td>
229 <td colspan="1">
230 <div class="ansibleOptionAnchor" id="parameter-"></div>
231 <b>interface</b>
232 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
233 <div style="font-size: small">
234 <span style="color: purple">string</span>
235 </div>
236 </td>
237 <td>
238 </td>
239 <td>
240 <div>The interface to use to reach the destination.</div>
241 </td>
242 </tr>
243 <tr>
244 <td class="elbow-placeholder"></td>
245 <td class="elbow-placeholder"></td>
246 <td class="elbow-placeholder"></td>
247 <td class="elbow-placeholder"></td>
248 <td colspan="1">
249 <div class="ansibleOptionAnchor" id="parameter-"></div>
250 <b>metric</b>
251 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
252 <div style="font-size: small">
253 <span style="color: purple">integer</span>
254 </div>
255 </td>
256 <td>
257 </td>
258 <td>
259 <div>Specifes the metric for this static route.</div>
260 <div>Refer to vendor documentation for valid values.</div>
261 </td>
262 </tr>
263 <tr>
264 <td class="elbow-placeholder"></td>
265 <td class="elbow-placeholder"></td>
266 <td class="elbow-placeholder"></td>
267 <td class="elbow-placeholder"></td>
268 <td colspan="1">
269 <div class="ansibleOptionAnchor" id="parameter-"></div>
270 <b>tag</b>
271 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
272 <div style="font-size: small">
273 <span style="color: purple">integer</span>
274 </div>
275 </td>
276 <td>
277 </td>
278 <td>
279 <div>Specifies a numeric tag for this static route.</div>
280 <div>Refer to vendor documentation for valid values.</div>
281 </td>
282 </tr>
283 <tr>
284 <td class="elbow-placeholder"></td>
285 <td class="elbow-placeholder"></td>
286 <td class="elbow-placeholder"></td>
287 <td class="elbow-placeholder"></td>
288 <td colspan="1">
289 <div class="ansibleOptionAnchor" id="parameter-"></div>
290 <b>track</b>
291 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
292 <div style="font-size: small">
293 <span style="color: purple">string</span>
294 </div>
295 </td>
296 <td>
297 </td>
298 <td>
299 <div>Specifies the object to be tracked.</div>
300 <div>This enables object tracking for static routes.</div>
301 </td>
302 </tr>
303 <tr>
304 <td class="elbow-placeholder"></td>
305 <td class="elbow-placeholder"></td>
306 <td class="elbow-placeholder"></td>
307 <td class="elbow-placeholder"></td>
308 <td colspan="1">
309 <div class="ansibleOptionAnchor" id="parameter-"></div>
310 <b>tunnel_id</b>
311 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
312 <div style="font-size: small">
313 <span style="color: purple">integer</span>
314 </div>
315 </td>
316 <td>
317 </td>
318 <td>
319 <div>Specifies a tunnel id for the route.</div>
320 <div>Refer to vendor documentation for valid values.</div>
321 </td>
322 </tr>
323 <tr>
324 <td class="elbow-placeholder"></td>
325 <td class="elbow-placeholder"></td>
326 <td class="elbow-placeholder"></td>
327 <td class="elbow-placeholder"></td>
328 <td colspan="1">
329 <div class="ansibleOptionAnchor" id="parameter-"></div>
330 <b>vrflabel</b>
331 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
332 <div style="font-size: small">
333 <span style="color: purple">integer</span>
334 </div>
335 </td>
336 <td>
337 </td>
338 <td>
339 <div>Specifies the VRF label for this static route.</div>
340 <div>Refer to vendor documentation for valid values.</div>
341 </td>
342 </tr>
343
344
345 <tr>
346 <td class="elbow-placeholder"></td>
347 <td class="elbow-placeholder"></td>
348 <td colspan="3">
349 <div class="ansibleOptionAnchor" id="parameter-"></div>
350 <b>safi</b>
351 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
352 <div style="font-size: small">
353 <span style="color: purple">string</span>
354 / <span style="color: red">required</span>
355 </div>
356 </td>
357 <td>
358 <ul style="margin: 0; padding: 0"><b>Choices:</b>
359 <li>unicast</li>
360 <li>multicast</li>
361 </ul>
362 </td>
363 <td>
364 <div>Specifies the subsequent address family indicator.</div>
365 </td>
366 </tr>
367
368 <tr>
369 <td class="elbow-placeholder"></td>
370 <td colspan="4">
371 <div class="ansibleOptionAnchor" id="parameter-"></div>
372 <b>vrf</b>
373 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
374 <div style="font-size: small">
375 <span style="color: purple">string</span>
376 </div>
377 </td>
378 <td>
379 </td>
380 <td>
381 <div>The VRF to which the static route(s) belong.</div>
382 </td>
383 </tr>
384
385 <tr>
386 <td colspan="5">
387 <div class="ansibleOptionAnchor" id="parameter-"></div>
388 <b>running_config</b>
389 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
390 <div style="font-size: small">
391 <span style="color: purple">string</span>
392 </div>
393 </td>
394 <td>
395 </td>
396 <td>
397 <div>This option is used only with state <em>parsed</em>.</div>
398 <div>The value of this option should be the output received from the IOS-XR device by executing the command <b>show running-config router static</b>.</div>
399 <div>The state <em>parsed</em> reads the configuration from <code>running_config</code> option and transforms it into Ansible structured data as per the resource module&#x27;s argspec and the value is then returned in the <em>parsed</em> key within the result.</div>
400 </td>
401 </tr>
402 <tr>
403 <td colspan="5">
404 <div class="ansibleOptionAnchor" id="parameter-"></div>
405 <b>state</b>
406 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
407 <div style="font-size: small">
408 <span style="color: purple">string</span>
409 </div>
410 </td>
411 <td>
412 <ul style="margin: 0; padding: 0"><b>Choices:</b>
413 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
414 <li>replaced</li>
415 <li>overridden</li>
416 <li>deleted</li>
417 <li>gathered</li>
418 <li>rendered</li>
419 <li>parsed</li>
420 </ul>
421 </td>
422 <td>
423 <div>The state the configuration should be left in.</div>
424 </td>
425 </tr>
426 </table>
427 <br/>
428
429
430
431
432 Examples
433 --------
434
435 .. code-block:: yaml
436
437 # Using merged
438
439 # Before state
440 # -------------
441 # RP/0/RP0/CPU0:ios#show running-config router static
442 # Sat Feb 22 07:46:30.089 UTC
443 # % No such configuration item(s)
444 #
445 - name: Merge the provided configuration with the existing running configuration
446 cisco.iosxr.iosxr_static_routes:
447 config:
448 - address_families:
449 - afi: ipv4
450 safi: unicast
451 routes:
452 - dest: 192.0.2.16/28
453 next_hops:
454 - forward_router_address: 192.0.2.10
455 interface: FastEthernet0/0/0/1
456 description: LAB
457 metric: 120
458 tag: 10
459 - interface: FastEthernet0/0/0/5
460 track: ip_sla_1
461 - dest: 192.0.2.32/28
462 next_hops:
463 - forward_router_address: 192.0.2.11
464 admin_distance: 100
465 - afi: ipv6
466 safi: unicast
467 routes:
468 - dest: '2001:db8:1000::/36'
469 next_hops:
470 - interface: FastEthernet0/0/0/7
471 description: DC
472 - interface: FastEthernet0/0/0/8
473 forward_router_address: '2001:db8:2000:2::1'
474 - vrf: DEV_SITE
475 address_families:
476 - afi: ipv4
477 safi: unicast
478 routes:
479 - dest: 192.0.2.48/28
480 next_hops:
481 - forward_router_address: 192.0.2.12
482 description: DEV
483 dest_vrf: test_1
484 - dest: 192.0.2.80/28
485 next_hops:
486 - interface: FastEthernet0/0/0/2
487 forward_router_address: 192.0.2.14
488 dest_vrf: test_1
489 track: ip_sla_2
490 vrflabel: 124
491 state: merged
492
493
494 # Task Output
495 # -----------
496 # before: []
497 # commands:
498 # - router static
499 # - address-family ipv4 unicast
500 # - 192.0.2.16/28 192.0.2.10 FastEthernet0/0/0/1 description LAB metric 120 tag 10
501 # - 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1
502 # - 192.0.2.32/28 192.0.2.11 100
503 # - address-family ipv6 unicast
504 # - 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC
505 # - 2001:db8:1000::/36 2001:db8:2000:2::1 FastEthernet0/0/0/8
506 # - vrf DEV_SITE
507 # - address-family ipv4 unicast
508 # - 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV
509 # - 192.0.2.80/28 vrf test_1 192.0.2.14 FastEthernet0/0/0/2 track ip_sla_2 vrflabel 124
510 # after:
511 # - address_families:
512 # - afi: ipv4
513 # routes:
514 # - dest: 192.0.2.16/28
515 # next_hops:
516 # - description: LAB
517 # forward_router_address: 192.0.2.10
518 # interface: FastEthernet0/0/0/1
519 # metric: 120
520 # tag: 10
521 # - interface: FastEthernet0/0/0/5
522 # track: ip_sla_1
523 # - dest: 192.0.2.32/28
524 # next_hops:
525 # - admin_distance: 100
526 # forward_router_address: 192.0.2.11
527 # safi: unicast
528 # - afi: ipv6
529 # routes:
530 # - dest: 2001:db8:1000::/36
531 # next_hops:
532 # - description: DC
533 # interface: FastEthernet0/0/0/7
534 # - forward_router_address: 2001:db8:2000:2::1
535 # interface: FastEthernet0/0/0/8
536 # safi: unicast
537 # - address_families:
538 # - afi: ipv4
539 # routes:
540 # - dest: 192.0.2.48/28
541 # next_hops:
542 # - description: DEV
543 # dest_vrf: test_1
544 # forward_router_address: 192.0.2.12
545 # - dest: 192.0.2.80/28
546 # next_hops:
547 # - dest_vrf: test_1
548 # forward_router_address: 192.0.2.14
549 # interface: FastEthernet0/0/0/2
550 # track: ip_sla_2
551 # vrflabel: 124
552 # safi: unicast
553 # vrf: DEV_SITE
554
555
556 #
557 # After state
558 # -------------
559 # RP/0/RP0/CPU0:ios#show running-config router static
560 # Sat Feb 22 07:49:11.754 UTC
561 # router static
562 # address-family ipv4 unicast
563 # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120
564 # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1
565 # 192.0.2.32/28 192.0.2.11 100
566 # !
567 # address-family ipv6 unicast
568 # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC
569 # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1
570 # !
571 # vrf DEV_SITE
572 # address-family ipv4 unicast
573 # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV
574 # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2
575 # !
576 # !
577 # !
578
579 # Using merged to update existing static routes
580
581 # Before state
582 # -------------
583 # RP/0/RP0/CPU0:ios#show running-config router static
584 # Sat Feb 22 07:49:11.754 UTC
585 # router static
586 # address-family ipv4 unicast
587 # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120
588 # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1
589 # 192.0.2.32/28 192.0.2.11 100
590 # !
591 # address-family ipv6 unicast
592 # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC
593 # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1
594 # !
595 # vrf DEV_SITE
596 # address-family ipv4 unicast
597 # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV
598 # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2
599 # !
600 # !
601 # !
602
603 - name: Update existing static routes configuration using merged
604 cisco.iosxr.iosxr_static_routes:
605 config:
606 - vrf: DEV_SITE
607 address_families:
608 - afi: ipv4
609 safi: unicast
610 routes:
611 - dest: 192.0.2.48/28
612 next_hops:
613 - forward_router_address: 192.0.2.12
614 vrflabel: 2301
615 dest_vrf: test_1
616 - dest: 192.0.2.80/28
617 next_hops:
618 - interface: FastEthernet0/0/0/2
619 forward_router_address: 192.0.2.14
620 dest_vrf: test_1
621 description: rt_test_1
622 state: merged
623
624 # Task Output
625 # -----------
626 # before:
627 # - address_families:
628 # - afi: ipv4
629 # routes:
630 # - dest: 192.0.2.16/28
631 # next_hops:
632 # - description: LAB
633 # forward_router_address: 192.0.2.10
634 # interface: FastEthernet0/0/0/1
635 # metric: 120
636 # tag: 10
637 # - interface: FastEthernet0/0/0/5
638 # track: ip_sla_1
639 # - dest: 192.0.2.32/28
640 # next_hops:
641 # - admin_distance: 100
642 # forward_router_address: 192.0.2.11
643 # safi: unicast
644 # - afi: ipv6
645 # routes:
646 # - dest: 2001:db8:1000::/36
647 # next_hops:
648 # - description: DC
649 # interface: FastEthernet0/0/0/7
650 # - forward_router_address: 2001:db8:2000:2::1
651 # interface: FastEthernet0/0/0/8
652 # safi: unicast
653 # - address_families:
654 # - afi: ipv4
655 # routes:
656 # - dest: 192.0.2.48/28
657 # next_hops:
658 # - description: DEV
659 # dest_vrf: test_1
660 # forward_router_address: 192.0.2.12
661 # - dest: 192.0.2.80/28
662 # next_hops:
663 # - dest_vrf: test_1
664 # forward_router_address: 192.0.2.14
665 # interface: FastEthernet0/0/0/2
666 # track: ip_sla_2
667 # vrflabel: 124
668 # safi: unicast
669 # vrf: DEV_SITE
670 # commands:
671 # - router static
672 # - vrf DEV_SITE
673 # - address-family ipv4 unicast
674 # - 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV vrflabel 2301
675 # - 192.0.2.80/28 vrf test_1 192.0.2.14 FastEthernet0/0/0/2 description rt_test_1 track ip_sla_2 vrflabel 124
676 # after:
677 # - address_families:
678 # - afi: ipv4
679 # routes:
680 # - dest: 192.0.2.16/28
681 # next_hops:
682 # - description: LAB
683 # forward_router_address: 192.0.2.10
684 # interface: FastEthernet0/0/0/1
685 # metric: 120
686 # tag: 10
687 # - interface: FastEthernet0/0/0/5
688 # track: ip_sla_1
689 # - dest: 192.0.2.32/28
690 # next_hops:
691 # - admin_distance: 100
692 # forward_router_address: 192.0.2.11
693 # safi: unicast
694 # - afi: ipv6
695 # routes:
696 # - dest: 2001:db8:1000::/36
697 # next_hops:
698 # - description: DC
699 # interface: FastEthernet0/0/0/7
700 # - forward_router_address: 2001:db8:2000:2::1
701 # interface: FastEthernet0/0/0/8
702 # safi: unicast
703 # - address_families:
704 # - afi: ipv4
705 # routes:
706 # - dest: 192.0.2.48/28
707 # next_hops:
708 # - description: DEV
709 # dest_vrf: test_1
710 # forward_router_address: 192.0.2.12
711 # vrflabel: 2301
712 # - dest: 192.0.2.80/28
713 # next_hops:
714 # - description: rt_test_1
715 # dest_vrf: test_1
716 # forward_router_address: 192.0.2.14
717 # interface: FastEthernet0/0/0/2
718 # track: ip_sla_2
719 # vrflabel: 124
720 # safi: unicast
721 # vrf: DEV_SITE
722
723 # After state
724 # -------------
725 # RP/0/RP0/CPU0:ios#show running-config router static
726 # Sat Feb 22 07:49:11.754 UTC
727 # router static
728 # address-family ipv4 unicast
729 # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120
730 # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1
731 # 192.0.2.32/28 192.0.2.11 100
732 # !
733 # address-family ipv6 unicast
734 # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC
735 # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1
736 # !
737 # vrf DEV_SITE
738 # address-family ipv4 unicast
739 # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV vrflabel 2301
740 # 192.0.2.80/28 vrf test_1 192.0.2.14 FastEthernet0/0/0/2 description rt_test_1 track ip_sla_2 vrflabel 124
741 # !
742 # !
743 # !
744
745 # Using replaced to replace all next hop entries for a single destination network
746
747 # Before state
748 # --------------
749
750 # RP/0/RP0/CPU0:ios#sh running-config router static
751 # Sat Feb 22 07:59:08.669 UTC
752 # router static
753 # address-family ipv4 unicast
754 # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120
755 # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1
756 # 192.0.2.32/28 192.0.2.11 100
757 # !
758 # address-family ipv6 unicast
759 # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC
760 # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1
761 # !
762 # vrf DEV_SITE
763 # address-family ipv4 unicast
764 # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV
765 # 192.0.2.48/28 GigabitEthernet0/0/0/1 192.0.3.24 vrflabel 2302
766 # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2
767 # !
768 # !
769 # !
770
771 - name: Replace device configurations of static routes with provided configurations
772 cisco.iosxr.iosxr_static_routes:
773 config:
774 - vrf: DEV_SITE
775 address_families:
776 - afi: ipv4
777 safi: unicast
778 routes:
779 - dest: 192.0.2.48/28
780 next_hops:
781 - forward_router_address: 192.0.2.15
782 interface: FastEthernet0/0/0/3
783 description: DEV_NEW
784 dest_vrf: dev_test_2
785 state: replaced
786
787 # Task Output
788 # -----------
789 # before:
790 # - address_families:
791 # - afi: ipv4
792 # routes:
793 # - dest: 0.0.0.0/0
794 # next_hops:
795 # - forward_router_address: 10.0.151.254
796 # interface: MgmtEth0
797 # - dest: 192.0.2.16/28
798 # next_hops:
799 # - description: LAB
800 # forward_router_address: 192.0.2.10
801 # interface: FastEthernet0/0/0/1
802 # metric: 120
803 # tag: 10
804 # - interface: FastEthernet0/0/0/5
805 # track: ip_sla_1
806 # - dest: 192.0.2.32/28
807 # next_hops:
808 # - admin_distance: 100
809 # forward_router_address: 192.0.2.11
810 # safi: unicast
811 # - afi: ipv6
812 # routes:
813 # - dest: 2001:db8:1000::/36
814 # next_hops:
815 # - description: DC
816 # interface: FastEthernet0/0/0/7
817 # - forward_router_address: 2001:db8:2000:2::1
818 # interface: FastEthernet0/0/0/8
819 # safi: unicast
820 # - address_families:
821 # - afi: ipv4
822 # routes:
823 # - dest: 192.0.2.48/28
824 # next_hops:
825 # - description: DEV
826 # dest_vrf: test_1
827 # forward_router_address: 192.0.2.12
828 # - forward_router_address: 192.0.3.24
829 # interface: GigabitEthernet0/0/0/1
830 # vrflabel: 2302
831 # - dest: 192.0.2.80/28
832 # next_hops:
833 # - dest_vrf: test_1
834 # forward_router_address: 192.0.2.14
835 # interface: FastEthernet0/0/0/2
836 # track: ip_sla_2
837 # vrflabel: 124
838 # safi: unicast
839 # vrf: DEV_SITE
840 # commands:
841 # - router static
842 # - vrf DEV_SITE
843 # - address-family ipv4 unicast
844 # - no 192.0.2.48/28 vrf test_1 192.0.2.12
845 # - no 192.0.2.48/28 192.0.3.24 GigabitEthernet0/0/0/1
846 # - 192.0.2.48/28 vrf dev_test_2 192.0.2.15 FastEthernet0/0/0/3 description DEV_NEW
847 # after:
848 # - address_families:
849 # - afi: ipv4
850 # routes:
851 # - dest: 192.0.2.16/28
852 # next_hops:
853 # - description: LAB
854 # forward_router_address: 192.0.2.10
855 # interface: FastEthernet0/0/0/1
856 # metric: 120
857 # tag: 10
858 # - interface: FastEthernet0/0/0/5
859 # track: ip_sla_1
860 # - dest: 192.0.2.32/28
861 # next_hops:
862 # - admin_distance: 100
863 # forward_router_address: 192.0.2.11
864 # safi: unicast
865 # - afi: ipv6
866 # routes:
867 # - dest: 2001:db8:1000::/36
868 # next_hops:
869 # - description: DC
870 # interface: FastEthernet0/0/0/7
871 # - forward_router_address: 2001:db8:2000:2::1
872 # interface: FastEthernet0/0/0/8
873 # safi: unicast
874 # - address_families:
875 # - afi: ipv4
876 # routes:
877 # - dest: 192.0.2.48/28
878 # next_hops:
879 # - description: DEV_NEW
880 # dest_vrf: dev_test_2
881 # forward_router_address: 192.0.2.15
882 # interface: FastEthernet0/0/0/3
883 # - dest: 192.0.2.80/28
884 # next_hops:
885 # - dest_vrf: test_1
886 # forward_router_address: 192.0.2.14
887 # interface: FastEthernet0/0/0/2
888 # track: ip_sla_2
889 # vrflabel: 124
890 # safi: unicast
891 # vrf: DEV_SITE
892
893 # After state
894 # ------------
895 # RP/0/RP0/CPU0:ios#sh running-config router static
896 # Sat Feb 22 08:04:07.085 UTC
897 # router static
898 # address-family ipv4 unicast
899 # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120
900 # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1
901 # 192.0.2.32/28 192.0.2.11 100
902 # !
903 # address-family ipv6 unicast
904 # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC
905 # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1
906 # !
907 # vrf DEV_SITE
908 # address-family ipv4 unicast
909 # 192.0.2.48/28 vrf dev_test_2 FastEthernet0/0/0/3 192.0.2.15 description DEV_NEW
910 # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2
911 # !
912 # !
913 # !
914
915 # Using overridden to override all static route entries on the device
916
917 # Before state
918 # -------------
919 # RP/0/RP0/CPU0:ios#sh running-config router static
920 # Sat Feb 22 07:59:08.669 UTC
921 # router static
922 # address-family ipv4 unicast
923 # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120
924 # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1
925 # 192.0.2.32/28 192.0.2.11 100
926 # !
927 # address-family ipv6 unicast
928 # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC
929 # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1
930 # !
931 # vrf DEV_SITE
932 # address-family ipv4 unicast
933 # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV
934 # 192.0.2.48/28 GigabitEthernet0/0/0/1 192.0.3.24 vrflabel 2302
935 # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2
936 # !
937 # !
938 # !
939
940 - name: Overridde all static routes configuration with provided configuration
941 cisco.iosxr.iosxr_static_routes:
942 config:
943 - vrf: DEV_NEW
944 address_families:
945 - afi: ipv4
946 safi: unicast
947 routes:
948 - dest: 192.0.2.48/28
949 next_hops:
950 - forward_router_address: 192.0.2.15
951 interface: FastEthernet0/0/0/3
952 description: DEV1
953 - afi: ipv6
954 safi: unicast
955 routes:
956 - dest: '2001:db8:3000::/36'
957 next_hops:
958 - interface: FastEthernet0/0/0/4
959 forward_router_address: '2001:db8:2000:2::2'
960 description: PROD1
961 track: ip_sla_1
962 state: overridden
963
964 # Task Output
965 # -----------
966 # before:
967 # - address_families:
968 # - afi: ipv4
969 # routes:
970 # - dest: 192.0.2.16/28
971 # next_hops:
972 # - description: LAB
973 # forward_router_address: 192.0.2.10
974 # interface: FastEthernet0/0/0/1
975 # metric: 120
976 # tag: 10
977 # - interface: FastEthernet0/0/0/5
978 # track: ip_sla_1
979 # - dest: 192.0.2.32/28
980 # next_hops:
981 # - admin_distance: 100
982 # forward_router_address: 192.0.2.11
983 # safi: unicast
984 # - afi: ipv6
985 # routes:
986 # - dest: 2001:db8:1000::/36
987 # next_hops:
988 # - description: DC
989 # interface: FastEthernet0/0/0/7
990 # - forward_router_address: 2001:db8:2000:2::1
991 # interface: FastEthernet0/0/0/8
992 # safi: unicast
993 # - address_families:
994 # - afi: ipv4
995 # routes:
996 # - dest: 192.0.2.48/28
997 # next_hops:
998 # - description: DEV
999 # dest_vrf: test_1
1000 # forward_router_address: 192.0.2.12
1001 # - forward_router_address: 192.0.3.24
1002 # interface: GigabitEthernet0/0/0/1
1003 # vrflabel: 2302
1004 # - dest: 192.0.2.80/28
1005 # next_hops:
1006 # - dest_vrf: test_1
1007 # forward_router_address: 192.0.2.14
1008 # interface: FastEthernet0/0/0/2
1009 # track: ip_sla_2
1010 # vrflabel: 124
1011 # safi: unicast
1012 # vrf: DEV_SITE
1013 # commands:
1014 # - router static
1015 # - no vrf DEV_SITE
1016 # - no address-family ipv4 unicast
1017 # - no address-family ipv6 unicast
1018 # - vrf DEV_NEW
1019 # - address-family ipv4 unicast
1020 # - 192.0.2.48/28 192.0.2.15 FastEthernet0/0/0/3 description DEV1
1021 # - address-family ipv6 unicast
1022 # - 2001:db8:3000::/36 2001:db8:2000:2::2 FastEthernet0/0/0/4 description PROD1
1023 # track ip_sla_1
1024 # after:
1025 # - vrf: DEV_NEW
1026 # address_families:
1027 # - afi: ipv4
1028 # safi: unicast
1029 # routes:
1030 # - dest: 192.0.2.48/28
1031 # next_hops:
1032 # - forward_router_address: 192.0.2.15
1033 # interface: FastEthernet0/0/0/3
1034 # description: DEV1
1035 # - afi: ipv6
1036 # safi: unicast
1037 # routes:
1038 # - dest: 2001:db8:3000::/36
1039 # next_hops:
1040 # - interface: FastEthernet0/0/0/4
1041 # forward_router_address: 2001:db8:2000:2::2
1042 # description: PROD1
1043 # track: ip_sla_1
1044
1045 # After state
1046 # -------------
1047 # RP/0/RP0/CPU0:ios#sh running-config router static
1048 # Sat Feb 22 08:07:41.516 UTC
1049 # router static
1050 # vrf DEV_NEW
1051 # address-family ipv4 unicast
1052 # 192.0.2.48/28 FastEthernet0/0/0/3 192.0.2.15 description DEV1
1053 # !
1054 # address-family ipv6 unicast
1055 # 2001:db8:3000::/36 FastEthernet0/0/0/4 2001:db8:2000:2::2 description PROD1 track ip_sla_1
1056 # !
1057 # !
1058 # !
1059
1060 # Using deleted to delete all destination network entries under a single AFI
1061
1062 # Before state
1063 # -------------
1064 # RP/0/RP0/CPU0:ios#sh running-config router static
1065 # Sat Feb 22 07:59:08.669 UTC
1066 # router static
1067 # address-family ipv4 unicast
1068 # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120
1069 # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1
1070 # 192.0.2.32/28 192.0.2.11 100
1071 # !
1072 # address-family ipv6 unicast
1073 # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC
1074 # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1
1075 # !
1076 # vrf DEV_SITE
1077 # address-family ipv4 unicast
1078 # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV
1079 # 192.0.2.48/28 GigabitEthernet0/0/0/1 192.0.3.24 vrflabel 2302
1080 # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2
1081 # !
1082 # !
1083 # !
1084
1085 - name: Delete all destination network entries under a single AFI
1086 cisco.iosxr.iosxr_static_routes:
1087 config:
1088 - vrf: DEV_SITE
1089 address_families:
1090 - afi: ipv4
1091 safi: unicast
1092 state: deleted
1093
1094 # Task output
1095 # -----------------------
1096 # before:
1097 # - address_families:
1098 # - afi: ipv4
1099 # routes:
1100 # - dest: 192.0.2.16/28
1101 # next_hops:
1102 # - description: LAB
1103 # forward_router_address: 192.0.2.10
1104 # interface: FastEthernet0/0/0/1
1105 # metric: 120
1106 # tag: 10
1107 # - interface: FastEthernet0/0/0/5
1108 # track: ip_sla_1
1109 # - dest: 192.0.2.32/28
1110 # next_hops:
1111 # - admin_distance: 100
1112 # forward_router_address: 192.0.2.11
1113 # safi: unicast
1114 # - afi: ipv6
1115 # routes:
1116 # - dest: 2001:db8:1000::/36
1117 # next_hops:
1118 # - description: DC
1119 # interface: FastEthernet0/0/0/7
1120 # - forward_router_address: 2001:db8:2000:2::1
1121 # interface: FastEthernet0/0/0/8
1122 # safi: unicast
1123 # - address_families:
1124 # - afi: ipv4
1125 # routes:
1126 # - dest: 192.0.2.48/28
1127 # next_hops:
1128 # - description: DEV
1129 # dest_vrf: test_1
1130 # forward_router_address: 192.0.2.12
1131 # - forward_router_address: 192.0.3.24
1132 # interface: GigabitEthernet0/0/0/1
1133 # vrflabel: 2302
1134 # - dest: 192.0.2.80/28
1135 # next_hops:
1136 # - dest_vrf: test_1
1137 # forward_router_address: 192.0.2.14
1138 # interface: FastEthernet0/0/0/2
1139 # track: ip_sla_2
1140 # vrflabel: 124
1141 # safi: unicast
1142 # vrf: DEV_SITE
1143 # commands:
1144 # - router static
1145 # - vrf DEV_SITE
1146 # - no address-family ipv4 unicast
1147 # after:
1148 # - address_families:
1149 # - afi: ipv4
1150 # routes:
1151 # - dest: 192.0.2.16/28
1152 # next_hops:
1153 # - description: LAB
1154 # forward_router_address: 192.0.2.10
1155 # interface: FastEthernet0/0/0/1
1156 # metric: 120
1157 # tag: 10
1158 # - interface: FastEthernet0/0/0/5
1159 # track: ip_sla_1
1160 # - dest: 192.0.2.32/28
1161 # next_hops:
1162 # - admin_distance: 100
1163 # forward_router_address: 192.0.2.11
1164 # safi: unicast
1165 # - afi: ipv6
1166 # routes:
1167 # - dest: 2001:db8:1000::/36
1168 # next_hops:
1169 # - description: DC
1170 # interface: FastEthernet0/0/0/7
1171 # - forward_router_address: 2001:db8:2000:2::1
1172 # interface: FastEthernet0/0/0/8
1173 # safi: unicast
1174 # - address_families:
1175 # - afi: ipv4
1176 # routes:
1177 # - dest: 192.0.2.48/28
1178 # next_hops:
1179 # - description: DEV
1180 # dest_vrf: test_1
1181 # forward_router_address: 192.0.2.12
1182 # - forward_router_address: 192.0.3.24
1183 # interface: GigabitEthernet0/0/0/1
1184 # vrflabel: 2302
1185 # - dest: 192.0.2.80/28
1186 # next_hops:
1187 # - dest_vrf: test_1
1188 # forward_router_address: 192.0.2.14
1189 # interface: FastEthernet0/0/0/2
1190 # track: ip_sla_2
1191 # vrflabel: 124
1192 # safi: unicast
1193 # - vrf: DEV_SITE
1194
1195 # After state
1196 # ------------
1197
1198 # RP/0/RP0/CPU0:ios#sh running-config router static
1199 # Sat Feb 22 08:16:41.464 UTC
1200 # router static
1201 # address-family ipv4 unicast
1202 # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120
1203 # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1
1204 # 192.0.2.32/28 192.0.2.11 100
1205 # !
1206 # address-family ipv6 unicast
1207 # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC
1208 # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1
1209 # !
1210 # vrf DEV_SITE
1211 # !
1212 # !
1213
1214 # Using deleted to remove all static route entries from the device
1215
1216 # Before state
1217 # -------------
1218 # RP/0/RP0/CPU0:ios#sh running-config router static
1219 # Sat Feb 22 07:59:08.669 UTC
1220 # router static
1221 # address-family ipv4 unicast
1222 # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120
1223 # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1
1224 # 192.0.2.32/28 192.0.2.11 100
1225 # !
1226 # address-family ipv6 unicast
1227 # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC
1228 # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1
1229 # !
1230 # vrf DEV_SITE
1231 # address-family ipv4 unicast
1232 # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV
1233 # 192.0.2.48/28 GigabitEthernet0/0/0/1 192.0.3.24 vrflabel 2302
1234 # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2
1235 # !
1236 # !
1237 # !
1238
1239 - name: Delete static routes configuration
1240 cisco.iosxr.iosxr_static_routes:
1241 state: deleted
1242
1243 # Task output
1244 # -----------------------
1245 # before:
1246 # - address_families:
1247 # - afi: ipv4
1248 # routes:
1249 # - dest: 192.0.2.16/28
1250 # next_hops:
1251 # - description: LAB
1252 # forward_router_address: 192.0.2.10
1253 # interface: FastEthernet0/0/0/1
1254 # metric: 120
1255 # tag: 10
1256 # - interface: FastEthernet0/0/0/5
1257 # track: ip_sla_1
1258 # - dest: 192.0.2.32/28
1259 # next_hops:
1260 # - admin_distance: 100
1261 # forward_router_address: 192.0.2.11
1262 # safi: unicast
1263 # - afi: ipv6
1264 # routes:
1265 # - dest: 2001:db8:1000::/36
1266 # next_hops:
1267 # - description: DC
1268 # interface: FastEthernet0/0/0/7
1269 # - forward_router_address: 2001:db8:2000:2::1
1270 # interface: FastEthernet0/0/0/8
1271 # safi: unicast
1272 # - address_families:
1273 # - afi: ipv4
1274 # routes:
1275 # - dest: 192.0.2.48/28
1276 # next_hops:
1277 # - description: DEV
1278 # dest_vrf: test_1
1279 # forward_router_address: 192.0.2.12
1280 # - forward_router_address: 192.0.3.24
1281 # interface: GigabitEthernet0/0/0/1
1282 # vrflabel: 2302
1283 # - dest: 192.0.2.80/28
1284 # next_hops:
1285 # - dest_vrf: test_1
1286 # forward_router_address: 192.0.2.14
1287 # interface: FastEthernet0/0/0/2
1288 # track: ip_sla_2
1289 # vrflabel: 124
1290 # safi: unicast
1291 # vrf: DEV_SITE
1292 # commands:
1293 # - no router static
1294 # after: []
1295 # After state
1296 # ------------
1297 # RP/0/RP0/CPU0:ios#sh running-config router static
1298 # Sat Feb 22 08:50:43.038 UTC
1299 # % No such configuration item(s)
1300
1301 # Using gathered to gather static route facts from the device
1302
1303 - name: Gather static routes facts from the device using iosxr_static_routes module
1304 cisco.iosxr.iosxr_static_routes:
1305 state: gathered
1306
1307 # Task output (redacted)
1308 # -----------------------
1309 # "gathered": [
1310 # {
1311 # "address_families": [
1312 # {
1313 # "afi": "ipv4",
1314 # "routes": [
1315 # {
1316 # "dest": "192.0.2.16/28",
1317 # "next_hops": [
1318 # {
1319 # "description": "LAB",
1320 # "forward_router_address": "192.0.2.10",
1321 # "interface": "FastEthernet0/0/0/1",
1322 # "metric": 120,
1323 # "tag": 10
1324 # },
1325 # {
1326 # "interface": "FastEthernet0/0/0/5",
1327 # "track": "ip_sla_1"
1328 # }
1329 # ]
1330 # },
1331 # {
1332 # "dest": "192.0.2.32/28",
1333 # "next_hops": [
1334 # {
1335 # "admin_distance": 100,
1336 # "forward_router_address": "192.0.2.11"
1337 # }
1338 # ]
1339 # }
1340 # ],
1341 # "safi": "unicast"
1342 # },
1343 # {
1344 # "afi": "ipv6",
1345 # "routes": [
1346 # {
1347 # "dest": "2001:db8:1000::/36",
1348 # "next_hops": [
1349 # {
1350 # "description": "DC",
1351 # "interface": "FastEthernet0/0/0/7"
1352 # },
1353 # {
1354 # "forward_router_address": "2001:db8:2000:2::1",
1355 # "interface": "FastEthernet0/0/0/8"
1356 # }
1357 # ]
1358 # }
1359 # ],
1360 # "safi": "unicast"
1361 # }
1362 # ]
1363 # },
1364 # {
1365 # "address_families": [
1366 # {
1367 # "afi": "ipv4",
1368 # "routes": [
1369 # {
1370 # "dest": "192.0.2.48/28",
1371 # "next_hops": [
1372 # {
1373 # "description": "DEV",
1374 # "dest_vrf": "test_1",
1375 # "forward_router_address": "192.0.2.12"
1376 # },
1377 # {
1378 # "forward_router_address": "192.0.3.24",
1379 # "interface": "GigabitEthernet0/0/0/1",
1380 # "vrflabel": 2302
1381 # }
1382 # ]
1383 # },
1384 # {
1385 # "dest": "192.0.2.80/28",
1386 # "next_hops": [
1387 # {
1388 # "dest_vrf": "test_1",
1389 # "forward_router_address": "192.0.2.14",
1390 # "interface": "FastEthernet0/0/0/2",
1391 # "track": "ip_sla_2",
1392 # "vrflabel": 124
1393 # }
1394 # ]
1395 # }
1396 # ],
1397 # "safi": "unicast"
1398 # }
1399 # ],
1400 # "vrf": "DEV_SITE"
1401 # }
1402 # ]
1403
1404 # Using rendered
1405
1406 - name: Render platform specific commands (without connecting to the device)
1407 cisco.iosxr.iosxr_static_routes: null
1408 config:
1409 - vrf: DEV_SITE
1410 address_families:
1411 - afi: ipv4
1412 safi: unicast
1413 routes:
1414 - dest: 192.0.2.48/28
1415 next_hops:
1416 - forward_router_address: 192.0.2.12
1417 description: DEV
1418 dest_vrf: test_1
1419 - dest: 192.0.2.80/28
1420 next_hops:
1421 - interface: FastEthernet0/0/0/2
1422 forward_router_address: 192.0.2.14
1423 dest_vrf: test_1
1424 track: ip_sla_2
1425 vrflabel: 124
1426
1427 # Task Output (redacted)
1428 # -----------------------
1429 # "rendered": [
1430 # "router static"s,
1431 # "vrf DEV_SITE",
1432 # "address-family ipv4 unicast",
1433 # "192.0.2.48/28 vrf test_1 192.0.2.12 description DEV",
1434 # "192.0.2.80/28 vrf test_1 192.0.2.14 FastEthernet0/0/0/2 track ip_sla_2 vrflabel 124"
1435
1436 # Using parsed
1437
1438 # parsed.cfg
1439 # ------------
1440 # Fri Nov 29 21:10:41.896 UTC
1441 # router static
1442 # address-family ipv4 unicast
1443 # 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120
1444 # 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1
1445 # 192.0.2.32/28 192.0.2.11 100
1446 # !
1447 # address-family ipv6 unicast
1448 # 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC
1449 # 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1
1450 # !
1451 # vrf DEV_SITE
1452 # address-family ipv4 unicast
1453 # 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV
1454 # 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2
1455 # !
1456 # !
1457 # !
1458
1459 - name: Use parsed state to convert externally supplied device specific static routes
1460 commands to structured format
1461 cisco.iosxr.iosxr_static_routes:
1462 running_config: "{{ lookup('file', '../../fixtures/parsed.cfg') }}"
1463 state: parsed
1464
1465 # Task output (redacted)
1466 # -----------------------
1467 # "parsed": [
1468 # {
1469 # "address_families": [
1470 # {
1471 # "afi": "ipv4",
1472 # "routes": [
1473 # {
1474 # "dest": "192.0.2.16/28",
1475 # "next_hops": [
1476 # {
1477 # "description": "LAB",
1478 # "forward_router_address": "192.0.2.10",
1479 # "interface": "FastEthernet0/0/0/1",
1480 # "metric": 120,
1481 # "tag": 10
1482 # },
1483 # {
1484 # "interface": "FastEthernet0/0/0/5",
1485 # "track": "ip_sla_1"
1486 # }
1487 # ]
1488 # },
1489 # {
1490 # "dest": "192.0.2.32/28",
1491 # "next_hops": [
1492 # {
1493 # "admin_distance": 100,
1494 # "forward_router_address": "192.0.2.11"
1495 # }
1496 # ]
1497 # }
1498 # ],
1499 # "safi": "unicast"
1500 # },
1501 # {
1502 # "afi": "ipv6",
1503 # "routes": [
1504 # {
1505 # "dest": "2001:db8:1000::/36",
1506 # "next_hops": [
1507 # {
1508 # "description": "DC",
1509 # "interface": "FastEthernet0/0/0/7"
1510 # },
1511 # {
1512 # "forward_router_address": "2001:db8:2000:2::1",
1513 # "interface": "FastEthernet0/0/0/8"
1514 # }
1515 # ]
1516 # }
1517 # ],
1518 # "safi": "unicast"
1519 # }
1520 # ]
1521 # },
1522 # {
1523 # "address_families": [
1524 # {
1525 # "afi": "ipv4",
1526 # "routes": [
1527 # {
1528 # "dest": "192.0.2.48/28",
1529 # "next_hops": [
1530 # {
1531 # "description": "DEV",
1532 # "dest_vrf": "test_1",
1533 # "forward_router_address": "192.0.2.12"
1534 # }
1535 # ]
1536 # },
1537 # {
1538 # "dest": "192.0.2.80/28",
1539 # "next_hops": [
1540 # {
1541 # "dest_vrf": "test_1",
1542 # "forward_router_address": "192.0.2.14",
1543 # "interface": "FastEthernet0/0/0/2",
1544 # "track": "ip_sla_2",
1545 # "vrflabel": 124
1546 # }
1547 # ]
1548 # }
1549 # ],
1550 # "safi": "unicast"
1551 # }
1552 # ],
1553 # "vrf": "DEV_SITE"
1554 # }
1555 # ]
1556 # }
1557
1558
1559
1560 Return Values
1561 -------------
1562 Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
1563
1564 .. raw:: html
1565
1566 <table border=0 cellpadding=0 class="documentation-table">
1567 <tr>
1568 <th colspan="1">Key</th>
1569 <th>Returned</th>
1570 <th width="100%">Description</th>
1571 </tr>
1572 <tr>
1573 <td colspan="1">
1574 <div class="ansibleOptionAnchor" id="return-"></div>
1575 <b>after</b>
1576 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
1577 <div style="font-size: small">
1578 <span style="color: purple">list</span>
1579 </div>
1580 </td>
1581 <td>when changed</td>
1582 <td>
1583 <div>The resulting configuration model invocation.</div>
1584 <br/>
1585 <div style="font-size: smaller"><b>Sample:</b></div>
1586 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format
1587 of the parameters above.</div>
1588 </td>
1589 </tr>
1590 <tr>
1591 <td colspan="1">
1592 <div class="ansibleOptionAnchor" id="return-"></div>
1593 <b>before</b>
1594 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
1595 <div style="font-size: small">
1596 <span style="color: purple">list</span>
1597 </div>
1598 </td>
1599 <td>always</td>
1600 <td>
1601 <div>The configuration prior to the model invocation.</div>
1602 <br/>
1603 <div style="font-size: smaller"><b>Sample:</b></div>
1604 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format
1605 of the parameters above.</div>
1606 </td>
1607 </tr>
1608 <tr>
1609 <td colspan="1">
1610 <div class="ansibleOptionAnchor" id="return-"></div>
1611 <b>commands</b>
1612 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
1613 <div style="font-size: small">
1614 <span style="color: purple">list</span>
1615 </div>
1616 </td>
1617 <td>always</td>
1618 <td>
1619 <div>The set of commands pushed to the remote device.</div>
1620 <br/>
1621 <div style="font-size: smaller"><b>Sample:</b></div>
1622 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;router static&#x27;, &#x27;vrf dev_site&#x27;, &#x27;address-family ipv4 unicast&#x27;, &#x27;192.0.2.48/28 192.0.2.12 FastEthernet0/0/0/1 track ip_sla_10 description dev1&#x27;, &#x27;address-family ipv6 unicast&#x27;, &#x27;no 2001:db8:1000::/36&#x27;, &#x27;2001:db8:3000::/36 2001:db8:2000:2::2 FastEthernet0/0/0/4 track ip_sla_11 description prod1&#x27;]</div>
1623 </td>
1624 </tr>
1625 </table>
1626 <br/><br/>
1627
1628
1629 Status
1630 ------
1631
1632
1633 Authors
1634 ~~~~~~~
1635
1636 - Nilashish Chakraborty (@NilashishC)