Debian Codegraph @

ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_l3_interfaces_module.rst

raw
1 .. _cisco.iosxr.iosxr_l3_interfaces_module:
2
3
4 *******************************
5 cisco.iosxr.iosxr_l3_interfaces
6 *******************************
7
8 **Resource module to configure L3 interfaces.**
9
10
11 Version added: 1.0.0
12
13 .. contents::
14 :local:
15 :depth: 1
16
17
18 Synopsis
19 --------
20 - This module provides declarative management of Layer-3 interface on Cisco IOS-XR devices.
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="4">Parameter</th>
33 <th>Choices/<font color="blue">Defaults</font></th>
34 <th width="100%">Comments</th>
35 </tr>
36 <tr>
37 <td colspan="4">
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 Layer-3 interface options</div>
50 </td>
51 </tr>
52 <tr>
53 <td class="elbow-placeholder"></td>
54 <td colspan="3">
55 <div class="ansibleOptionAnchor" id="parameter-"></div>
56 <b>carrier_delay</b>
57 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
58 <div style="font-size: small">
59 <span style="color: purple">dictionary</span>
60 </div>
61 </td>
62 <td>
63 </td>
64 <td>
65 <div>Delay carrier transitions.</div>
66 </td>
67 </tr>
68 <tr>
69 <td class="elbow-placeholder"></td>
70 <td class="elbow-placeholder"></td>
71 <td colspan="2">
72 <div class="ansibleOptionAnchor" id="parameter-"></div>
73 <b>down</b>
74 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
75 <div style="font-size: small">
76 <span style="color: purple">integer</span>
77 </div>
78 </td>
79 <td>
80 </td>
81 <td>
82 <div>Delay for carrier-down event in milliseconds.</div>
83 </td>
84 </tr>
85 <tr>
86 <td class="elbow-placeholder"></td>
87 <td class="elbow-placeholder"></td>
88 <td colspan="2">
89 <div class="ansibleOptionAnchor" id="parameter-"></div>
90 <b>up</b>
91 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
92 <div style="font-size: small">
93 <span style="color: purple">integer</span>
94 </div>
95 </td>
96 <td>
97 </td>
98 <td>
99 <div>Delay for carrier-up event in milliseconds.</div>
100 </td>
101 </tr>
102
103 <tr>
104 <td class="elbow-placeholder"></td>
105 <td colspan="3">
106 <div class="ansibleOptionAnchor" id="parameter-"></div>
107 <b>dampening</b>
108 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
109 <div style="font-size: small">
110 <span style="color: purple">dictionary</span>
111 </div>
112 </td>
113 <td>
114 </td>
115 <td>
116 <div>Enable interface dampening to reduce the effects of interface flapping.</div>
117 </td>
118 </tr>
119 <tr>
120 <td class="elbow-placeholder"></td>
121 <td class="elbow-placeholder"></td>
122 <td colspan="2">
123 <div class="ansibleOptionAnchor" id="parameter-"></div>
124 <b>enabled</b>
125 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
126 <div style="font-size: small">
127 <span style="color: purple">boolean</span>
128 </div>
129 </td>
130 <td>
131 <ul style="margin: 0; padding: 0"><b>Choices:</b>
132 <li>no</li>
133 <li>yes</li>
134 </ul>
135 </td>
136 <td>
137 <div>Enable or disable dampening.</div>
138 </td>
139 </tr>
140 <tr>
141 <td class="elbow-placeholder"></td>
142 <td class="elbow-placeholder"></td>
143 <td colspan="2">
144 <div class="ansibleOptionAnchor" id="parameter-"></div>
145 <b>half_life</b>
146 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
147 <div style="font-size: small">
148 <span style="color: purple">integer</span>
149 </div>
150 </td>
151 <td>
152 </td>
153 <td>
154 <div>The time in minutes after which a penalty is halved if the interface stays up.</div>
155 </td>
156 </tr>
157 <tr>
158 <td class="elbow-placeholder"></td>
159 <td class="elbow-placeholder"></td>
160 <td colspan="2">
161 <div class="ansibleOptionAnchor" id="parameter-"></div>
162 <b>max_suppress_time</b>
163 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
164 <div style="font-size: small">
165 <span style="color: purple">integer</span>
166 </div>
167 </td>
168 <td>
169 </td>
170 <td>
171 <div>The maximum time in minutes that an interface can be suppressed.</div>
172 </td>
173 </tr>
174 <tr>
175 <td class="elbow-placeholder"></td>
176 <td class="elbow-placeholder"></td>
177 <td colspan="2">
178 <div class="ansibleOptionAnchor" id="parameter-"></div>
179 <b>restart_penalty</b>
180 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
181 <div style="font-size: small">
182 <span style="color: purple">integer</span>
183 </div>
184 </td>
185 <td>
186 </td>
187 <td>
188 <div>The penalty assigned to an interface when it flaps.</div>
189 </td>
190 </tr>
191 <tr>
192 <td class="elbow-placeholder"></td>
193 <td class="elbow-placeholder"></td>
194 <td colspan="2">
195 <div class="ansibleOptionAnchor" id="parameter-"></div>
196 <b>reuse_threshold</b>
197 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
198 <div style="font-size: small">
199 <span style="color: purple">integer</span>
200 </div>
201 </td>
202 <td>
203 </td>
204 <td>
205 <div>The penalty value below which a suppressed interface is unsuppressed.</div>
206 </td>
207 </tr>
208 <tr>
209 <td class="elbow-placeholder"></td>
210 <td class="elbow-placeholder"></td>
211 <td colspan="2">
212 <div class="ansibleOptionAnchor" id="parameter-"></div>
213 <b>suppress_threshold</b>
214 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
215 <div style="font-size: small">
216 <span style="color: purple">integer</span>
217 </div>
218 </td>
219 <td>
220 </td>
221 <td>
222 <div>The penalty value above which an interface is suppressed.</div>
223 </td>
224 </tr>
225
226 <tr>
227 <td class="elbow-placeholder"></td>
228 <td colspan="3">
229 <div class="ansibleOptionAnchor" id="parameter-"></div>
230 <b>flow</b>
231 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
232 <div style="font-size: small">
233 <span style="color: purple">dictionary</span>
234 </div>
235 </td>
236 <td>
237 </td>
238 <td>
239 <div>Configure NetFlow monitoring on the interface.</div>
240 </td>
241 </tr>
242 <tr>
243 <td class="elbow-placeholder"></td>
244 <td class="elbow-placeholder"></td>
245 <td colspan="2">
246 <div class="ansibleOptionAnchor" id="parameter-"></div>
247 <b>ipv4</b>
248 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
249 <div style="font-size: small">
250 <span style="color: purple">dictionary</span>
251 </div>
252 </td>
253 <td>
254 </td>
255 <td>
256 <div>Configure NetFlow monitoring for IPv4 traffic.</div>
257 </td>
258 </tr>
259 <tr>
260 <td class="elbow-placeholder"></td>
261 <td class="elbow-placeholder"></td>
262 <td class="elbow-placeholder"></td>
263 <td colspan="1">
264 <div class="ansibleOptionAnchor" id="parameter-"></div>
265 <b>direction</b>
266 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
267 <div style="font-size: small">
268 <span style="color: purple">string</span>
269 </div>
270 </td>
271 <td>
272 <ul style="margin: 0; padding: 0"><b>Choices:</b>
273 <li>ingress</li>
274 <li>egress</li>
275 <li>bidirectional</li>
276 </ul>
277 </td>
278 <td>
279 <div>Direction of the flow monitoring.</div>
280 </td>
281 </tr>
282 <tr>
283 <td class="elbow-placeholder"></td>
284 <td class="elbow-placeholder"></td>
285 <td class="elbow-placeholder"></td>
286 <td colspan="1">
287 <div class="ansibleOptionAnchor" id="parameter-"></div>
288 <b>monitor</b>
289 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
290 <div style="font-size: small">
291 <span style="color: purple">string</span>
292 </div>
293 </td>
294 <td>
295 </td>
296 <td>
297 <div>Name of the flow monitor to apply.</div>
298 </td>
299 </tr>
300 <tr>
301 <td class="elbow-placeholder"></td>
302 <td class="elbow-placeholder"></td>
303 <td class="elbow-placeholder"></td>
304 <td colspan="1">
305 <div class="ansibleOptionAnchor" id="parameter-"></div>
306 <b>sampler</b>
307 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
308 <div style="font-size: small">
309 <span style="color: purple">string</span>
310 </div>
311 </td>
312 <td>
313 </td>
314 <td>
315 <div>Name of the sampler to apply.</div>
316 </td>
317 </tr>
318
319 <tr>
320 <td class="elbow-placeholder"></td>
321 <td class="elbow-placeholder"></td>
322 <td colspan="2">
323 <div class="ansibleOptionAnchor" id="parameter-"></div>
324 <b>ipv6</b>
325 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
326 <div style="font-size: small">
327 <span style="color: purple">dictionary</span>
328 </div>
329 </td>
330 <td>
331 </td>
332 <td>
333 <div>Configure NetFlow monitoring for IPv6 traffic.</div>
334 </td>
335 </tr>
336 <tr>
337 <td class="elbow-placeholder"></td>
338 <td class="elbow-placeholder"></td>
339 <td class="elbow-placeholder"></td>
340 <td colspan="1">
341 <div class="ansibleOptionAnchor" id="parameter-"></div>
342 <b>direction</b>
343 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
344 <div style="font-size: small">
345 <span style="color: purple">string</span>
346 </div>
347 </td>
348 <td>
349 <ul style="margin: 0; padding: 0"><b>Choices:</b>
350 <li>ingress</li>
351 <li>egress</li>
352 <li>bidirectional</li>
353 </ul>
354 </td>
355 <td>
356 <div>Direction of the flow monitoring.</div>
357 </td>
358 </tr>
359 <tr>
360 <td class="elbow-placeholder"></td>
361 <td class="elbow-placeholder"></td>
362 <td class="elbow-placeholder"></td>
363 <td colspan="1">
364 <div class="ansibleOptionAnchor" id="parameter-"></div>
365 <b>monitor</b>
366 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
367 <div style="font-size: small">
368 <span style="color: purple">string</span>
369 </div>
370 </td>
371 <td>
372 </td>
373 <td>
374 <div>Name of the flow monitor to apply.</div>
375 </td>
376 </tr>
377 <tr>
378 <td class="elbow-placeholder"></td>
379 <td class="elbow-placeholder"></td>
380 <td class="elbow-placeholder"></td>
381 <td colspan="1">
382 <div class="ansibleOptionAnchor" id="parameter-"></div>
383 <b>sampler</b>
384 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
385 <div style="font-size: small">
386 <span style="color: purple">string</span>
387 </div>
388 </td>
389 <td>
390 </td>
391 <td>
392 <div>Name of the sampler to apply.</div>
393 </td>
394 </tr>
395
396
397 <tr>
398 <td class="elbow-placeholder"></td>
399 <td colspan="3">
400 <div class="ansibleOptionAnchor" id="parameter-"></div>
401 <b>flow_control</b>
402 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
403 <div style="font-size: small">
404 <span style="color: purple">string</span>
405 </div>
406 </td>
407 <td>
408 <ul style="margin: 0; padding: 0"><b>Choices:</b>
409 <li>ingress</li>
410 <li>egress</li>
411 <li>bidirectional</li>
412 </ul>
413 </td>
414 <td>
415 <div>Configure flow control for the interface.</div>
416 </td>
417 </tr>
418 <tr>
419 <td class="elbow-placeholder"></td>
420 <td colspan="3">
421 <div class="ansibleOptionAnchor" id="parameter-"></div>
422 <b>ipv4</b>
423 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
424 <div style="font-size: small">
425 <span style="color: purple">list</span>
426 / <span style="color: purple">elements=dictionary</span>
427 </div>
428 </td>
429 <td>
430 </td>
431 <td>
432 <div>IPv4 address to be set for the Layer-3 interface mentioned in <em>name</em> option.</div>
433 <div>The address format is &lt;ipv4 address&gt;/&lt;mask&gt;, the mask is number in range 0-32 eg. 192.168.0.1/24</div>
434 </td>
435 </tr>
436 <tr>
437 <td class="elbow-placeholder"></td>
438 <td class="elbow-placeholder"></td>
439 <td colspan="2">
440 <div class="ansibleOptionAnchor" id="parameter-"></div>
441 <b>address</b>
442 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
443 <div style="font-size: small">
444 <span style="color: purple">string</span>
445 </div>
446 </td>
447 <td>
448 </td>
449 <td>
450 <div>Configures the IPv4 address for Interface.</div>
451 </td>
452 </tr>
453 <tr>
454 <td class="elbow-placeholder"></td>
455 <td class="elbow-placeholder"></td>
456 <td colspan="2">
457 <div class="ansibleOptionAnchor" id="parameter-"></div>
458 <b>secondary</b>
459 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
460 <div style="font-size: small">
461 <span style="color: purple">boolean</span>
462 </div>
463 </td>
464 <td>
465 <ul style="margin: 0; padding: 0"><b>Choices:</b>
466 <li>no</li>
467 <li>yes</li>
468 </ul>
469 </td>
470 <td>
471 <div>Configures the IP address as a secondary address.</div>
472 </td>
473 </tr>
474
475 <tr>
476 <td class="elbow-placeholder"></td>
477 <td colspan="3">
478 <div class="ansibleOptionAnchor" id="parameter-"></div>
479 <b>ipv6</b>
480 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
481 <div style="font-size: small">
482 <span style="color: purple">list</span>
483 / <span style="color: purple">elements=dictionary</span>
484 </div>
485 </td>
486 <td>
487 </td>
488 <td>
489 <div>IPv6 address to be set for the Layer-3 interface mentioned in <em>name</em> option.</div>
490 <div>The address format is &lt;ipv6 address&gt;/&lt;mask&gt;, the mask is number in range 0-128 eg. fd5d:12c9:2201:1::1/64</div>
491 </td>
492 </tr>
493 <tr>
494 <td class="elbow-placeholder"></td>
495 <td class="elbow-placeholder"></td>
496 <td colspan="2">
497 <div class="ansibleOptionAnchor" id="parameter-"></div>
498 <b>address</b>
499 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
500 <div style="font-size: small">
501 <span style="color: purple">string</span>
502 </div>
503 </td>
504 <td>
505 </td>
506 <td>
507 <div>Configures the IPv6 address for Interface.</div>
508 </td>
509 </tr>
510
511 <tr>
512 <td class="elbow-placeholder"></td>
513 <td colspan="3">
514 <div class="ansibleOptionAnchor" id="parameter-"></div>
515 <b>load_interval</b>
516 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
517 <div style="font-size: small">
518 <span style="color: purple">integer</span>
519 </div>
520 </td>
521 <td>
522 </td>
523 <td>
524 <div>Specify the length of time for which data is used to compute load statistics.</div>
525 </td>
526 </tr>
527 <tr>
528 <td class="elbow-placeholder"></td>
529 <td colspan="3">
530 <div class="ansibleOptionAnchor" id="parameter-"></div>
531 <b>name</b>
532 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
533 <div style="font-size: small">
534 <span style="color: purple">string</span>
535 / <span style="color: red">required</span>
536 </div>
537 </td>
538 <td>
539 </td>
540 <td>
541 <div>Full name of the interface excluding any logical unit number, i.e. GigabitEthernet0/1.</div>
542 </td>
543 </tr>
544
545 <tr>
546 <td colspan="4">
547 <div class="ansibleOptionAnchor" id="parameter-"></div>
548 <b>running_config</b>
549 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
550 <div style="font-size: small">
551 <span style="color: purple">string</span>
552 </div>
553 </td>
554 <td>
555 </td>
556 <td>
557 <div>This option is used only with state <em>parsed</em>.</div>
558 <div>The value of this option should be the output received from the IOS-XR device by executing the command <b>show running-config interface</b>.</div>
559 <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>
560 </td>
561 </tr>
562 <tr>
563 <td colspan="4">
564 <div class="ansibleOptionAnchor" id="parameter-"></div>
565 <b>state</b>
566 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
567 <div style="font-size: small">
568 <span style="color: purple">string</span>
569 </div>
570 </td>
571 <td>
572 <ul style="margin: 0; padding: 0"><b>Choices:</b>
573 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
574 <li>replaced</li>
575 <li>overridden</li>
576 <li>deleted</li>
577 <li>parsed</li>
578 <li>rendered</li>
579 <li>gathered</li>
580 </ul>
581 </td>
582 <td>
583 <div>The state of the configuration after module completion</div>
584 </td>
585 </tr>
586 </table>
587 <br/>
588
589
590 Notes
591 -----
592
593 .. note::
594 - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_.
595
596
597
598 Examples
599 --------
600
601 .. code-block:: yaml
602
603 # Using merged
604
605 # Before state:
606 # -------------
607 #
608 # viosxr#show running-config interface
609 # interface Loopback888
610 # !
611 # interface Loopback999
612 # !
613 # interface MgmtEth0/RP0/CPU0/0
614 # ipv4 address dhcp
615 # !
616 # interface preconfigure GigabitEthernet0/0/0/2
617 # !
618 # interface preconfigure GigabitEthernet0/0/0/3
619 # !
620
621 - name: Merge provided configuration with device configuration
622 cisco.iosxr.iosxr_l3_interfaces:
623 config:
624 - name: GigabitEthernet0/0/0/2
625 ipv4:
626 - address: 192.168.0.1/24
627 - name: GigabitEthernet0/0/0/3
628 ipv4:
629 - address: 192.168.2.1/24
630 secondary: true
631 state: merged
632
633 # Task Output
634 # -----------
635 #
636 # before:
637 # - name: Loopback888
638 # - name: Loopback999
639 # - name: GigabitEthernet0/0/0/2
640 # - name: GigabitEthernet0/0/0/3
641 # commands:
642 # - interface GigabitEthernet0/0/0/2
643 # - ipv4 address 192.168.0.1 255.255.255.0
644 # - interface GigabitEthernet0/0/0/3
645 # - ipv4 address 192.168.2.1 255.255.255.0 secondary
646 # after:
647 # - name: Loopback888
648 # - name: Loopback999
649 # - ipv4:
650 # - address: 192.168.0.1/24
651 # name: GigabitEthernet0/0/0/2
652 # - ipv4:
653 # - address: 192.168.2.1/24
654 # secondary: true
655 # name: GigabitEthernet0/0/0/3
656
657 # After state:
658 # ------------
659 #
660 # viosxr#show running-config interface
661 # interface Loopback888
662 # !
663 # interface Loopback999
664 # !
665 # interface MgmtEth0/RP0/CPU0/0
666 # ipv4 address dhcp
667 # !
668 # interface preconfigure GigabitEthernet0/0/0/2
669 # ipv4 address 192.168.0.1 255.255.255.0
670 # !
671 # interface preconfigure GigabitEthernet0/0/0/3
672 # ipv4 address 192.168.2.1 255.255.255.0 secondary
673 # !
674
675 # Using overridden
676
677 # Before state:
678 # -------------
679 #
680 # viosxr#show running-config interface
681 # interface Loopback888
682 # !
683 # interface Loopback999
684 # !
685 # interface MgmtEth0/RP0/CPU0/0
686 # ipv4 address dhcp
687 # !
688 # interface preconfigure GigabitEthernet0/0/0/2
689 # ipv4 address 192.168.0.1 255.255.255.0
690 # !
691 # interface preconfigure GigabitEthernet0/0/0/3
692 # ipv4 address 192.168.2.1 255.255.255.0 secondary
693 # !
694
695 - name: Override device configuration of all interfaces with provided configuration
696 cisco.iosxr.iosxr_l3_interfaces:
697 config:
698 - name: GigabitEthernet0/0/0/3
699 ipv4:
700 - address: 192.168.0.2/24
701 - address: 192.168.2.1/24
702 secondary: true
703 state: overridden
704
705
706 # Task Output
707 # -----------
708 #
709 # before:
710 # - name: Loopback888
711 # - name: Loopback999
712 # - ipv4:
713 # - address: 192.168.0.1/24
714 # name: GigabitEthernet0/0/0/2
715 # - ipv4:
716 # - address: 192.168.2.1/24
717 # secondary: true
718 # name: GigabitEthernet0/0/0/3
719 # commands:
720 # - interface GigabitEthernet0/0/0/2
721 # - no ipv4 address
722 # - interface GigabitEthernet0/0/0/3
723 # - ipv4 address 192.168.0.2 255.255.255.0
724 # - ipv4 address 192.168.0.1 255.255.255.0
725 # after:
726 # - name: Loopback888
727 # - name: Loopback999
728 # - name: GigabitEthernet0/0/0/2
729 # - ipv4:
730 # - address: 192.168.0.1/24
731 # - address: 192.168.2.1/24
732 # secondary: true
733 # name: GigabitEthernet0/0/0/3
734
735 # After state:
736 # -------------
737 #
738 # viosxr#show running-config interface
739 # interface Loopback888
740 # !
741 # interface Loopback999
742 # !
743 # interface MgmtEth0/RP0/CPU0/0
744 # ipv4 address dhcp
745 # !
746 # interface preconfigure GigabitEthernet0/0/0/2
747 # !
748 # interface preconfigure GigabitEthernet0/0/0/3
749 # ipv4 address 192.168.0.1 255.255.255.0
750 # ipv4 address 192.168.2.1 255.255.255.0 secondary
751 # !
752
753 # Using replaced
754
755 # Before state:
756 # -------------
757 #
758 # viosxr#show running-config interface
759 # interface Loopback888
760 # !
761 # interface Loopback999
762 # !
763 # interface MgmtEth0/RP0/CPU0/0
764 # ipv4 address dhcp
765 # !
766 # interface preconfigure GigabitEthernet0/0/0/2
767 # !
768 # interface preconfigure GigabitEthernet0/0/0/3
769 # ipv4 address 192.168.0.1 255.255.255.0
770 # ipv4 address 192.168.2.1 255.255.255.0 secondary
771 # !
772
773 - name: >-
774 Replaces device configuration of listed interfaces with provided
775 configuration
776 cisco.iosxr.iosxr_l3_interfaces:
777 config:
778 - name: GigabitEthernet0/0/0/3
779 ipv6:
780 - address: 'fd5d:12c9:2201:1::1/64'
781 - name: GigabitEthernet0/0/0/2
782 ipv4:
783 - address: 192.168.0.2/24
784 state: replaced
785
786
787 # Task Output
788 # -----------
789 #
790 # before:
791 # - name: Loopback888
792 # - name: Loopback999
793 # - name: GigabitEthernet0/0/0/2
794 # - ipv4:
795 # - address: 192.168.0.1/24
796 # - address: 192.168.2.1/24
797 # secondary: true
798 # name: GigabitEthernet0/0/0/3
799 # commands:
800 # - interface GigabitEthernet0/0/0/3
801 # - no ipv4 address
802 # - ipv6 address fd5d:12c9:2201:1::1/64
803 # - interface GigabitEthernet0/0/0/2
804 # - ipv4 address 192.168.0.2 255.255.255.0
805 # after:
806 # - name: Loopback888
807 # - name: Loopback999
808 # - ipv4:
809 # - address: 192.168.0.2/24
810 # name: GigabitEthernet0/0/0/2
811 # - ipv6:
812 # - address: fd5d:12c9:2201:1::1/64
813 # name: GigabitEthernet0/0/0/3
814
815 # After state:
816 # -------------
817 #
818 # viosxr#show running-config interface
819 # interface Loopback888
820 # !
821 # interface Loopback999
822 # !
823 # interface MgmtEth0/RP0/CPU0/0
824 # ipv4 address dhcp
825 # !
826 # interface preconfigure GigabitEthernet0/0/0/2
827 # ipv4 address 192.168.0.2 255.255.255.0
828 # !
829 # interface preconfigure GigabitEthernet0/0/0/3
830 # ipv6 address fd5d:12c9:2201:1::1/64
831 # !
832
833 # Using deleted
834
835 # Before state:
836 # -------------
837 #
838 # viosxr#show running-config interface
839 # interface Loopback888
840 # !
841 # interface Loopback999
842 # !
843 # interface MgmtEth0/RP0/CPU0/0
844 # ipv4 address dhcp
845 # !
846 # interface preconfigure GigabitEthernet0/0/0/2
847 # ipv4 address 192.168.0.2 255.255.255.0
848 # !
849 # interface preconfigure GigabitEthernet0/0/0/3
850 # ipv6 address fd5d:12c9:2201:1::1/64
851 # !
852
853 - name: Delete attributes for interfaces (This won't delete the interface itself)
854 cisco.iosxr.iosxr_l3_interfaces:
855 config:
856 - name: GigabitEthernet0/0/0/3
857 - name: GigabitEthernet0/0/0/4
858 - name: GigabitEthernet0/0/0/3.700
859 state: deleted
860
861
862 # Task Output
863 # -----------
864 #
865 # before:
866 # - name: Loopback888
867 # - name: Loopback999
868 # - ipv4:
869 # - address: 192.168.0.2/24
870 # name: GigabitEthernet0/0/0/2
871 # - ipv6:
872 # - address: fd5d:12c9:2201:1::1/64
873 # name: GigabitEthernet0/0/0/3
874 # commands:
875 # - interface GigabitEthernet0/0/0/3
876 # - no ipv6 address
877 # after:
878 # - name: Loopback888
879 # - name: Loopback999
880 # - ipv4:
881 # - address: 192.168.0.2/24
882 # name: GigabitEthernet0/0/0/2
883 # - name: GigabitEthernet0/0/0/3
884
885 # After state:
886 # -------------
887 #
888 # viosxr#show running-config interface
889 # interface Loopback888
890 # !
891 # interface Loopback999
892 # !
893 # interface MgmtEth0/RP0/CPU0/0
894 # ipv4 address dhcp
895 # !
896 # interface preconfigure GigabitEthernet0/0/0/2
897 # ipv4 address 192.168.0.2 255.255.255.0
898 # !
899 # interface preconfigure GigabitEthernet0/0/0/3
900 # !
901
902 # Using deleted - will delete all interface configuration and not interface
903
904 # Before state:
905 # -------------
906 #
907 # viosxr#show running-config interface
908 # interface Loopback888
909 # !
910 # interface Loopback999
911 # !
912 # interface MgmtEth0/RP0/CPU0/0
913 # ipv4 address dhcp
914 # !
915 # interface preconfigure GigabitEthernet0/0/0/1
916 # ipv4 address 192.168.2.1 255.255.255.0
917 # shutdown
918 # !
919 # interface preconfigure GigabitEthernet0/0/0/2
920 # ipv4 address 192.168.3.1 255.255.255.0
921 # shutdown
922 # !
923 # interface preconfigure GigabitEthernet0/0/0/3
924 # ipv4 address 192.168.0.2 255.255.255.0
925 # shutdown
926 # !
927 # interface preconfigure GigabitEthernet0/0/0/3.700
928 # ipv4 address 192.168.0.1 255.255.255.0
929 # !
930 # interface preconfigure GigabitEthernet0/0/0/4
931 # ipv6 address fd5d:12c9:2201:1::1/64
932 # shutdown
933 # !
934
935 - name: "Delete L3 config of all interfaces (This won't delete the interface itself)"
936 cisco.iosxr.iosxr_l3_interfaces:
937 state: deleted
938
939 # Task Output
940 # -----------
941 #
942 # before:
943 # - name: Loopback888
944 # - name: Loopback999
945 # - ipv4:
946 # - address: 192.168.2.1/24
947 # name: GigabitEthernet0/0/0/1
948 # - ipv4:
949 # - address: 192.168.3.1/24
950 # name: GigabitEthernet0/0/0/2
951 # - ipv4:
952 # - address: 192.168.0.2/24
953 # name: GigabitEthernet0/0/0/3
954 # - ipv4:
955 # - address: 192.168.0.1/24
956 # name: GigabitEthernet0/0/0/3.700
957 # - ipv6:
958 # - address: fd5d:12c9:2201:1::1/64
959 # name: GigabitEthernet0/0/0/4
960 # commands:
961 # - interface GigabitEthernet0/0/0/1
962 # - no ipv4 address
963 # - interface GigabitEthernet0/0/0/2
964 # - no ipv4 address
965 # - interface GigabitEthernet0/0/0/3
966 # - no ipv4 address
967 # - interface GigabitEthernet0/0/0/3.700
968 # - no ipv4 address
969 # - interface GigabitEthernet0/0/0/4
970 # - no ipv6 address
971 # after:
972 # - name: Loopback888
973 # - name: Loopback999
974 # - name: GigabitEthernet0/0/0/1
975 # - name: GigabitEthernet0/0/0/2
976 # - name: GigabitEthernet0/0/0/3
977 # - name: GigabitEthernet0/0/0/3.700
978 # - name: GigabitEthernet0/0/0/4
979
980 # After state:
981 # -------------
982 #
983 # viosxr#show running-config interface
984 # interface Loopback888
985 # !
986 # interface Loopback999
987 # !
988 # interface MgmtEth0/RP0/CPU0/0
989 # ipv4 address dhcp
990 # !
991 # interface preconfigure GigabitEthernet0/0/0/1
992 # shutdown
993 # !
994 # interface preconfigure GigabitEthernet0/0/0/2
995 # shutdown
996 # !
997 # interface preconfigure GigabitEthernet0/0/0/3
998 # shutdown
999 # !
1000 # interface preconfigure GigabitEthernet0/0/0/3.700
1001 # !
1002 # interface preconfigure GigabitEthernet0/0/0/4
1003 # shutdown
1004 # !
1005
1006
1007 # Using parsed
1008
1009 # File: parsed.cfg
1010 # ----------------
1011 #
1012 # interface Loopback888
1013 # description test for ansible
1014 # shutdown
1015 # !
1016 # interface MgmtEth0/0/CPU0/0
1017 # ipv4 address 10.8.38.70 255.255.255.0
1018 # !
1019 # interface GigabitEthernet0/0/0/0
1020 # description Configured and Merged by Ansible-Network
1021 # mtu 66
1022 # ipv4 address 192.0.2.1 255.255.255.0
1023 # ipv4 address 192.0.2.2 255.255.255.0 secondary
1024 # ipv6 address 2001:db8:0:3::/64
1025 # duplex half
1026 # !
1027 # interface GigabitEthernet0/0/0/1
1028 # description Configured and Merged by Ansible-Network
1029 # mtu 66
1030 # speed 100
1031 # duplex full
1032 # dot1q native vlan 10
1033 # l2transport
1034 # l2protocol cdp forward
1035 # l2protocol pvst tunnel
1036 # propagate remote-status
1037 # !
1038 # !
1039 # interface GigabitEthernet0/0/0/3
1040 # ipv4 address 192.0.22.1 255.255.255.0
1041 # ipv4 address 192.0.23.1 255.255.255.0
1042 # !
1043
1044 - name: Convert L3 interfaces config to argspec without connecting to the appliance
1045 cisco.iosxr.iosxr_l3_interfaces:
1046 running_config: "{{ lookup('file', './parsed.cfg') }}"
1047 state: parsed
1048
1049 # Task Output
1050 # -----------
1051 #
1052 # parsed:
1053 # - ipv4:
1054 # - address: 192.0.2.1 255.255.255.0
1055 # - address: 192.0.2.2 255.255.255.0
1056 # secondary: true
1057 # ipv6:
1058 # - address: 2001:db8:0:3::/64
1059 # name: GigabitEthernet0/0/0/0
1060 # - name: GigabitEthernet0/0/0/1
1061 # - ipv4:
1062 # - address: 192.0.22.1 255.255.255.0
1063 # - address: 192.0.23.1 255.255.255.0
1064 # name: GigabitEthernet0/0/0/3
1065
1066 # Using rendered
1067
1068 - name: Render platform specific commands from task input using rendered state
1069 cisco.iosxr.iosxr_l3_interfaces:
1070 config:
1071 - name: GigabitEthernet0/0/0/0
1072 ipv4:
1073 - address: 198.51.100.1/24
1074 - name: GigabitEthernet0/0/0/1
1075 ipv6:
1076 - address: '2001:db8:0:3::/64'
1077 ipv4:
1078 - address: 192.0.2.1/24
1079 - address: 192.0.2.2/24
1080 secondary: true
1081 state: rendered
1082
1083
1084 # Task Output
1085 # -----------
1086 #
1087 # rendered:
1088 # - interface GigabitEthernet0/0/0/0
1089 # - ipv4 address 198.51.100.1 255.255.255.0
1090 # - interface GigabitEthernet0/0/0/1
1091 # - ipv4 address 192.0.2.2 255.255.255.0 secondary
1092 # - ipv4 address 192.0.2.1 255.255.255.0
1093 # - ipv6 address 2001:db8:0:3::/64
1094
1095 # Using gathered
1096
1097 # Before state:
1098 # ------------
1099 #
1100 # RP/0/0/CPU0:an-iosxr-02#show running-config interface
1101 # interface Loopback888
1102 # description test for ansible
1103 # shutdown
1104 # !
1105 # interface MgmtEth0/0/CPU0/0
1106 # ipv4 address 10.8.38.70 255.255.255.0
1107 # !
1108 # interface GigabitEthernet0/0/0/0
1109 # description Configured and Merged by Ansible-Network
1110 # mtu 66
1111 # ipv4 address 192.0.2.1 255.255.255.0
1112 # ipv4 address 192.0.2.2 255.255.255.0 secondary
1113 # ipv6 address 2001:db8:0:3::/64
1114 # duplex half
1115 # !
1116 # interface GigabitEthernet0/0/0/1
1117 # description Configured and Merged by Ansible-Network
1118 # mtu 66
1119 # speed 100
1120 # duplex full
1121 # dot1q native vlan 10
1122 # l2transport
1123 # l2protocol cdp forward
1124 # l2protocol pvst tunnel
1125 # propagate remote-status
1126 # !
1127 # !
1128 # interface GigabitEthernet0/0/0/3
1129 # shutdown
1130 # !
1131 # interface GigabitEthernet0/0/0/4
1132 # shutdown
1133 # dot1q native vlan 40
1134 # !
1135
1136 - name: Gather l3 interfaces facts
1137 cisco.iosxr.iosxr_l3_interfaces:
1138 config:
1139 state: gathered
1140
1141 # Task Output
1142 # -----------
1143 #
1144 # gathered:
1145 # - name: Loopback888
1146 # - ipv4:
1147 # - address: 192.0.2.1 255.255.255.0
1148 # - address: 192.0.2.2 255.255.255.0
1149 # secondary: true
1150 # ipv6:
1151 # - address: 2001:db8:0:3::/64
1152 # name: GigabitEthernet0/0/0/0
1153 # - name: GigabitEthernet0/0/0/1
1154 # - name: GigabitEthernet0/0/0/3
1155 # - name: GigabitEthernet0/0/0/4
1156
1157 # Using bidirectional flow monitoring (merged)
1158
1159 # Before state:
1160 # -------------
1161 #
1162 # viosxr#show running-config interface
1163 # interface GigabitEthernet0/0/0/0
1164 # ipv4 address 198.51.100.1 255.255.255.0
1165 # !
1166
1167 - name: Configure bidirectional NetFlow on an interface (merged)
1168 cisco.iosxr.iosxr_l3_interfaces:
1169 config:
1170 - name: GigabitEthernet0/0/0/0
1171 flow:
1172 ipv4:
1173 monitor: FlowMap-IPv4
1174 sampler: NETFLOW_1
1175 direction: bidirectional
1176 ipv6:
1177 monitor: FlowMap-IPv6
1178 sampler: NETFLOW_1
1179 direction: bidirectional
1180 state: merged
1181
1182 # Task Output
1183 # -----------
1184 #
1185 # before:
1186 # - name: GigabitEthernet0/0/0/0
1187 # ipv4:
1188 # - address: 198.51.100.1/24
1189 # commands:
1190 # - interface GigabitEthernet0/0/0/0
1191 # - flow ipv4 monitor FlowMap-IPv4 sampler NETFLOW_1 ingress
1192 # - flow ipv4 monitor FlowMap-IPv4 sampler NETFLOW_1 egress
1193 # - flow ipv6 monitor FlowMap-IPv6 sampler NETFLOW_1 ingress
1194 # - flow ipv6 monitor FlowMap-IPv6 sampler NETFLOW_1 egress
1195 # after:
1196 # - name: GigabitEthernet0/0/0/0
1197 # ipv4:
1198 # - address: 198.51.100.1/24
1199 # flow:
1200 # ipv4:
1201 # monitor: FlowMap-IPv4
1202 # sampler: NETFLOW_1
1203 # direction: bidirectional
1204 # ipv6:
1205 # monitor: FlowMap-IPv6
1206 # sampler: NETFLOW_1
1207 # direction: bidirectional
1208
1209 # After state:
1210 # ------------
1211 #
1212 # viosxr#show running-config interface
1213 # interface GigabitEthernet0/0/0/0
1214 # ipv4 address 198.51.100.1 255.255.255.0
1215 # flow ipv4 monitor FlowMap-IPv4 sampler NETFLOW_1 ingress
1216 # flow ipv4 monitor FlowMap-IPv4 sampler NETFLOW_1 egress
1217 # flow ipv6 monitor FlowMap-IPv6 sampler NETFLOW_1 ingress
1218 # flow ipv6 monitor FlowMap-IPv6 sampler NETFLOW_1 egress
1219 # !
1220
1221 # Using bidirectional flow monitoring (deleted)
1222
1223 # Before state:
1224 # -------------
1225 #
1226 # viosxr#show running-config interface
1227 # interface GigabitEthernet0/0/0/0
1228 # ipv4 address 198.51.100.1 255.255.255.0
1229 # flow ipv4 monitor FlowMap-IPv4 sampler NETFLOW_1 ingress
1230 # flow ipv4 monitor FlowMap-IPv4 sampler NETFLOW_1 egress
1231 # flow ipv6 monitor FlowMap-IPv6 sampler NETFLOW_1 ingress
1232 # flow ipv6 monitor FlowMap-IPv6 sampler NETFLOW_1 egress
1233 # !
1234
1235 - name: >-
1236 Remove L3 attributes for an interface including bidirectional flow
1237 (does not remove the interface itself)
1238 cisco.iosxr.iosxr_l3_interfaces:
1239 config:
1240 - name: GigabitEthernet0/0/0/0
1241 state: deleted
1242
1243 # Task Output
1244 # -----------
1245 #
1246 # before:
1247 # - name: GigabitEthernet0/0/0/0
1248 # ipv4:
1249 # - address: 198.51.100.1/24
1250 # flow:
1251 # ipv4:
1252 # monitor: FlowMap-IPv4
1253 # sampler: NETFLOW_1
1254 # direction: bidirectional
1255 # ipv6:
1256 # monitor: FlowMap-IPv6
1257 # sampler: NETFLOW_1
1258 # direction: bidirectional
1259 # commands:
1260 # - interface GigabitEthernet0/0/0/0
1261 # - no ipv4 address
1262 # - no flow ipv4 monitor FlowMap-IPv4 sampler NETFLOW_1 ingress
1263 # - no flow ipv4 monitor FlowMap-IPv4 sampler NETFLOW_1 egress
1264 # - no flow ipv6 monitor FlowMap-IPv6 sampler NETFLOW_1 ingress
1265 # - no flow ipv6 monitor FlowMap-IPv6 sampler NETFLOW_1 egress
1266 # after:
1267 # - name: GigabitEthernet0/0/0/0
1268
1269 # After state:
1270 # ------------
1271 #
1272 # viosxr#show running-config interface
1273 # interface GigabitEthernet0/0/0/0
1274 # !
1275
1276
1277
1278 Return Values
1279 -------------
1280 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:
1281
1282 .. raw:: html
1283
1284 <table border=0 cellpadding=0 class="documentation-table">
1285 <tr>
1286 <th colspan="1">Key</th>
1287 <th>Returned</th>
1288 <th width="100%">Description</th>
1289 </tr>
1290 <tr>
1291 <td colspan="1">
1292 <div class="ansibleOptionAnchor" id="return-"></div>
1293 <b>after</b>
1294 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
1295 <div style="font-size: small">
1296 <span style="color: purple">list</span>
1297 </div>
1298 </td>
1299 <td>when changed</td>
1300 <td>
1301 <div>The configuration as structured data after module completion.</div>
1302 <br/>
1303 <div style="font-size: smaller"><b>Sample:</b></div>
1304 <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 of the parameters above.</div>
1305 </td>
1306 </tr>
1307 <tr>
1308 <td colspan="1">
1309 <div class="ansibleOptionAnchor" id="return-"></div>
1310 <b>before</b>
1311 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
1312 <div style="font-size: small">
1313 <span style="color: purple">list</span>
1314 </div>
1315 </td>
1316 <td>always</td>
1317 <td>
1318 <div>The configuration as structured data prior to module invocation.</div>
1319 <br/>
1320 <div style="font-size: smaller"><b>Sample:</b></div>
1321 <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 of the parameters above.</div>
1322 </td>
1323 </tr>
1324 <tr>
1325 <td colspan="1">
1326 <div class="ansibleOptionAnchor" id="return-"></div>
1327 <b>commands</b>
1328 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
1329 <div style="font-size: small">
1330 <span style="color: purple">list</span>
1331 </div>
1332 </td>
1333 <td>always</td>
1334 <td>
1335 <div>The set of commands pushed to the remote device</div>
1336 <br/>
1337 <div style="font-size: smaller"><b>Sample:</b></div>
1338 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;interface GigabitEthernet0/0/0/1&#x27;, &#x27;ipv4 address 192.168.0.1 255.255.255.0&#x27;]</div>
1339 </td>
1340 </tr>
1341 </table>
1342 <br/><br/>
1343
1344
1345 Status
1346 ------
1347
1348
1349 Authors
1350 ~~~~~~~
1351
1352 - Sumit Jaiswal (@justjais)
1353 - Rohit Thakur (@rohitthakur2590)