Debian Codegraph @

ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_acl_interfaces_module.rst

raw
1 .. _cisco.iosxr.iosxr_acl_interfaces_module:
2
3
4 ********************************
5 cisco.iosxr.iosxr_acl_interfaces
6 ********************************
7
8 **Resource module to configure ACL 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 manages adding and removing Access Control Lists (ACLs) from interfaces on devices running IOS-XR software.
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 ACL options for interfaces.</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>access_groups</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>Specifies ACLs attached to the interfaces.</div>
67 </td>
68 </tr>
69 <tr>
70 <td class="elbow-placeholder"></td>
71 <td class="elbow-placeholder"></td>
72 <td colspan="2">
73 <div class="ansibleOptionAnchor" id="parameter-"></div>
74 <b>acls</b>
75 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
76 <div style="font-size: small">
77 <span style="color: purple">list</span>
78 / <span style="color: purple">elements=dictionary</span>
79 </div>
80 </td>
81 <td>
82 </td>
83 <td>
84 <div>Specifies the ACLs for the provided AFI.</div>
85 </td>
86 </tr>
87 <tr>
88 <td class="elbow-placeholder"></td>
89 <td class="elbow-placeholder"></td>
90 <td class="elbow-placeholder"></td>
91 <td colspan="1">
92 <div class="ansibleOptionAnchor" id="parameter-"></div>
93 <b>direction</b>
94 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
95 <div style="font-size: small">
96 <span style="color: purple">string</span>
97 / <span style="color: red">required</span>
98 </div>
99 </td>
100 <td>
101 <ul style="margin: 0; padding: 0"><b>Choices:</b>
102 <li>in</li>
103 <li>out</li>
104 </ul>
105 </td>
106 <td>
107 <div>Specifies the direction of packets that the ACL will be applied on.</div>
108 </td>
109 </tr>
110 <tr>
111 <td class="elbow-placeholder"></td>
112 <td class="elbow-placeholder"></td>
113 <td class="elbow-placeholder"></td>
114 <td colspan="1">
115 <div class="ansibleOptionAnchor" id="parameter-"></div>
116 <b>name</b>
117 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
118 <div style="font-size: small">
119 <span style="color: purple">string</span>
120 / <span style="color: red">required</span>
121 </div>
122 </td>
123 <td>
124 </td>
125 <td>
126 <div>Specifies the name of the IPv4/IPv6 ACL for the interface.</div>
127 </td>
128 </tr>
129
130 <tr>
131 <td class="elbow-placeholder"></td>
132 <td class="elbow-placeholder"></td>
133 <td colspan="2">
134 <div class="ansibleOptionAnchor" id="parameter-"></div>
135 <b>afi</b>
136 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
137 <div style="font-size: small">
138 <span style="color: purple">string</span>
139 / <span style="color: red">required</span>
140 </div>
141 </td>
142 <td>
143 <ul style="margin: 0; padding: 0"><b>Choices:</b>
144 <li>ipv4</li>
145 <li>ipv6</li>
146 </ul>
147 </td>
148 <td>
149 <div>Specifies the AFI for the ACL(s) to be configured on this interface.</div>
150 </td>
151 </tr>
152
153 <tr>
154 <td class="elbow-placeholder"></td>
155 <td colspan="3">
156 <div class="ansibleOptionAnchor" id="parameter-"></div>
157 <b>name</b>
158 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
159 <div style="font-size: small">
160 <span style="color: purple">string</span>
161 / <span style="color: red">required</span>
162 </div>
163 </td>
164 <td>
165 </td>
166 <td>
167 <div>Name/Identifier for the interface</div>
168 </td>
169 </tr>
170
171 <tr>
172 <td colspan="4">
173 <div class="ansibleOptionAnchor" id="parameter-"></div>
174 <b>running_config</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>This option is used only with state <em>parsed</em>.</div>
184 <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>
185 <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>
186 </td>
187 </tr>
188 <tr>
189 <td colspan="4">
190 <div class="ansibleOptionAnchor" id="parameter-"></div>
191 <b>state</b>
192 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
193 <div style="font-size: small">
194 <span style="color: purple">string</span>
195 </div>
196 </td>
197 <td>
198 <ul style="margin: 0; padding: 0"><b>Choices:</b>
199 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
200 <li>replaced</li>
201 <li>overridden</li>
202 <li>deleted</li>
203 <li>gathered</li>
204 <li>parsed</li>
205 <li>rendered</li>
206 </ul>
207 </td>
208 <td>
209 <div>The state the configuration should be left in.</div>
210 </td>
211 </tr>
212 </table>
213 <br/>
214
215
216
217
218 Examples
219 --------
220
221 .. code-block:: yaml
222
223 # Using merged
224
225 # Before state:
226 # -------------
227 #
228 # RP/0/RP0/CPU0:ios#sh running-config interface
229 # Wed Jan 15 12:22:32.911 UTC
230 # interface MgmtEth0/RP0/CPU0/0
231 # ipv4 address dhcp
232 # !
233 # interface GigabitEthernet0/0/0/0
234 # shutdown
235 # !
236 # interface GigabitEthernet0/0/0/1
237 # shutdown
238 # !
239
240 - name: Merge the provided configuration with the existing running configuration
241 cisco.iosxr.iosxr_acl_interfaces:
242 config:
243 - name: GigabitEthernet0/0/0/0
244 access_groups:
245 - afi: ipv4
246 acls:
247 - name: acl_1
248 direction: in
249 - name: acl_2
250 direction: out
251 - afi: ipv6
252 acls:
253 - name: acl6_1
254 direction: in
255 - name: acl6_2
256 direction: out
257 - name: GigabitEthernet0/0/0/1
258 access_groups:
259 - afi: ipv4
260 acls:
261 - name: acl_1
262 direction: out
263 state: merged
264
265 # After state:
266 # -------------
267 #
268 # RP/0/RP0/CPU0:ios#sh running-config interface
269 # Wed Jan 15 12:27:49.378 UTC
270 # interface MgmtEth0/RP0/CPU0/0
271 # ipv4 address dhcp
272 # !
273 # interface GigabitEthernet0/0/0/0
274 # shutdown
275 # ipv4 access-group acl_1 ingress
276 # ipv4 access-group acl_2 egress
277 # ipv6 access-group acl6_1 ingress
278 # ipv6 access-group acl6_2 egress
279 # !
280 # interface GigabitEthernet0/0/0/1
281 # shutdown
282 # ipv4 access-group acl_1 egress
283 # !
284
285 # Using merged to update interface ACL configuration
286
287 # Before state:
288 # -------------
289 #
290 # RP/0/RP0/CPU0:ios#sh running-config interface
291 # Wed Jan 15 12:27:49.378 UTC
292 # interface MgmtEth0/RP0/CPU0/0
293 # ipv4 address dhcp
294 # !
295 # interface GigabitEthernet0/0/0/0
296 # shutdown
297 # ipv4 access-group acl_1 ingress
298 # ipv4 access-group acl_2 egress
299 # ipv6 access-group acl6_1 ingress
300 # ipv6 access-group acl6_2 egress
301 # !
302 # interface GigabitEthernet0/0/0/1
303 # shutdown
304 # ipv4 access-group acl_1 egress
305 # !
306 #
307
308 - name: Update acl_interfaces configuration using merged
309 cisco.iosxr.iosxr_acl_interfaces:
310 config:
311 - name: GigabitEthernet0/0/0/1
312 access_groups:
313 - afi: ipv4
314 acls:
315 - name: acl_2
316 direction: out
317 - name: acl_1
318 direction: in
319 state: merged
320
321 # After state:
322 # -------------
323 #
324 # RP/0/RP0/CPU0:ios#sh running-config interface
325 # Wed Jan 15 12:27:49.378 UTC
326 # interface MgmtEth0/RP0/CPU0/0
327 # ipv4 address dhcp
328 # !
329 # interface GigabitEthernet0/0/0/0
330 # shutdown
331 # ipv4 access-group acl_1 ingress
332 # ipv4 access-group acl_2 egress
333 # ipv6 access-group acl6_1 ingress
334 # ipv6 access-group acl6_2 egress
335 # !
336 # interface GigabitEthernet0/0/0/1
337 # shutdown
338 # ipv4 access-group acl_1 ingress
339 # ipv4 access-group acl_2 egress
340 # !
341 #
342
343 # Using replaced
344
345 # Before state:
346 # -------------
347 #
348 # RP/0/RP0/CPU0:ios#sh running-config interface
349 # Wed Jan 15 12:34:56.689 UTC
350 # interface MgmtEth0/RP0/CPU0/0
351 # ipv4 address dhcp
352 # !
353 # interface GigabitEthernet0/0/0/0
354 # shutdown
355 # ipv4 access-group acl_1 ingress
356 # ipv4 access-group acl_2 egress
357 # ipv6 access-group acl6_1 ingress
358 # ipv6 access-group acl6_2 egress
359 # !
360 # interface GigabitEthernet0/0/0/1
361 # shutdown
362 # ipv4 access-group acl_1 egress
363 # !
364
365 - name: >-
366 Replace device configurations of listed interface with provided
367 configurations
368 cisco.iosxr.iosxr_acl_interfaces:
369 config:
370 - name: GigabitEthernet0/0/0/0
371 access_groups:
372 - afi: ipv6
373 acls:
374 - name: acl6_3
375 direction: in
376 state: replaced
377
378 # After state:
379 # -------------
380 #
381 # RP/0/RP0/CPU0:ios#sh running-config interface
382 # Wed Jan 15 12:34:56.689 UTC
383 # interface MgmtEth0/RP0/CPU0/0
384 # ipv4 address dhcp
385 # !
386 # interface GigabitEthernet0/0/0/0
387 # shutdown
388 # ipv6 access-group acl6_3 ingress
389 # !
390 # interface GigabitEthernet0/0/0/1
391 # shutdown
392 # ipv4 access-group acl_1 egress
393 # !
394 #
395
396 # Using overridden
397
398 # Before state:
399 # -------------
400 #
401 # RP/0/RP0/CPU0:ios#sh running-config interface
402 # Wed Jan 15 12:34:56.689 UTC
403 # interface MgmtEth0/RP0/CPU0/0
404 # ipv4 address dhcp
405 # !
406 # interface GigabitEthernet0/0/0/0
407 # shutdown
408 # ipv4 access-group acl_1 ingress
409 # ipv4 access-group acl_2 egress
410 # ipv6 access-group acl6_1 ingress
411 # ipv6 access-group acl6_2 egress
412 # !
413 # interface GigabitEthernet0/0/0/1
414 # shutdown
415 # ipv4 access-group acl_1 egress
416 # !
417 #
418
419 - name: Overridde all interface ACL configuration with provided configuration
420 cisco.iosxr.iosxr_acl_interfaces:
421 config:
422 - name: GigabitEthernet0/0/0/1
423 access_groups:
424 - afi: ipv4
425 acls:
426 - name: acl_2
427 direction: in
428 - afi: ipv6
429 acls:
430 - name: acl6_3
431 direction: out
432 state: overridden
433
434 # After state:
435 # -------------
436 #
437 # RP/0/RP0/CPU0:ios#sh running-config interface
438 # Wed Jan 15 12:34:56.689 UTC
439 # interface MgmtEth0/RP0/CPU0/0
440 # ipv4 address dhcp
441 # !
442 # interface GigabitEthernet0/0/0/0
443 # shutdown
444 # !
445 # interface GigabitEthernet0/0/0/1
446 # shutdown
447 # ipv4 access-group acl_2 ingress
448 # ipv6 access-group acl6_3 egress
449 # !
450 #
451
452 # Using 'deleted' to delete all ACL attributes of a single interface
453
454 # Before state:
455 # -------------
456 #
457 # RP/0/RP0/CPU0:ios#sh running-config interface
458 # Wed Jan 15 12:34:56.689 UTC
459 # interface MgmtEth0/RP0/CPU0/0
460 # ipv4 address dhcp
461 # !
462 # interface GigabitEthernet0/0/0/0
463 # shutdown
464 # ipv4 access-group acl_1 ingress
465 # ipv4 access-group acl_2 egress
466 # ipv6 access-group acl6_1 ingress
467 # ipv6 access-group acl6_2 egress
468 # !
469 # interface GigabitEthernet0/0/0/1
470 # shutdown
471 # ipv4 access-group acl_1 egress
472 # !
473 #
474
475 - name: Delete all ACL attributes of GigabitEthernet0/0/0/1
476 cisco.iosxr.iosxr_acl_interfaces:
477 config:
478 - name: GigabitEthernet0/0/0/1
479 state: deleted
480
481 # After state:
482 # -------------
483 #
484 # RP/0/RP0/CPU0:ios#sh running-config interface
485 # Wed Jan 15 12:34:56.689 UTC
486 # interface MgmtEth0/RP0/CPU0/0
487 # ipv4 address dhcp
488 # !
489 # interface GigabitEthernet0/0/0/0
490 # shutdown
491 # ipv4 access-group acl_1 ingress
492 # ipv4 access-group acl_2 egress
493 # ipv6 access-group acl6_1 ingress
494 # ipv6 access-group acl6_2 egress
495 # !
496 # interface GigabitEthernet0/0/0/1
497 # shutdown
498 # !
499 #
500
501 # Using 'deleted' to remove all ACLs attached to all the interfaces in the device
502
503 # Before state:
504 # -------------
505 #
506 # RP/0/RP0/CPU0:ios#sh running-config interface
507 # Wed Jan 15 12:34:56.689 UTC
508 # interface MgmtEth0/RP0/CPU0/0
509 # ipv4 address dhcp
510 # !
511 # interface GigabitEthernet0/0/0/0
512 # shutdown
513 # ipv4 access-group acl_1 ingress
514 # ipv4 access-group acl_2 egress
515 # ipv6 access-group acl6_1 ingress
516 # ipv6 access-group acl6_2 egress
517 # !
518 # interface GigabitEthernet0/0/0/1
519 # shutdown
520 # ipv4 access-group acl_1 egress
521 # !
522 #
523
524 - name: Delete all ACL interfaces configuration from the device
525 cisco.iosxr.iosxr_acl_interfaces:
526 state: deleted
527
528 # After state:
529 # -------------
530 #
531 # RP/0/RP0/CPU0:ios#sh running-config interface
532 # Wed Jan 15 12:34:56.689 UTC
533 # interface MgmtEth0/RP0/CPU0/0
534 # ipv4 address dhcp
535 # !
536 # interface GigabitEthernet0/0/0/0
537 # shutdown
538 # !
539 # interface GigabitEthernet0/0/0/1
540 # shutdown
541 # !
542 #
543
544 # Using parsed
545
546 # parsed.cfg
547 # ------------
548 #
549 # interface MgmtEth0/RP0/CPU0/0
550 # ipv4 address dhcp
551 # !
552 # interface GigabitEthernet0/0/0/0
553 # shutdown
554 # ipv4 access-group acl_1 ingress
555 # ipv4 access-group acl_2 egress
556 # ipv6 access-group acl6_1 ingress
557 # ipv6 access-group acl6_2 egress
558 # !
559 # interface GigabitEthernet0/0/0/1
560 # shutdown
561 # ipv4 access-group acl_1 egress
562 # !
563
564 # - name: Convert ACL interfaces config to argspec without connecting to the appliance
565 # cisco.iosxr.iosxr_acl_interfaces:
566 # running_config: "{{ lookup('file', './parsed.cfg') }}"
567 # state: parsed
568
569
570 # Task Output (redacted)
571 # -----------------------
572
573 # "parsed": [
574 # {
575 # "name": "MgmtEth0/RP0/CPU0/0"
576 # },
577 # {
578 # "access_groups": [
579 # {
580 # "acls": [
581 # {
582 # "direction": "in",
583 # "name": "acl_1"
584 # },
585 # {
586 # "direction": "out",
587 # "name": "acl_2"
588 # }
589 # ],
590 # "afi": "ipv4"
591 # },
592 # {
593 # "acls": [
594 # {
595 # "direction": "in",
596 # "name": "acl6_1"
597 # },
598 # {
599 # "direction": "out",
600 # "name": "acl6_2"
601 # }
602 # ],
603 # "afi": "ipv6"
604 # }
605 # ],
606 # "name": "GigabitEthernet0/0/0/0"
607 # },
608 # {
609 # "access_groups": [
610 # {
611 # "acls": [
612 # {
613 # "direction": "out",
614 # "name": "acl_1"
615 # }
616 # ],
617 # "afi": "ipv4"
618 # }
619 # ],
620 # "name": "GigabitEthernet0/0/0/1"
621 # }
622 # ]
623 # }
624
625
626 # Using gathered
627
628 - name: Gather ACL interfaces facts using gathered state
629 cisco.iosxr.iosxr_acl_interfaces:
630 state: gathered
631
632
633 # Task Output (redacted)
634 # -----------------------
635 #
636 # "gathered": [
637 # {
638 # "name": "MgmtEth0/RP0/CPU0/0"
639 # },
640 # {
641 # "access_groups": [
642 # {
643 # "acls": [
644 # {
645 # "direction": "in",
646 # "name": "acl_1"
647 # },
648 # {
649 # "direction": "out",
650 # "name": "acl_2"
651 # }
652 # ],
653 # "afi": "ipv4"
654 # }
655 # "name": "GigabitEthernet0/0/0/0"
656 # },
657 # {
658 # "access_groups": [
659 # {
660 # "acls": [
661 # {
662 # "direction": "in",
663 # "name": "acl6_1"
664 # }
665 # ],
666 # "afi": "ipv6"
667 # }
668 # "name": "GigabitEthernet0/0/0/1"
669 # }
670 # ]
671
672
673 # Using rendered
674
675 - name: Render platform specific commands from task input using rendered state
676 cisco.iosxr.iosxr_acl_interfaces:
677 config:
678 - name: GigabitEthernet0/0/0/0
679 access_groups:
680 - afi: ipv4
681 acls:
682 - name: acl_1
683 direction: in
684 - name: acl_2
685 direction: out
686 state: rendered
687
688 # Task Output (redacted)
689 # -----------------------
690
691 # "rendered": [
692 # "interface GigabitEthernet0/0/0/0",
693 # "ipv4 access-group acl_1 ingress",
694 # "ipv4 access-group acl_2 egress"
695 # ]
696
697
698
699 Return Values
700 -------------
701 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:
702
703 .. raw:: html
704
705 <table border=0 cellpadding=0 class="documentation-table">
706 <tr>
707 <th colspan="1">Key</th>
708 <th>Returned</th>
709 <th width="100%">Description</th>
710 </tr>
711 <tr>
712 <td colspan="1">
713 <div class="ansibleOptionAnchor" id="return-"></div>
714 <b>after</b>
715 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
716 <div style="font-size: small">
717 <span style="color: purple">list</span>
718 </div>
719 </td>
720 <td>when changed</td>
721 <td>
722 <div>The resulting configuration model invocation.</div>
723 <br/>
724 <div style="font-size: smaller"><b>Sample:</b></div>
725 <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
726 of the parameters above.</div>
727 </td>
728 </tr>
729 <tr>
730 <td colspan="1">
731 <div class="ansibleOptionAnchor" id="return-"></div>
732 <b>before</b>
733 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
734 <div style="font-size: small">
735 <span style="color: purple">list</span>
736 </div>
737 </td>
738 <td>always</td>
739 <td>
740 <div>The configuration prior to the model invocation.</div>
741 <br/>
742 <div style="font-size: smaller"><b>Sample:</b></div>
743 <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
744 of the parameters above.</div>
745 </td>
746 </tr>
747 <tr>
748 <td colspan="1">
749 <div class="ansibleOptionAnchor" id="return-"></div>
750 <b>commands</b>
751 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
752 <div style="font-size: small">
753 <span style="color: purple">list</span>
754 </div>
755 </td>
756 <td>always</td>
757 <td>
758 <div>The set of commands pushed to the remote device.</div>
759 <br/>
760 <div style="font-size: smaller"><b>Sample:</b></div>
761 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;interface GigabitEthernet0/0/0/1&#x27;, &#x27;ipv4 access-group acl_1 ingress&#x27;, &#x27;ipv4 access-group acl_2 egress&#x27;, &#x27;ipv6 access-group acl6_1 ingress&#x27;, &#x27;interface GigabitEthernet0/0/0/2&#x27;, &#x27;no ipv4 access-group acl_3 ingress&#x27;, &#x27;ipv4 access-group acl_4 egress&#x27;]</div>
762 </td>
763 </tr>
764 </table>
765 <br/><br/>
766
767
768 Status
769 ------
770
771
772 Authors
773 ~~~~~~~
774
775 - Nilashish Chakraborty (@NilashishC)