Debian Codegraph @

ansible_collections/cisco/nxos/docs/cisco.nxos.nxos_vrf_interfaces_module.rst

raw
1 .. _cisco.nxos.nxos_vrf_interfaces_module:
2
3
4 ******************************
5 cisco.nxos.nxos_vrf_interfaces
6 ******************************
7
8 **Resource module to configure VRF interfaces.**
9
10
11 Version added: 9.3.0
12
13 .. contents::
14 :local:
15 :depth: 1
16
17
18 Synopsis
19 --------
20 - This module configures and manages the VRF configuration on interfaces on NX-OS platforms.
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="2">Parameter</th>
33 <th>Choices/<font color="blue">Defaults</font></th>
34 <th width="100%">Comments</th>
35 </tr>
36 <tr>
37 <td colspan="2">
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 list of interface VRF configurations.</div>
50 </td>
51 </tr>
52 <tr>
53 <td class="elbow-placeholder"></td>
54 <td colspan="1">
55 <div class="ansibleOptionAnchor" id="parameter-"></div>
56 <b>name</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 / <span style="color: red">required</span>
61 </div>
62 </td>
63 <td>
64 </td>
65 <td>
66 <div>Full name of the interface excluding any logical unit number, i.e. Ethernet1/1.</div>
67 </td>
68 </tr>
69 <tr>
70 <td class="elbow-placeholder"></td>
71 <td colspan="1">
72 <div class="ansibleOptionAnchor" id="parameter-"></div>
73 <b>vrf_name</b>
74 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
75 <div style="font-size: small">
76 <span style="color: purple">string</span>
77 </div>
78 </td>
79 <td>
80 </td>
81 <td>
82 <div>Name of the VRF to be configured on the interface.</div>
83 <div>When configured, applies &#x27;vrf member &lt;vrf_name&gt;&#x27; under the interface.</div>
84 </td>
85 </tr>
86
87 <tr>
88 <td colspan="2">
89 <div class="ansibleOptionAnchor" id="parameter-"></div>
90 <b>running_config</b>
91 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
92 <div style="font-size: small">
93 <span style="color: purple">string</span>
94 </div>
95 </td>
96 <td>
97 </td>
98 <td>
99 <div>This option is used only with state <em>parsed</em>.</div>
100 <div>The value of this option should be the output received from the NX-OS device by executing the command <b>show running-config interface</b>.</div>
101 <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>
102 </td>
103 </tr>
104 <tr>
105 <td colspan="2">
106 <div class="ansibleOptionAnchor" id="parameter-"></div>
107 <b>state</b>
108 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
109 <div style="font-size: small">
110 <span style="color: purple">string</span>
111 </div>
112 </td>
113 <td>
114 <ul style="margin: 0; padding: 0"><b>Choices:</b>
115 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
116 <li>replaced</li>
117 <li>overridden</li>
118 <li>deleted</li>
119 <li>gathered</li>
120 <li>rendered</li>
121 <li>parsed</li>
122 </ul>
123 </td>
124 <td>
125 <div>The state the configuration should be left in</div>
126 </td>
127 </tr>
128 </table>
129 <br/>
130
131
132 Notes
133 -----
134
135 .. note::
136 - Tested against Cisco NX-OS.
137 - This module works with connection ``network_cli``.
138
139
140
141 Examples
142 --------
143
144 .. code-block:: yaml
145
146 # Using merged
147
148 # Before state:
149 # -------------
150 #
151 # nxos#show running-config interface
152 # interface Ethernet1/1
153 # no switchport
154 # interface Ethernet1/2
155 # description test
156 # no switchport
157 # no shutdown
158 # interface Ethernet1/3
159 # interface Ethernet1/4
160 # no switchport
161 # speed 1000
162 # no shutdown
163
164 - name: Merge provided configuration with device configuration
165 cisco.nxos.nxos_vrf_interfaces:
166 config:
167 - name: Ethernet1/1
168 - name: Ethernet1/2
169 vrf_name: test
170 - name: Ethernet1/3
171 - name:Ethernet1/4
172 state: merged
173
174 # Task Output:
175 # ------------
176 #
177 # before:
178 # - name: "Ethernet1/1"
179 # - name: "Ethernet1/2"
180 # - name: "Ethernet1/3"
181 # - name: "Ethernet1/4"
182 #
183 # commands:
184 # - interface Ethernet1/2
185 # - vrf member test
186 #
187 # after:
188 # - name: "Ethernet1/1"
189 # - name: "Ethernet1/2"
190 # vrf_name: "test2"
191 # - name: "Ethernet1/3"
192 # - name: "Ethernet1/4"
193
194 # After state:
195 # ------------
196 #
197 # nxos#show running-config interface
198 # interface Ethernet1/1
199 # no ip address
200 # interface Ethernet1/2
201 # vrf member test
202 # no ip address
203 # shutdown
204 # negotiation auto
205 # interface Ethernet1/3
206 # no ip address
207 # negotiation auto
208 # interfaceEthernet1/4
209 # no ip address
210 # shutdown
211 # negotiation auto
212
213 # Using overridden
214
215 # Before state:
216 # -------------
217 #
218 # nxos#show running-config interface
219 # interface Ethernet1/1
220 # no ip address
221 # interface Ethernet1/1
222 # ip address dhcp
223 # negotiation auto
224 # interface Ethernet1/2
225 # vrf member vrf_B
226 # no ip address
227 # shutdown
228 # negotiation auto
229 # interface Ethernet1/3
230 # no ip address
231 # negotiation auto
232 # interface Ethernet1/4
233 # no ip address
234 # shutdown
235 # negotiation auto
236
237 - name: Override device configuration with provided configuration
238 cisco.nxos.nxos_vrf_interfaces:
239 config:
240 - name: Ethernet1/1
241 - name: Ethernet1/2
242 - name: Ethernet1/3
243 - name: Ethernet1/4
244 state: overridden
245
246 # Task Output:
247 # ------------
248 #
249 # before:
250 # - name: "Ethernet1/1"
251 # - name: "Ethernet1/2"
252 # vrf_name: "vrf_B"
253 # - name: "Ethernet1/3"
254 # - name: "Ethernet1/4"
255 #
256 # commands:
257 # - interface Ethernet1/2
258 # - no vrf member vrf_B
259 #
260 # after:
261 # - name: "Ethernet1/1"
262 # - name: "Ethernet1/2"
263 # - name: "Ethernet1/3"
264 # - name: "Ethernet1/4"
265
266 # After state:
267 # ------------
268 #
269 # nxos#show running-config interface
270 # interface Ethernet1/1
271 # no ip address
272 # interface Ethernet1/2
273 # no ip address
274 # shutdown
275 # negotiation auto
276 # interface Ethernet1/3
277 # no ip address
278 # negotiation auto
279 # interface Ethernet1/4
280 # no ip address
281 # shutdown
282 # negotiation auto
283
284 # Using gathered
285
286 # Before state:
287 # -------------
288 #
289 # nxos#show running-config interface
290 # interface Ethernet1/1
291 # no ip address
292 # interface Ethernet1/2
293 # vrf member vrf_B
294 # no ip address
295 # shutdown
296 # negotiation auto
297 # interface Ethernet1/3
298 # no ip address
299 # negotiation auto
300 # interfaceEthernet1/4
301 # no ip address
302 # shutdown
303 # negotiation auto
304
305 - name: Gather listed VRF interfaces
306 cisco.nxos.nxos_vrf_interfaces:
307 state: gathered
308
309 # Task Output:
310 # ------------
311 #
312 # gathered:
313 # - name: "Ethernet1/1"
314 # - name: "Ethernet1/2"
315 # vrf_name: "vrf_B"
316 # - name: "Ethernet1/3"
317
318 # Using rendered
319
320 - name: Render VRF configuration
321 cisco.nxos.nxos_vrf_interfaces:
322 config:
323 - name: Ethernet1/1
324 - name: Ethernet1/2
325 vrf_name: test
326 - name: Ethernet1/3
327 - name: Ethernet1/4
328 state: rendered
329
330 # Task Output:
331 # ------------
332 #
333 # rendered:
334 # - interface Ethernet1/2
335 # - vrf member test
336
337 # Using parsed
338
339 # File: parsed.cfg
340 # ---------------
341 #
342 # interface Ethernet1/2
343 # no switchport
344 # vrf member VRF1
345 # interface Ethernet1/6
346 # no switchport
347 # speed 1000
348 # vrf member TEST_VRF
349
350 - name: Parse configuration from device running config
351 cisco.nxos.nxos_vrf_interfaces:
352 running_config: "{{ lookup('file', 'parsed.cfg') }}"
353 state: parsed
354
355 # Task Output:
356 # ------------
357 #
358 # parsed:
359 # - name: "Ethernet1/2"
360 # vrf_name: "VRF1"
361 # - name: "Ethernet1/6"
362 # vrf_name: "TEST_VRF"
363
364 # Using replaced
365
366 # Before state:
367 # -------------
368 #
369 # nxos#show running-config interface
370 # interface Ethernet1/1
371 # no ip address
372 # interface Ethernet1/2
373 # vrf member vrf_B
374 # no ip address
375 # shutdown
376 # interface Ethernet1/3
377 # no ip address
378 # interfaceEthernet1/4
379 # vrf member vrf_C
380 # no ip address
381 # shutdown
382
383 - name: Replace device configuration of listed VRF interfaces with provided configuration
384 cisco.nxos.nxos_vrf_interfaces:
385 config:
386 - name: Ethernet1/1
387 vrf_name: test
388 - name: Ethernet1/2
389 vrf_name: vrf_E
390 state: replaced
391
392 # Task Output:
393 # ------------
394 #
395 # before:
396 # - name: "Ethernet1/1"
397 # vrf_name: "vrf_A"
398 # - name: "Ethernet1/2"
399 # vrf_name: "vrf_B"
400 # - name: "Ethernet1/3"
401 # - name: "Ethernet1/4"
402 # vrf_name: "vrf_C"
403 #
404 # commands:
405 # - interface Ethernet1/1
406 # - no vrf member vrf_A
407 # - vrf member test
408 # - interface Ethernet1/2
409 # - no vrf member vrf_B
410 # - vrf member vrf_E
411 #
412 # after:
413 # - name: "Ethernet1/1"
414 # vrf_name: "test"
415 # - name: "Ethernet1/2"
416 # vrf_name: "vrf_E"
417 # - name: "Ethernet1/3"
418 # - name: "Ethernet1/4"
419 # vrf_name: "vrf_C"
420
421 # Using deleted
422
423 # Before state:
424 # -------------
425 #
426 # nxos#show running-config interface
427 # interface Ethernet1/1
428 # vrf member vrf_A
429 # ip address dhcp
430 # interface Ethernet1/2
431 # vrf member vrf_B
432 # no ip address
433 # shutdown
434 # interface Ethernet1/3
435 # no ip address
436 # interfaceEthernet1/4
437 # vrf member vrf_C
438 # no ip address
439 # shutdown
440
441 - name: Delete VRF configuration of specified interfaces
442 cisco.nxos.nxos_vrf_interfaces:
443 config:
444 - name: Ethernet1/1
445 - name: Ethernet1/2
446 state: deleted
447
448 # Task Output:
449 # ------------
450 #
451 # before:
452 # - name: "Ethernet1/1"
453 # vrf_name: "vrf_A"
454 # - name: "Ethernet1/2"
455 # vrf_name: "vrf_B"
456 # - name: "Ethernet1/3"
457 # - name: "Ethernet1/4"
458 # vrf_name: "vrf_C"
459 #
460 # commands:
461 # - interface Ethernet1/1
462 # - no vrf member vrf_A
463 # - interface Ethernet1/2
464 # - no vrf member vrf_B
465 #
466 # after:
467 # - name: "Ethernet1/1"
468 # - name: "Ethernet1/1"
469 # - name: "Ethernet1/2"
470 # - name: "Ethernet1/3"
471 # - name: "Ethernet1/4"
472 # vrf_name: "vrf_C"
473
474 # After state:
475 # ------------
476 #
477 # nxos#show running-config interface
478 # interface Ethernet1/1
479 # ip address dhcp
480 # interface Ethernet1/2
481 # no ip address
482 # shutdown
483 # interface Ethernet1/3
484 # no ip address
485 # interfaceEthernet1/4
486 # vrf member vrf_C
487 # no ip address
488 # shutdown
489
490
491
492 Return Values
493 -------------
494 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:
495
496 .. raw:: html
497
498 <table border=0 cellpadding=0 class="documentation-table">
499 <tr>
500 <th colspan="1">Key</th>
501 <th>Returned</th>
502 <th width="100%">Description</th>
503 </tr>
504 <tr>
505 <td colspan="1">
506 <div class="ansibleOptionAnchor" id="return-"></div>
507 <b>after</b>
508 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
509 <div style="font-size: small">
510 <span style="color: purple">list</span>
511 </div>
512 </td>
513 <td>when changed</td>
514 <td>
515 <div>The resulting configuration after module execution.</div>
516 <br/>
517 <div style="font-size: smaller"><b>Sample:</b></div>
518 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[
519 {
520 &quot;name&quot;: &quot;Ethernet1/1&quot;
521 },
522 {
523 &quot;name&quot;: &quot;Ethernet1/2&quot;,
524 &quot;vrf_name&quot;: &quot;test&quot;
525 },
526 {
527 &quot;name&quot;: &quot;Ethernet1/3&quot;
528 },
529 {
530 &quot;name&quot;: &quot;Ethernet1/4&quot;
531 }
532 ]</div>
533 </td>
534 </tr>
535 <tr>
536 <td colspan="1">
537 <div class="ansibleOptionAnchor" id="return-"></div>
538 <b>before</b>
539 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
540 <div style="font-size: small">
541 <span style="color: purple">list</span>
542 </div>
543 </td>
544 <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code></td>
545 <td>
546 <div>The configuration prior to the module execution.</div>
547 <br/>
548 <div style="font-size: smaller"><b>Sample:</b></div>
549 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[
550 {
551 &quot;name&quot;: &quot;Ethernet1/1&quot;
552 },
553 {
554 &quot;name&quot;: &quot;Ethernet1/2&quot;,
555 &quot;vrf_name&quot;: &quot;test&quot;
556 },
557 {
558 &quot;name&quot;: &quot;Ethernet1/3&quot;
559 },
560 {
561 &quot;name&quot;: &quot;Ethernet1/4&quot;
562 }
563 ]</div>
564 </td>
565 </tr>
566 <tr>
567 <td colspan="1">
568 <div class="ansibleOptionAnchor" id="return-"></div>
569 <b>commands</b>
570 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
571 <div style="font-size: small">
572 <span style="color: purple">list</span>
573 </div>
574 </td>
575 <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code></td>
576 <td>
577 <div>The set of commands pushed to the remote device.</div>
578 <br/>
579 <div style="font-size: smaller"><b>Sample:</b></div>
580 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;interface Ethernet1/2&#x27;, &#x27;vrf member test&#x27;, &#x27;no vrf member vrf_B&#x27;]</div>
581 </td>
582 </tr>
583 <tr>
584 <td colspan="1">
585 <div class="ansibleOptionAnchor" id="return-"></div>
586 <b>gathered</b>
587 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
588 <div style="font-size: small">
589 <span style="color: purple">list</span>
590 </div>
591 </td>
592 <td>when <em>state</em> is <code>gathered</code></td>
593 <td>
594 <div>Facts about the network resource gathered from the remote device as structured data.</div>
595 <br/>
596 <div style="font-size: smaller"><b>Sample:</b></div>
597 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[
598 {
599 &quot;name&quot;: &quot;Ethernet1/1&quot;
600 },
601 {
602 &quot;name&quot;: &quot;Ethernet1/2&quot;,
603 &quot;vrf_name&quot;: &quot;vrf_B&quot;
604 },
605 {
606 &quot;name&quot;: &quot;Ethernet1/3&quot;
607 },
608 {
609 &quot;name&quot;: &quot;Ethernet1/4&quot;
610 }
611 ]</div>
612 </td>
613 </tr>
614 <tr>
615 <td colspan="1">
616 <div class="ansibleOptionAnchor" id="return-"></div>
617 <b>parsed</b>
618 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
619 <div style="font-size: small">
620 <span style="color: purple">list</span>
621 </div>
622 </td>
623 <td>when <em>state</em> is <code>parsed</code></td>
624 <td>
625 <div>The device native config provided in <em>running_config</em> option parsed into structured data as per module argspec.</div>
626 <br/>
627 <div style="font-size: smaller"><b>Sample:</b></div>
628 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[
629 {
630 &quot;name&quot;: &quot;Ethernet1/1&quot;,
631 &quot;vrf_name&quot;: &quot;vrf_C&quot;
632 },
633 {
634 &quot;name&quot;: &quot;Ethernet1/2&quot;,
635 &quot;vrf_name&quot;: &quot;test&quot;
636 },
637 {
638 &quot;name&quot;: &quot;Ethernet1/3&quot;
639 },
640 {
641 &quot;name&quot;: &quot;Ethernet1/4&quot;
642 }
643 ]</div>
644 </td>
645 </tr>
646 <tr>
647 <td colspan="1">
648 <div class="ansibleOptionAnchor" id="return-"></div>
649 <b>rendered</b>
650 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
651 <div style="font-size: small">
652 <span style="color: purple">list</span>
653 </div>
654 </td>
655 <td>when <em>state</em> is <code>rendered</code></td>
656 <td>
657 <div>The provided configuration in the task rendered in device-native format (offline).</div>
658 <br/>
659 <div style="font-size: smaller"><b>Sample:</b></div>
660 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;interface Ethernet1/1&#x27;, &#x27;vrf member vrf_C&#x27;, &#x27;interface Ethernet1/2&#x27;, &#x27;vrf member test&#x27;]</div>
661 </td>
662 </tr>
663 </table>
664 <br/><br/>
665
666
667 Status
668 ------
669
670
671 Authors
672 ~~~~~~~
673
674 - Ruchi Pakhle (@Ruchip16)