Debian Codegraph @

ansible_collections/cisco/nxos/docs/cisco.nxos.nxos_acl_interfaces_module.rst

raw
1 .. _cisco.nxos.nxos_acl_interfaces_module:
2
3
4 ******************************
5 cisco.nxos.nxos_acl_interfaces
6 ******************************
7
8 **ACL 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 - Add and remove Access Control Lists on interfaces in NX-OS platform
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 list of interfaces to be configured with ACLs</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>List of address family indicators with ACLs to be configured on the interface</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>List of Access Control Lists for the interface</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>Direction to be applied for the ACL</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>Name of the ACL to be added/removed</div>
127 </td>
128 </tr>
129 <tr>
130 <td class="elbow-placeholder"></td>
131 <td class="elbow-placeholder"></td>
132 <td class="elbow-placeholder"></td>
133 <td colspan="1">
134 <div class="ansibleOptionAnchor" id="parameter-"></div>
135 <b>port</b>
136 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
137 <div style="font-size: small">
138 <span style="color: purple">boolean</span>
139 </div>
140 </td>
141 <td>
142 <ul style="margin: 0; padding: 0"><b>Choices:</b>
143 <li>no</li>
144 <li>yes</li>
145 </ul>
146 </td>
147 <td>
148 <div>Use ACL as port policy.</div>
149 </td>
150 </tr>
151
152 <tr>
153 <td class="elbow-placeholder"></td>
154 <td class="elbow-placeholder"></td>
155 <td colspan="2">
156 <div class="ansibleOptionAnchor" id="parameter-"></div>
157 <b>afi</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 <ul style="margin: 0; padding: 0"><b>Choices:</b>
166 <li>ipv4</li>
167 <li>ipv6</li>
168 </ul>
169 </td>
170 <td>
171 <div>Address Family Indicator of the ACLs to be configured</div>
172 </td>
173 </tr>
174
175 <tr>
176 <td class="elbow-placeholder"></td>
177 <td colspan="3">
178 <div class="ansibleOptionAnchor" id="parameter-"></div>
179 <b>name</b>
180 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
181 <div style="font-size: small">
182 <span style="color: purple">string</span>
183 / <span style="color: red">required</span>
184 </div>
185 </td>
186 <td>
187 </td>
188 <td>
189 <div>Name of the interface</div>
190 </td>
191 </tr>
192
193 <tr>
194 <td colspan="4">
195 <div class="ansibleOptionAnchor" id="parameter-"></div>
196 <b>running_config</b>
197 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
198 <div style="font-size: small">
199 <span style="color: purple">string</span>
200 </div>
201 </td>
202 <td>
203 </td>
204 <td>
205 <div>This option is used only with state <em>parsed</em>.</div>
206 <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 &#x27;^interface&#x27;</b>.</div>
207 <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>
208 </td>
209 </tr>
210 <tr>
211 <td colspan="4">
212 <div class="ansibleOptionAnchor" id="parameter-"></div>
213 <b>state</b>
214 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
215 <div style="font-size: small">
216 <span style="color: purple">string</span>
217 </div>
218 </td>
219 <td>
220 <ul style="margin: 0; padding: 0"><b>Choices:</b>
221 <li>deleted</li>
222 <li>gathered</li>
223 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
224 <li>overridden</li>
225 <li>rendered</li>
226 <li>replaced</li>
227 <li>parsed</li>
228 </ul>
229 </td>
230 <td>
231 <div>The state the configuration should be left in</div>
232 </td>
233 </tr>
234 </table>
235 <br/>
236
237
238 Notes
239 -----
240
241 .. note::
242 - Tested against NX-OS 7.3.(0)D1(1) on VIRL
243 - Unsupported for Cisco MDS
244
245
246
247 Examples
248 --------
249
250 .. code-block:: yaml
251
252 # Using merged
253
254 # Before state:
255 # ------------
256 #
257
258 - name: Merge ACL interfaces configuration
259 cisco.nxos.nxos_acl_interfaces:
260 config:
261 - name: Ethernet1/2
262 access_groups:
263 - afi: ipv6
264 acls:
265 - name: ACL1v6
266 direction: in
267
268 - name: Eth1/5
269 access_groups:
270 - afi: ipv4
271 acls:
272 - name: PortACL
273 direction: in
274 port: true
275
276 - name: ACL1v4
277 direction: out
278
279 - afi: ipv6
280 acls:
281 - name: ACL1v6
282 direction: in
283 state: merged
284
285 # After state:
286 # ------------
287 # interface Ethernet1/2
288 # ipv6 traffic-filter ACL1v6 in
289 # interface Ethernet1/5
290 # ip port access-group PortACL in
291 # ip access-group ACL1v4 out
292 # ipv6 traffic-filter ACL1v6 in
293
294 # Using replaced
295
296 # Before state:
297 # ------------
298 # interface Ethernet1/2
299 # ipv6 traffic-filter ACL1v6 in
300 # interface Ethernet1/5
301 # ip port access-group PortACL in
302 # ip access-group ACL1v4 out
303 # ipv6 traffic-filter ACL1v6 in
304
305 - name: Replace interface configuration with given configuration
306 cisco.nxos.nxos_acl_interfaces:
307 config:
308 - name: Eth1/5
309 access_groups:
310 - afi: ipv4
311 acls:
312 - name: NewACLv4
313 direction: out
314
315 - name: Ethernet1/3
316 access_groups:
317 - afi: ipv6
318 acls:
319 - name: NewACLv6
320 direction: in
321 port: true
322 state: replaced
323
324 # After state:
325 # ------------
326 # interface Ethernet1/2
327 # ipv6 traffic-filter ACL1v6 in
328 # interface Ethernet1/3
329 # ipv6 port traffic-filter NewACLv6 in
330 # interface Ethernet1/5
331 # ip access-group NewACLv4 out
332
333 # Using overridden
334
335 # Before state:
336 # ------------
337 # interface Ethernet1/2
338 # ipv6 traffic-filter ACL1v6 in
339 # interface Ethernet1/5
340 # ip port access-group PortACL in
341 # ip access-group ACL1v4 out
342 # ipv6 traffic-filter ACL1v6 in
343
344 - name: Override interface configuration with given configuration
345 cisco.nxos.nxos_acl_interfaces:
346 config:
347 - name: Ethernet1/3
348 access_groups:
349 - afi: ipv4
350 acls:
351 - name: ACL1v4
352 direction: out
353
354 - name: PortACL
355 port: true
356 direction: in
357 - afi: ipv6
358 acls:
359 - name: NewACLv6
360 direction: in
361 port: true
362 state: overridden
363
364 # After state:
365 # ------------
366 # interface Ethernet1/3
367 # ip access-group ACL1v4 out
368 # ip port access-group PortACL in
369 # ipv6 port traffic-filter NewACLv6 in
370
371 # Using deleted to remove ACL config from specified interfaces
372
373 # Before state:
374 # -------------
375 # interface Ethernet1/1
376 # ip access-group ACL2v4 in
377 # interface Ethernet1/2
378 # ipv6 traffic-filter ACL1v6 in
379 # interface Ethernet1/5
380 # ip port access-group PortACL in
381 # ip access-group ACL1v4 out
382 # ipv6 traffic-filter ACL1v6 in
383
384 - name: Delete ACL configuration on interfaces
385 cisco.nxos.nxos_acl_interfaces:
386 config:
387 - name: Ethernet1/5
388 - name: Ethernet1/2
389 state: deleted
390
391 # After state:
392 # -------------
393 # interface Ethernet1/1
394 # ip access-group ACL2v4 in
395 # interface Ethernet1/2
396 # interface Ethernet1/5
397
398 # Using deleted to remove ACL config from all interfaces
399
400 # Before state:
401 # -------------
402 # interface Ethernet1/1
403 # ip access-group ACL2v4 in
404 # interface Ethernet1/2
405 # ipv6 traffic-filter ACL1v6 in
406 # interface Ethernet1/5
407 # ip port access-group PortACL in
408 # ip access-group ACL1v4 out
409 # ipv6 traffic-filter ACL1v6 in
410
411 - name: Delete ACL configuration from all interfaces
412 cisco.nxos.nxos_acl_interfaces:
413 state: deleted
414
415 # After state:
416 # -------------
417 # interface Ethernet1/1
418 # interface Ethernet1/2
419 # interface Ethernet1/5
420
421 # Using parsed
422
423 - name: Parse given configuration into structured format
424 cisco.nxos.nxos_acl_interfaces:
425 running_config: |
426 interface Ethernet1/2
427 ipv6 traffic-filter ACL1v6 in
428 interface Ethernet1/5
429 ipv6 traffic-filter ACL1v6 in
430 ip access-group ACL1v4 out
431 ip port access-group PortACL in
432 state: parsed
433
434 # returns
435 # parsed:
436 # - name: Ethernet1/2
437 # access_groups:
438 # - afi: ipv6
439 # acls:
440 # - name: ACL1v6
441 # direction: in
442 # - name: Ethernet1/5
443 # access_groups:
444 # - afi: ipv4
445 # acls:
446 # - name: PortACL
447 # direction: in
448 # port: True
449 # - name: ACL1v4
450 # direction: out
451 # - afi: ipv6
452 # acls:
453 # - name: ACL1v6
454 # direction: in
455
456
457 # Using gathered:
458
459 # Before state:
460 # ------------
461 # interface Ethernet1/2
462 # ipv6 traffic-filter ACL1v6 in
463 # interface Ethernet1/5
464 # ipv6 traffic-filter ACL1v6 in
465 # ip access-group ACL1v4 out
466 # ip port access-group PortACL in
467
468 - name: Gather existing configuration from device
469 cisco.nxos.nxos_acl_interfaces:
470 config:
471 state: gathered
472
473 # returns
474 # gathered:
475 # - name: Ethernet1/2
476 # access_groups:
477 # - afi: ipv6
478 # acls:
479 # - name: ACL1v6
480 # direction: in
481 # - name: Ethernet1/5
482 # access_groups:
483 # - afi: ipv4
484 # acls:
485 # - name: PortACL
486 # direction: in
487 # port: True
488 # - name: ACL1v4
489 # direction: out
490 # - afi: ipv6
491 # acls:
492 # - name: ACL1v6
493 # direction: in
494
495
496 # Using rendered
497
498 - name: Render required configuration to be pushed to the device
499 cisco.nxos.nxos_acl_interfaces:
500 config:
501 - name: Ethernet1/2
502 access_groups:
503 - afi: ipv6
504 acls:
505 - name: ACL1v6
506 direction: in
507 - name: Ethernet1/5
508 access_groups:
509 - afi: ipv4
510 acls:
511 - name: PortACL
512 direction: in
513 port: true
514 - name: ACL1v4
515 direction: out
516 - afi: ipv6
517 acls:
518 - name: ACL1v6
519 direction: in
520 state: rendered
521
522
523 # returns
524 # rendered:
525 # interface Ethernet1/2
526 # ipv6 traffic-filter ACL1v6 in
527 # interface Ethernet1/5
528 # ipv6 traffic-filter ACL1v6 in
529 # ip access-group ACL1v4 out
530 # ip port access-group PortACL in
531
532
533
534 Return Values
535 -------------
536 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:
537
538 .. raw:: html
539
540 <table border=0 cellpadding=0 class="documentation-table">
541 <tr>
542 <th colspan="1">Key</th>
543 <th>Returned</th>
544 <th width="100%">Description</th>
545 </tr>
546 <tr>
547 <td colspan="1">
548 <div class="ansibleOptionAnchor" id="return-"></div>
549 <b>after</b>
550 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
551 <div style="font-size: small">
552 <span style="color: purple">dictionary</span>
553 </div>
554 </td>
555 <td>when changed</td>
556 <td>
557 <div>The resulting configuration model invocation.</div>
558 <br/>
559 <div style="font-size: smaller"><b>Sample:</b></div>
560 <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
561 of the parameters above.</div>
562 </td>
563 </tr>
564 <tr>
565 <td colspan="1">
566 <div class="ansibleOptionAnchor" id="return-"></div>
567 <b>before</b>
568 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
569 <div style="font-size: small">
570 <span style="color: purple">dictionary</span>
571 </div>
572 </td>
573 <td>always</td>
574 <td>
575 <div>The configuration prior to the model invocation.</div>
576 <br/>
577 <div style="font-size: smaller"><b>Sample:</b></div>
578 <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
579 of the parameters above.</div>
580 </td>
581 </tr>
582 <tr>
583 <td colspan="1">
584 <div class="ansibleOptionAnchor" id="return-"></div>
585 <b>commands</b>
586 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
587 <div style="font-size: small">
588 <span style="color: purple">list</span>
589 </div>
590 </td>
591 <td>always</td>
592 <td>
593 <div>The set of commands pushed to the remote device.</div>
594 <br/>
595 <div style="font-size: smaller"><b>Sample:</b></div>
596 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;interface Ethernet1/2&#x27;, &#x27;ipv6 traffic-filter ACL1v6 out&#x27;, &#x27;ip port access-group PortACL in&#x27;]</div>
597 </td>
598 </tr>
599 </table>
600 <br/><br/>
601
602
603 Status
604 ------
605
606
607 Authors
608 ~~~~~~~
609
610 - Adharsh Srivats Rangarajan (@adharshsrivatsr)