Debian Codegraph @

ansible_collections/cisco/nxos/docs/cisco.nxos.nxos_interfaces_module.rst

raw
1 .. _cisco.nxos.nxos_interfaces_module:
2
3
4 **************************
5 cisco.nxos.nxos_interfaces
6 **************************
7
8 **Interfaces resource module**
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 the interface attributes of NX-OS interfaces.
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 interface 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>description</b>
57 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
58 <div style="font-size: small">
59 <span style="color: purple">string</span>
60 </div>
61 </td>
62 <td>
63 </td>
64 <td>
65 <div>Interface description.</div>
66 </td>
67 </tr>
68 <tr>
69 <td class="elbow-placeholder"></td>
70 <td colspan="4">
71 <div class="ansibleOptionAnchor" id="parameter-"></div>
72 <b>duplex</b>
73 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
74 <div style="font-size: small">
75 <span style="color: purple">string</span>
76 </div>
77 </td>
78 <td>
79 <ul style="margin: 0; padding: 0"><b>Choices:</b>
80 <li>full</li>
81 <li>half</li>
82 <li>auto</li>
83 </ul>
84 </td>
85 <td>
86 <div>Interface link status. Applicable for Ethernet interfaces only.</div>
87 </td>
88 </tr>
89 <tr>
90 <td class="elbow-placeholder"></td>
91 <td colspan="4">
92 <div class="ansibleOptionAnchor" id="parameter-"></div>
93 <b>enabled</b>
94 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
95 <div style="font-size: small">
96 <span style="color: purple">boolean</span>
97 </div>
98 </td>
99 <td>
100 <ul style="margin: 0; padding: 0"><b>Choices:</b>
101 <li>no</li>
102 <li>yes</li>
103 </ul>
104 </td>
105 <td>
106 <div>Administrative state of the interface. Set the value to <code>true</code> to administratively enable the interface or <code>false</code> to disable it</div>
107 </td>
108 </tr>
109 <tr>
110 <td class="elbow-placeholder"></td>
111 <td colspan="4">
112 <div class="ansibleOptionAnchor" id="parameter-"></div>
113 <b>fabric_forwarding_anycast_gateway</b>
114 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
115 <div style="font-size: small">
116 <span style="color: purple">boolean</span>
117 </div>
118 </td>
119 <td>
120 <ul style="margin: 0; padding: 0"><b>Choices:</b>
121 <li>no</li>
122 <li>yes</li>
123 </ul>
124 </td>
125 <td>
126 <div>Associate SVI with anycast gateway under VLAN configuration mode. Applicable for SVI interfaces only.</div>
127 </td>
128 </tr>
129 <tr>
130 <td class="elbow-placeholder"></td>
131 <td colspan="4">
132 <div class="ansibleOptionAnchor" id="parameter-"></div>
133 <b>ip_forward</b>
134 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
135 <div style="font-size: small">
136 <span style="color: purple">boolean</span>
137 </div>
138 </td>
139 <td>
140 <ul style="margin: 0; padding: 0"><b>Choices:</b>
141 <li>no</li>
142 <li>yes</li>
143 </ul>
144 </td>
145 <td>
146 <div>Enable or disable IP forward feature on SVIs. Set the value to <code>true</code> to enable or <code>false</code> to disable.</div>
147 </td>
148 </tr>
149 <tr>
150 <td class="elbow-placeholder"></td>
151 <td colspan="4">
152 <div class="ansibleOptionAnchor" id="parameter-"></div>
153 <b>logging</b>
154 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
155 <div style="font-size: small">
156 <span style="color: purple">dictionary</span>
157 </div>
158 </td>
159 <td>
160 </td>
161 <td>
162 <div>Logging interface events</div>
163 </td>
164 </tr>
165 <tr>
166 <td class="elbow-placeholder"></td>
167 <td class="elbow-placeholder"></td>
168 <td colspan="3">
169 <div class="ansibleOptionAnchor" id="parameter-"></div>
170 <b>link_status</b>
171 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
172 <div style="font-size: small">
173 <span style="color: purple">boolean</span>
174 </div>
175 </td>
176 <td>
177 <ul style="margin: 0; padding: 0"><b>Choices:</b>
178 <li>no</li>
179 <li>yes</li>
180 </ul>
181 </td>
182 <td>
183 <div>UPDOWN and CHANGE messages</div>
184 </td>
185 </tr>
186 <tr>
187 <td class="elbow-placeholder"></td>
188 <td class="elbow-placeholder"></td>
189 <td colspan="3">
190 <div class="ansibleOptionAnchor" id="parameter-"></div>
191 <b>trunk_status</b>
192 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
193 <div style="font-size: small">
194 <span style="color: purple">boolean</span>
195 </div>
196 </td>
197 <td>
198 <ul style="margin: 0; padding: 0"><b>Choices:</b>
199 <li>no</li>
200 <li>yes</li>
201 </ul>
202 </td>
203 <td>
204 <div>TRUNK status messages</div>
205 </td>
206 </tr>
207
208 <tr>
209 <td class="elbow-placeholder"></td>
210 <td colspan="4">
211 <div class="ansibleOptionAnchor" id="parameter-"></div>
212 <b>mac_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>E.E.E MAC address.</div>
222 </td>
223 </tr>
224 <tr>
225 <td class="elbow-placeholder"></td>
226 <td colspan="4">
227 <div class="ansibleOptionAnchor" id="parameter-"></div>
228 <b>mode</b>
229 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
230 <div style="font-size: small">
231 <span style="color: purple">string</span>
232 </div>
233 </td>
234 <td>
235 <ul style="margin: 0; padding: 0"><b>Choices:</b>
236 <li>layer2</li>
237 <li>layer3</li>
238 </ul>
239 </td>
240 <td>
241 <div>Manage Layer2 or Layer3 state of the interface. Applicable for Ethernet and port channel interfaces only.</div>
242 </td>
243 </tr>
244 <tr>
245 <td class="elbow-placeholder"></td>
246 <td colspan="4">
247 <div class="ansibleOptionAnchor" id="parameter-"></div>
248 <b>mtu</b>
249 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
250 <div style="font-size: small">
251 <span style="color: purple">string</span>
252 </div>
253 </td>
254 <td>
255 </td>
256 <td>
257 <div>MTU for a specific interface. Must be an even number between 576 and 9216. Applicable for Ethernet interfaces only.</div>
258 </td>
259 </tr>
260 <tr>
261 <td class="elbow-placeholder"></td>
262 <td colspan="4">
263 <div class="ansibleOptionAnchor" id="parameter-"></div>
264 <b>name</b>
265 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
266 <div style="font-size: small">
267 <span style="color: purple">string</span>
268 / <span style="color: red">required</span>
269 </div>
270 </td>
271 <td>
272 </td>
273 <td>
274 <div>Full name of interface, e.g. Ethernet1/1, port-channel10.</div>
275 </td>
276 </tr>
277 <tr>
278 <td class="elbow-placeholder"></td>
279 <td colspan="4">
280 <div class="ansibleOptionAnchor" id="parameter-"></div>
281 <b>service_policy</b>
282 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
283 <div style="font-size: small">
284 <span style="color: purple">dictionary</span>
285 </div>
286 </td>
287 <td>
288 </td>
289 <td>
290 <div>Service policy configuration</div>
291 </td>
292 </tr>
293 <tr>
294 <td class="elbow-placeholder"></td>
295 <td class="elbow-placeholder"></td>
296 <td colspan="3">
297 <div class="ansibleOptionAnchor" id="parameter-"></div>
298 <b>input</b>
299 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
300 <div style="font-size: small">
301 <span style="color: purple">string</span>
302 </div>
303 </td>
304 <td>
305 </td>
306 <td>
307 <div>Assign policy-map to the input of an interface</div>
308 </td>
309 </tr>
310 <tr>
311 <td class="elbow-placeholder"></td>
312 <td class="elbow-placeholder"></td>
313 <td colspan="3">
314 <div class="ansibleOptionAnchor" id="parameter-"></div>
315 <b>output</b>
316 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
317 <div style="font-size: small">
318 <span style="color: purple">string</span>
319 </div>
320 </td>
321 <td>
322 </td>
323 <td>
324 <div>Assign policy-map to the output of an interface</div>
325 </td>
326 </tr>
327 <tr>
328 <td class="elbow-placeholder"></td>
329 <td class="elbow-placeholder"></td>
330 <td colspan="3">
331 <div class="ansibleOptionAnchor" id="parameter-"></div>
332 <b>type_options</b>
333 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
334 <div style="font-size: small">
335 <span style="color: purple">dictionary</span>
336 </div>
337 </td>
338 <td>
339 </td>
340 <td>
341 <div>Specify the type of this policy</div>
342 </td>
343 </tr>
344 <tr>
345 <td class="elbow-placeholder"></td>
346 <td class="elbow-placeholder"></td>
347 <td class="elbow-placeholder"></td>
348 <td colspan="2">
349 <div class="ansibleOptionAnchor" id="parameter-"></div>
350 <b>qos</b>
351 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
352 <div style="font-size: small">
353 <span style="color: purple">dictionary</span>
354 </div>
355 </td>
356 <td>
357 </td>
358 <td>
359 <div>Configure qos Service Policy</div>
360 </td>
361 </tr>
362 <tr>
363 <td class="elbow-placeholder"></td>
364 <td class="elbow-placeholder"></td>
365 <td class="elbow-placeholder"></td>
366 <td class="elbow-placeholder"></td>
367 <td colspan="1">
368 <div class="ansibleOptionAnchor" id="parameter-"></div>
369 <b>input</b>
370 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
371 <div style="font-size: small">
372 <span style="color: purple">string</span>
373 </div>
374 </td>
375 <td>
376 </td>
377 <td>
378 <div>Assign policy-map to the input of an interface</div>
379 </td>
380 </tr>
381 <tr>
382 <td class="elbow-placeholder"></td>
383 <td class="elbow-placeholder"></td>
384 <td class="elbow-placeholder"></td>
385 <td class="elbow-placeholder"></td>
386 <td colspan="1">
387 <div class="ansibleOptionAnchor" id="parameter-"></div>
388 <b>output</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>Assign policy-map to the output of an interface</div>
398 </td>
399 </tr>
400
401 <tr>
402 <td class="elbow-placeholder"></td>
403 <td class="elbow-placeholder"></td>
404 <td class="elbow-placeholder"></td>
405 <td colspan="2">
406 <div class="ansibleOptionAnchor" id="parameter-"></div>
407 <b>queuing</b>
408 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
409 <div style="font-size: small">
410 <span style="color: purple">dictionary</span>
411 </div>
412 </td>
413 <td>
414 </td>
415 <td>
416 <div>Configure queuing Service Policy</div>
417 </td>
418 </tr>
419 <tr>
420 <td class="elbow-placeholder"></td>
421 <td class="elbow-placeholder"></td>
422 <td class="elbow-placeholder"></td>
423 <td class="elbow-placeholder"></td>
424 <td colspan="1">
425 <div class="ansibleOptionAnchor" id="parameter-"></div>
426 <b>input</b>
427 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
428 <div style="font-size: small">
429 <span style="color: purple">string</span>
430 </div>
431 </td>
432 <td>
433 </td>
434 <td>
435 <div>Assign policy-map to the input of an interface</div>
436 </td>
437 </tr>
438 <tr>
439 <td class="elbow-placeholder"></td>
440 <td class="elbow-placeholder"></td>
441 <td class="elbow-placeholder"></td>
442 <td class="elbow-placeholder"></td>
443 <td colspan="1">
444 <div class="ansibleOptionAnchor" id="parameter-"></div>
445 <b>output</b>
446 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
447 <div style="font-size: small">
448 <span style="color: purple">string</span>
449 </div>
450 </td>
451 <td>
452 </td>
453 <td>
454 <div>Assign policy-map to the output of an interface</div>
455 </td>
456 </tr>
457
458
459
460 <tr>
461 <td class="elbow-placeholder"></td>
462 <td colspan="4">
463 <div class="ansibleOptionAnchor" id="parameter-"></div>
464 <b>snmp</b>
465 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
466 <div style="font-size: small">
467 <span style="color: purple">dictionary</span>
468 </div>
469 </td>
470 <td>
471 </td>
472 <td>
473 <div>Modify SNMP interface parameters</div>
474 </td>
475 </tr>
476 <tr>
477 <td class="elbow-placeholder"></td>
478 <td class="elbow-placeholder"></td>
479 <td colspan="3">
480 <div class="ansibleOptionAnchor" id="parameter-"></div>
481 <b>trap</b>
482 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
483 <div style="font-size: small">
484 <span style="color: purple">dictionary</span>
485 </div>
486 </td>
487 <td>
488 </td>
489 <td>
490 <div>Allow a specific SNMP trap</div>
491 </td>
492 </tr>
493 <tr>
494 <td class="elbow-placeholder"></td>
495 <td class="elbow-placeholder"></td>
496 <td class="elbow-placeholder"></td>
497 <td colspan="2">
498 <div class="ansibleOptionAnchor" id="parameter-"></div>
499 <b>link_status</b>
500 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
501 <div style="font-size: small">
502 <span style="color: purple">boolean</span>
503 </div>
504 </td>
505 <td>
506 <ul style="margin: 0; padding: 0"><b>Choices:</b>
507 <li>no</li>
508 <li>yes</li>
509 </ul>
510 </td>
511 <td>
512 <div>Allow SNMP LINKUP and LINKDOWN traps (snmp trap link-status permit duplicates)</div>
513 </td>
514 </tr>
515
516
517 <tr>
518 <td class="elbow-placeholder"></td>
519 <td colspan="4">
520 <div class="ansibleOptionAnchor" id="parameter-"></div>
521 <b>speed</b>
522 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
523 <div style="font-size: small">
524 <span style="color: purple">string</span>
525 </div>
526 </td>
527 <td>
528 </td>
529 <td>
530 <div>Interface link speed. Applicable for Ethernet interfaces only.</div>
531 </td>
532 </tr>
533
534 <tr>
535 <td colspan="5">
536 <div class="ansibleOptionAnchor" id="parameter-"></div>
537 <b>running_config</b>
538 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
539 <div style="font-size: small">
540 <span style="color: purple">string</span>
541 </div>
542 </td>
543 <td>
544 </td>
545 <td>
546 <div>This option is used only with state <em>parsed</em>.</div>
547 <div>The value of this option should be the output received from the NX-OS device by executing the command <b>show running-config | section ^interface</b></div>
548 <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>
549 </td>
550 </tr>
551 <tr>
552 <td colspan="5">
553 <div class="ansibleOptionAnchor" id="parameter-"></div>
554 <b>state</b>
555 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
556 <div style="font-size: small">
557 <span style="color: purple">string</span>
558 </div>
559 </td>
560 <td>
561 <ul style="margin: 0; padding: 0"><b>Choices:</b>
562 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
563 <li>replaced</li>
564 <li>overridden</li>
565 <li>deleted</li>
566 <li>gathered</li>
567 <li>rendered</li>
568 <li>parsed</li>
569 <li>purged</li>
570 </ul>
571 </td>
572 <td>
573 <div>The state of the configuration after module completion</div>
574 <div>The state <em>rendered</em> considers the system default mode for interfaces to be &quot;Layer 3&quot; and the system default state for interfaces to be shutdown.</div>
575 <div>The state <em>purged</em> negates virtual interfaces that are specified in task from running-config.</div>
576 </td>
577 </tr>
578 </table>
579 <br/>
580
581
582 Notes
583 -----
584
585 .. note::
586 - Tested against NXOS 10.4(2) on CML
587 - Unsupported for Cisco MDS
588 - This module assumes the device is configured with the default switchport behavior, specifically that ``system default switchport shutdown`` is not enabled. If ``system default switchport shutdown`` is enabled on the device, the module will not function correctly. The only resolution is to revert the device to the default setting using ``no system default switchport shutdown``. There is currently no workaround for devices with this non-default configuration.
589
590
591
592 Examples
593 --------
594
595 .. code-block:: yaml
596
597 # Using merged
598
599 # Before state:
600 # -------------
601 #
602 # switch# show running-config | section interface
603 # interface Ethernet1/1
604 # description testing
605 # interface mgmt0
606 # description mgmt interface
607 # ip address dhcp
608 # vrf member management
609
610 - name: Merge provided configuration with device configuration
611 cisco.nxos.nxos_interfaces:
612 config:
613 - name: Ethernet1/1
614 description: Configured by Ansible
615 enabled: true
616 - name: Ethernet1/2
617 description: Configured by Ansible Network
618 enabled: false
619 state: merged
620
621 # Task Output
622 # -----------
623 #
624 # before:
625 # - description: testing
626 # name: Ethernet1/1
627 # - description: mgmt interface
628 # name: mgmt0
629 # commands:
630 # - interface Ethernet1/1
631 # - description Configured by Ansible
632 # - interface Ethernet1/2
633 # - description Configured by Ansible Network
634 # - shutdown
635 # after:
636 # - description: Configured by Ansible
637 # name: Ethernet1/1
638 # - description: Configured by Ansible Network
639 # enabled: false
640 # name: Ethernet1/2
641 # - description: mgmt interface
642 # name: mgmt0
643
644 # After state:
645 # ------------
646 #
647 # switch# show running-config | section interface
648 # interface Ethernet1/1
649 # description Configured by Ansible
650 # interface Ethernet1/2
651 # description Configured by Ansible Network
652 # shutdown
653 # interface mgmt0
654 # description mgmt interface
655 # ip address dhcp
656 # vrf member management
657
658 # Using replaced
659
660 # Before state:
661 # -------------
662 #
663 # switch# show running-config | section interface
664 # interface Ethernet1/1
665 # description Updated by Ansible
666 # interface Ethernet1/2
667 # description Configured by Ansible Network
668 # shutdown
669 # interface mgmt0
670 # description mgmt interface
671 # ip address dhcp
672 # vrf member management
673
674 - name: Replaces device configuration of listed interfaces with provided configuration
675 cisco.nxos.nxos_interfaces:
676 config:
677 - name: Ethernet1/1
678 description: Configured by Ansible
679 enabled: true
680 mtu: 9000
681 - name: Ethernet1/2
682 description: Configured by Ansible Network
683 enabled: false
684 mode: layer2
685 state: replaced
686
687 # Task Output
688 # -----------
689 #
690 # before:
691 # - description: Updated by Ansible
692 # name: Ethernet1/1
693 # - description: Configured by Ansible Network
694 # enabled: false
695 # name: Ethernet1/2
696 # - description: mgmt interface
697 # name: mgmt0
698 # commands:
699 # - interface Ethernet1/1
700 # - mtu 1500
701 # - interface Ethernet1/2
702 # - description Updated by Ansible
703 # after:
704 # - description: Updated by Ansible
705 # name: Ethernet1/1
706 # - description: Updated by Ansible
707 # enabled: false
708 # name: Ethernet1/2
709 # - description: mgmt interface
710 # name: mgmt0
711
712 # After state:
713 # ------------
714 #
715 # switch# show running-config | section interface
716 # interface Ethernet1/1
717 # description Updated by Ansible
718 # interface Ethernet1/2
719 # description Updated by Ansible
720 # shutdown
721 # interface mgmt0
722 # description mgmt interface
723 # ip address dhcp
724 # vrf member management
725
726 # Using overridden
727
728 # Before state:
729 # -------------
730 #
731 # switch# show running-config | section interface
732 # interface Ethernet1/1
733 # description Updated by Ansible
734 # interface Ethernet1/2
735 # description Updated by Ansible
736 # shutdown
737 # interface mgmt0
738 # description mgmt interface
739 # ip address dhcp
740 # vrf member management
741
742 - name: Override device configuration of all interfaces with provided configuration
743 cisco.nxos.nxos_interfaces:
744 config:
745 - name: Ethernet1/1
746 enabled: true
747 - name: Ethernet1/2
748 description: Configured by Ansible Network
749 enabled: false
750 - description: mgmt interface
751 name: mgmt0
752 state: overridden
753
754 # Task Output
755 # -----------
756 #
757 # before:
758 # - description: Updated by Ansible
759 # name: Ethernet1/1
760 # - description: Updated by Ansible
761 # enabled: false
762 # name: Ethernet1/2
763 # - description: mgmt interface
764 # name: mgmt0
765 # commands:
766 # - interface Ethernet1/1
767 # - no description
768 # - interface Ethernet1/2
769 # - description Configured by Ansible Network
770 # after:
771 # - name: Ethernet1/1
772 # - description: Configured by Ansible Network
773 # enabled: false
774 # name: Ethernet1/2
775 # - description: mgmt interface
776 # name: mgmt0
777
778 # After state:
779 # ------------
780 #
781 # switch# show running-config | section interface
782 # interface Ethernet1/1
783 # interface Ethernet1/2
784 # description Configured by Ansible Network
785 # shutdown
786 # interface mgmt0
787 # description mgmt interface
788 # ip address dhcp
789 # vrf member management
790
791 # Using deleted
792
793 # Before state:
794 # -------------
795 #
796 # switch# show running-config | section interface
797 # interface Ethernet1/1
798 # interface Ethernet1/2
799 # description Configured by Ansible Network
800 # shutdown
801 # interface mgmt0
802 # description mgmt interface
803 # ip address dhcp
804 # vrf member management
805
806 - name: Delete or return interface parameters to default settings
807 cisco.nxos.nxos_interfaces:
808 config:
809 - name: Ethernet1/2
810 state: deleted
811
812 # Task Output
813 # -----------
814 #
815 # before:
816 # - name: Ethernet1/1
817 # - description: Configured by Ansible Network
818 # enabled: false
819 # name: Ethernet1/2
820 # - description: mgmt interface
821 # name: mgmt0
822 # commands:
823 # - interface Ethernet1/2
824 # - no description
825 # - no shutdown
826 # after:
827 # - name: Ethernet1/1
828 # - name: Ethernet1/2
829 # - description: mgmt interface
830 # name: mgmt0
831
832 # After state:
833 # ------------
834 #
835 # switch# show running-config | section interface
836 # interface Ethernet1/1
837 # interface Ethernet1/2
838 # interface mgmt0
839 # description mgmt interface
840 # ip address dhcp
841 # vrf member management
842
843 # Using rendered
844
845 - name: Use rendered state to convert task input to device specific commands
846 cisco.nxos.nxos_interfaces:
847 config:
848 - name: Ethernet1/1
849 description: outbound-intf
850 mode: layer3
851 speed: 100
852 - name: Ethernet1/2
853 mode: layer2
854 enabled: true
855 duplex: full
856 state: rendered
857
858 # Task Output
859 # -----------
860 #
861 # rendered:
862 # - "interface Ethernet1/1"
863 # - "description outbound-intf"
864 # - "speed 100"
865 # - "interface Ethernet1/2"
866 # - "switchport"
867 # - "duplex full"
868 # - "no shutdown"
869
870 # Using parsed
871
872 # parsed.cfg
873 # ------------
874 #
875 # interface Ethernet1/800
876 # description test-1
877 # speed 1000
878 # shutdown
879 # no switchport
880 # duplex half
881 # interface Ethernet1/801
882 # description test-2
883 # switchport
884 # no shutdown
885 # mtu 1800
886
887 - name: Use parsed state to convert externally supplied config to structured format
888 cisco.nxos.nxos_interfaces:
889 running_config: "{{ lookup('file', 'parsed.cfg') }}"
890 state: parsed
891
892 # Task output
893 # -----------
894 #
895 # parsed:
896 # - description: "test-1"
897 # duplex: "half"
898 # enabled: false
899 # mode: "layer3"
900 # name: "Ethernet1/800"
901 # speed: "1000"
902 # - description: "test-2"
903 # enabled: true
904 # mode: "layer2"
905 # mtu: "1800"
906 # name: "Ethernet1/801"
907
908 # Using gathered
909
910 # Before state:
911 # -------------
912 #
913 # switch# show running-config | section interface
914 # interface Ethernet1/1
915 # description outbound-intf
916 # switchport
917 # no shutdown
918 # interface Ethernet1/2
919 # description intf-l3
920 # speed 1000
921 # interface Ethernet1/3
922 # interface Ethernet1/4
923 # interface Ethernet1/5
924
925 - name: Gather interfaces facts from the device using nxos_interfaces
926 cisco.nxos.nxos_interfaces:
927 state: gathered
928
929 # Task output
930 # -----------
931 #
932 # - name: Ethernet1/1
933 # description: outbound-intf
934 # mode: layer2
935 # enabled: True
936 # - name: Ethernet1/2
937 # description: intf-l3
938 # speed: "1000"
939
940 # Using purged
941
942 # Before state:
943 # -------------
944 #
945 # switch# show running-config | section interface
946 # interface Vlan1
947 # interface Vlan42
948 # mtu 1800
949 # interface port-channel10
950 # interface port-channel11
951 # interface Ethernet1/1
952 # interface Ethernet1/2
953 # interface Ethernet1/2.100
954 # description sub-intf
955
956 - name: Purge virtual interfaces from running-config
957 cisco.nxos.nxos_interfaces:
958 config:
959 - name: Vlan42
960 - name: port-channel10
961 - name: Ethernet1/2.100
962 state: purged
963
964 # Task output
965 # ------------
966 #
967 # before:
968 # - name: Vlan1
969 # - mtu: '1800'
970 # name: Vlan42
971 # - name: port-channel10
972 # - name: port-channel11
973 # - name: Ethernet1/1
974 # - name: Ethernet1/2
975 # - description: sub-intf
976 # name: Ethernet1/2.100
977 # commands:
978 # - no interface port-channel10
979 # - no interface Ethernet1/2.100
980 # - no interface Vlan42
981 # after:
982 # - name: Vlan1
983 # - name: port-channel11
984 # - name: Ethernet1/1
985 # - name: Ethernet1/2
986
987 # After state:
988 # -------------
989 #
990 # switch# show running-config | section interface
991 # interface Vlan1
992 # interface port-channel11
993 # interface Ethernet1/1
994 # interface Ethernet1/2
995
996
997
998 Return Values
999 -------------
1000 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:
1001
1002 .. raw:: html
1003
1004 <table border=0 cellpadding=0 class="documentation-table">
1005 <tr>
1006 <th colspan="1">Key</th>
1007 <th>Returned</th>
1008 <th width="100%">Description</th>
1009 </tr>
1010 <tr>
1011 <td colspan="1">
1012 <div class="ansibleOptionAnchor" id="return-"></div>
1013 <b>after</b>
1014 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
1015 <div style="font-size: small">
1016 <span style="color: purple">list</span>
1017 </div>
1018 </td>
1019 <td>when changed</td>
1020 <td>
1021 <div>The configuration as structured data after module completion.</div>
1022 <br/>
1023 <div style="font-size: smaller"><b>Sample:</b></div>
1024 <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>
1025 </td>
1026 </tr>
1027 <tr>
1028 <td colspan="1">
1029 <div class="ansibleOptionAnchor" id="return-"></div>
1030 <b>before</b>
1031 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
1032 <div style="font-size: small">
1033 <span style="color: purple">list</span>
1034 </div>
1035 </td>
1036 <td>always</td>
1037 <td>
1038 <div>The configuration as structured data prior to module invocation.</div>
1039 <br/>
1040 <div style="font-size: smaller"><b>Sample:</b></div>
1041 <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>
1042 </td>
1043 </tr>
1044 <tr>
1045 <td colspan="1">
1046 <div class="ansibleOptionAnchor" id="return-"></div>
1047 <b>commands</b>
1048 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
1049 <div style="font-size: small">
1050 <span style="color: purple">list</span>
1051 </div>
1052 </td>
1053 <td>always</td>
1054 <td>
1055 <div>The set of commands pushed to the remote device.</div>
1056 <br/>
1057 <div style="font-size: smaller"><b>Sample:</b></div>
1058 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;interface Ethernet1/1&#x27;, &#x27;mtu 1800&#x27;]</div>
1059 </td>
1060 </tr>
1061 </table>
1062 <br/><br/>
1063
1064
1065 Status
1066 ------
1067
1068
1069 Authors
1070 ~~~~~~~
1071
1072 - Trishna Guha (@trishnaguha)
1073 - Vinay Mulugund (@roverflow)