| 1 |
.. _cisco.iosxr.iosxr_l2_interfaces_module: |
| 2 |
|
| 3 |
|
| 4 |
******************************* |
| 5 |
cisco.iosxr.iosxr_l2_interfaces |
| 6 |
******************************* |
| 7 |
|
| 8 |
**Resource Module to configure L2 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 the Layer-2 interface attributes 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="3">Parameter</th> |
| 33 |
<th>Choices/<font color="blue">Defaults</font></th> |
| 34 |
<th width="100%">Comments</th> |
| 35 |
</tr> |
| 36 |
<tr> |
| 37 |
<td colspan="3"> |
| 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-2 interface options</div> |
| 50 |
</td> |
| 51 |
</tr> |
| 52 |
<tr> |
| 53 |
<td class="elbow-placeholder"></td> |
| 54 |
<td colspan="2"> |
| 55 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 56 |
<b>encapsulation</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>Specify which packets will be matched by this sub-interface.</div> |
| 66 |
</td> |
| 67 |
</tr> |
| 68 |
<tr> |
| 69 |
<td class="elbow-placeholder"></td> |
| 70 |
<td class="elbow-placeholder"></td> |
| 71 |
<td colspan="1"> |
| 72 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 73 |
<b>dot1q</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>IEEE 802.1Q VLAN-tagged packets.</div> |
| 83 |
</td> |
| 84 |
</tr> |
| 85 |
<tr> |
| 86 |
<td class="elbow-placeholder"></td> |
| 87 |
<td class="elbow-placeholder"></td> |
| 88 |
<td colspan="1"> |
| 89 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 90 |
<b>second_dot1q</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>IEEE 802.1Q VLAN-tagged packets.</div> |
| 100 |
</td> |
| 101 |
</tr> |
| 102 |
|
| 103 |
<tr> |
| 104 |
<td class="elbow-placeholder"></td> |
| 105 |
<td colspan="2"> |
| 106 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 107 |
<b>l2protocol</b> |
| 108 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 109 |
<div style="font-size: small"> |
| 110 |
<span style="color: purple">list</span> |
| 111 |
/ <span style="color: purple">elements=dictionary</span> |
| 112 |
</div> |
| 113 |
</td> |
| 114 |
<td> |
| 115 |
</td> |
| 116 |
<td> |
| 117 |
<div>Configures Layer 2 protocol tunneling and protocol data unit (PDU) filtering on an interface.</div> |
| 118 |
</td> |
| 119 |
</tr> |
| 120 |
<tr> |
| 121 |
<td class="elbow-placeholder"></td> |
| 122 |
<td class="elbow-placeholder"></td> |
| 123 |
<td colspan="1"> |
| 124 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 125 |
<b>cdp</b> |
| 126 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 127 |
<div style="font-size: small"> |
| 128 |
<span style="color: purple">string</span> |
| 129 |
</div> |
| 130 |
</td> |
| 131 |
<td> |
| 132 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 133 |
<li>drop</li> |
| 134 |
<li>forward</li> |
| 135 |
<li>tunnel</li> |
| 136 |
</ul> |
| 137 |
</td> |
| 138 |
<td> |
| 139 |
<div>Cisco Discovery Protocol (CDP) tunneling and data unit parameters.</div> |
| 140 |
</td> |
| 141 |
</tr> |
| 142 |
<tr> |
| 143 |
<td class="elbow-placeholder"></td> |
| 144 |
<td class="elbow-placeholder"></td> |
| 145 |
<td colspan="1"> |
| 146 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 147 |
<b>cpsv</b> |
| 148 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 149 |
<div style="font-size: small"> |
| 150 |
<span style="color: purple">string</span> |
| 151 |
</div> |
| 152 |
</td> |
| 153 |
<td> |
| 154 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 155 |
<li>drop</li> |
| 156 |
<li>reverse-tunnel</li> |
| 157 |
<li>tunnel</li> |
| 158 |
</ul> |
| 159 |
</td> |
| 160 |
<td> |
| 161 |
<div>CDP, PVST+, STP, and VTP protocols.</div> |
| 162 |
</td> |
| 163 |
</tr> |
| 164 |
<tr> |
| 165 |
<td class="elbow-placeholder"></td> |
| 166 |
<td class="elbow-placeholder"></td> |
| 167 |
<td colspan="1"> |
| 168 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 169 |
<b>pvst</b> |
| 170 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 171 |
<div style="font-size: small"> |
| 172 |
<span style="color: purple">string</span> |
| 173 |
</div> |
| 174 |
</td> |
| 175 |
<td> |
| 176 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 177 |
<li>drop</li> |
| 178 |
<li>forward</li> |
| 179 |
<li>tunnel</li> |
| 180 |
</ul> |
| 181 |
</td> |
| 182 |
<td> |
| 183 |
<div>Configures the per-VLAN Spanning Tree Protocol (PVST) tunneling and data unit parameters.</div> |
| 184 |
</td> |
| 185 |
</tr> |
| 186 |
<tr> |
| 187 |
<td class="elbow-placeholder"></td> |
| 188 |
<td class="elbow-placeholder"></td> |
| 189 |
<td colspan="1"> |
| 190 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 191 |
<b>stp</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>drop</li> |
| 200 |
<li>forward</li> |
| 201 |
<li>tunnel</li> |
| 202 |
</ul> |
| 203 |
</td> |
| 204 |
<td> |
| 205 |
<div>Spanning Tree Protocol (STP) tunneling and data unit parameters.</div> |
| 206 |
</td> |
| 207 |
</tr> |
| 208 |
<tr> |
| 209 |
<td class="elbow-placeholder"></td> |
| 210 |
<td class="elbow-placeholder"></td> |
| 211 |
<td colspan="1"> |
| 212 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 213 |
<b>vtp</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>drop</li> |
| 222 |
<li>forward</li> |
| 223 |
<li>tunnel</li> |
| 224 |
</ul> |
| 225 |
</td> |
| 226 |
<td> |
| 227 |
<div>VLAN Trunk Protocol (VTP) tunneling and data unit parameters.</div> |
| 228 |
</td> |
| 229 |
</tr> |
| 230 |
|
| 231 |
<tr> |
| 232 |
<td class="elbow-placeholder"></td> |
| 233 |
<td colspan="2"> |
| 234 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 235 |
<b>l2transport</b> |
| 236 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 237 |
<div style="font-size: small"> |
| 238 |
<span style="color: purple">boolean</span> |
| 239 |
</div> |
| 240 |
</td> |
| 241 |
<td> |
| 242 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 243 |
<li>no</li> |
| 244 |
<li>yes</li> |
| 245 |
</ul> |
| 246 |
</td> |
| 247 |
<td> |
| 248 |
<div>Switchport mode access command to configure the interface as a layer 2 access</div> |
| 249 |
</td> |
| 250 |
</tr> |
| 251 |
<tr> |
| 252 |
<td class="elbow-placeholder"></td> |
| 253 |
<td colspan="2"> |
| 254 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 255 |
<b>name</b> |
| 256 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 257 |
<div style="font-size: small"> |
| 258 |
<span style="color: purple">string</span> |
| 259 |
/ <span style="color: red">required</span> |
| 260 |
</div> |
| 261 |
</td> |
| 262 |
<td> |
| 263 |
</td> |
| 264 |
<td> |
| 265 |
<div>Full name of the interface/sub-interface excluding any logical unit number, e.g. GigabitEthernet0/0/0/1 or GigabitEthernet0/0/0/1.100.</div> |
| 266 |
</td> |
| 267 |
</tr> |
| 268 |
<tr> |
| 269 |
<td class="elbow-placeholder"></td> |
| 270 |
<td colspan="2"> |
| 271 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 272 |
<b>native_vlan</b> |
| 273 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 274 |
<div style="font-size: small"> |
| 275 |
<span style="color: purple">integer</span> |
| 276 |
</div> |
| 277 |
</td> |
| 278 |
<td> |
| 279 |
</td> |
| 280 |
<td> |
| 281 |
<div>Configure a native VLAN ID for the trunk</div> |
| 282 |
</td> |
| 283 |
</tr> |
| 284 |
<tr> |
| 285 |
<td class="elbow-placeholder"></td> |
| 286 |
<td colspan="2"> |
| 287 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 288 |
<b>propagate</b> |
| 289 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 290 |
<div style="font-size: small"> |
| 291 |
<span style="color: purple">boolean</span> |
| 292 |
</div> |
| 293 |
</td> |
| 294 |
<td> |
| 295 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 296 |
<li>no</li> |
| 297 |
<li>yes</li> |
| 298 |
</ul> |
| 299 |
</td> |
| 300 |
<td> |
| 301 |
<div>Propagate Layer 2 transport events. Note that it will work only when the <em>l2tranport</em> option is set to TRUE</div> |
| 302 |
</td> |
| 303 |
</tr> |
| 304 |
<tr> |
| 305 |
<td class="elbow-placeholder"></td> |
| 306 |
<td colspan="2"> |
| 307 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 308 |
<b>q_vlan</b> |
| 309 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 310 |
<div style="font-size: small"> |
| 311 |
<span style="color: purple">list</span> |
| 312 |
/ <span style="color: purple">elements=integer</span> |
| 313 |
</div> |
| 314 |
</td> |
| 315 |
<td> |
| 316 |
</td> |
| 317 |
<td> |
| 318 |
<div>802.1Q VLAN configuration. Note that it can accept either 2 VLAN IDs when configuring Q-in-Q VLAN, or it will accept 1 VLAN ID and 'any' as input list when configuring Q-in-any vlan as input. Note, that this option is valid only with respect to Sub-Interface and is not valid when configuring for Interface.</div> |
| 319 |
<div>This option is DEPRECATED and replaced with qvlan, this attribute will be removed after 2026-06-01.</div> |
| 320 |
</td> |
| 321 |
</tr> |
| 322 |
<tr> |
| 323 |
<td class="elbow-placeholder"></td> |
| 324 |
<td colspan="2"> |
| 325 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 326 |
<b>qvlan</b> |
| 327 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 328 |
<div style="font-size: small"> |
| 329 |
<span style="color: purple">list</span> |
| 330 |
/ <span style="color: purple">elements=string</span> |
| 331 |
</div> |
| 332 |
</td> |
| 333 |
<td> |
| 334 |
</td> |
| 335 |
<td> |
| 336 |
<div>802.1Q VLAN configuration. Note that it can accept either 2 VLAN IDs when configuring Q-in-Q VLAN, or it will accept 1 VLAN ID and 'any' as input list when configuring Q-in-any vlan as input. Note, that this option is valid only with respect to Sub-Interface and is not valid when configuring for Interface.</div> |
| 337 |
</td> |
| 338 |
</tr> |
| 339 |
|
| 340 |
<tr> |
| 341 |
<td colspan="3"> |
| 342 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 343 |
<b>running_config</b> |
| 344 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 345 |
<div style="font-size: small"> |
| 346 |
<span style="color: purple">string</span> |
| 347 |
</div> |
| 348 |
</td> |
| 349 |
<td> |
| 350 |
</td> |
| 351 |
<td> |
| 352 |
<div>This option is used only with state <em>parsed</em>.</div> |
| 353 |
<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> |
| 354 |
<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's argspec and the value is then returned in the <em>parsed</em> key within the result.</div> |
| 355 |
</td> |
| 356 |
</tr> |
| 357 |
<tr> |
| 358 |
<td colspan="3"> |
| 359 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 360 |
<b>state</b> |
| 361 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 362 |
<div style="font-size: small"> |
| 363 |
<span style="color: purple">string</span> |
| 364 |
</div> |
| 365 |
</td> |
| 366 |
<td> |
| 367 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 368 |
<li><div style="color: blue"><b>merged</b> ←</div></li> |
| 369 |
<li>replaced</li> |
| 370 |
<li>overridden</li> |
| 371 |
<li>deleted</li> |
| 372 |
<li>rendered</li> |
| 373 |
<li>gathered</li> |
| 374 |
<li>parsed</li> |
| 375 |
</ul> |
| 376 |
</td> |
| 377 |
<td> |
| 378 |
<div>The state of the configuration after module completion</div> |
| 379 |
</td> |
| 380 |
</tr> |
| 381 |
</table> |
| 382 |
<br/> |
| 383 |
|
| 384 |
|
| 385 |
Notes |
| 386 |
----- |
| 387 |
|
| 388 |
.. note:: |
| 389 |
- This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_. |
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
Examples |
| 394 |
-------- |
| 395 |
|
| 396 |
.. code-block:: yaml |
| 397 |
|
| 398 |
# Using merged |
| 399 |
# |
| 400 |
# Before state: |
| 401 |
# ------------- |
| 402 |
# |
| 403 |
# viosxr#show running-config interface |
| 404 |
# interface GigabitEthernet0/0/0/3 |
| 405 |
# description Ansible Network |
| 406 |
# vrf custB |
| 407 |
# ipv4 address 10.10.0.2 255.255.255.0 |
| 408 |
# duplex half |
| 409 |
# shutdown |
| 410 |
# ! |
| 411 |
# interface GigabitEthernet0/0/0/4 |
| 412 |
# description Test description |
| 413 |
# ! |
| 414 |
|
| 415 |
- name: Merge provided configuration with device configuration |
| 416 |
cisco.iosxr.iosxr_l2_interfaces: |
| 417 |
config: |
| 418 |
- name: GigabitEthernet0/0/0/3 |
| 419 |
native_vlan: 20 |
| 420 |
- name: GigabitEthernet0/0/0/4 |
| 421 |
native_vlan: 40 |
| 422 |
l2transport: true |
| 423 |
l2protocol: |
| 424 |
- stp: tunnel |
| 425 |
- name: GigabitEthernet0/0/0/3.900 |
| 426 |
l2transport: true |
| 427 |
q_vlan: |
| 428 |
- 20 |
| 429 |
- 40 |
| 430 |
state: merged |
| 431 |
|
| 432 |
|
| 433 |
# After state: |
| 434 |
# ------------ |
| 435 |
# |
| 436 |
# viosxr#show running-config interface |
| 437 |
# interface GigabitEthernet0/0/0/3 |
| 438 |
# description Ansible Network |
| 439 |
# vrf custB |
| 440 |
# ipv4 address 10.10.0.2 255.255.255.0 |
| 441 |
# duplex half |
| 442 |
# shutdown |
| 443 |
# dot1q native vlan 20 |
| 444 |
# ! |
| 445 |
# interface GigabitEthernet0/0/0/4 |
| 446 |
# description Test description |
| 447 |
# dot1q native vlan 10 |
| 448 |
# l2transport |
| 449 |
# l2protocol stp tunnel |
| 450 |
# ! |
| 451 |
# ! |
| 452 |
# interface GigabitEthernet0/0/0/3.900 l2transport |
| 453 |
# dot1q vlan 20 40 |
| 454 |
# ! |
| 455 |
|
| 456 |
# Using replaced |
| 457 |
# |
| 458 |
# Before state: |
| 459 |
# ------------- |
| 460 |
# |
| 461 |
# viosxr#show running-config interface |
| 462 |
# interface GigabitEthernet0/0/0/3 |
| 463 |
# description Ansible Network |
| 464 |
# vrf custB |
| 465 |
# ipv4 address 10.10.0.2 255.255.255.0 |
| 466 |
# duplex half |
| 467 |
# shutdown |
| 468 |
# dot1q native vlan 20 |
| 469 |
# ! |
| 470 |
# interface GigabitEthernet0/0/0/4 |
| 471 |
# description Test description |
| 472 |
# dot1q native vlan 10 |
| 473 |
# l2transport |
| 474 |
# l2protocol stp tunnel |
| 475 |
# ! |
| 476 |
# ! |
| 477 |
# interface GigabitEthernet0/0/0/3.900 l2transport |
| 478 |
# dot1q vlan 20 40 |
| 479 |
# ! |
| 480 |
|
| 481 |
- name: >- |
| 482 |
Replaces device configuration of listed interfaces with provided |
| 483 |
configuration |
| 484 |
cisco.iosxr.iosxr_l2_interfaces: |
| 485 |
config: |
| 486 |
- name: GigabitEthernet0/0/0/4 |
| 487 |
native_vlan: 40 |
| 488 |
l2transport: true |
| 489 |
l2protocol: |
| 490 |
- stp: forward |
| 491 |
- name: GigabitEthernet0/0/0/3.900 |
| 492 |
q_vlan: |
| 493 |
- 20 |
| 494 |
- any |
| 495 |
state: replaced |
| 496 |
|
| 497 |
|
| 498 |
# After state: |
| 499 |
# ------------- |
| 500 |
# |
| 501 |
# viosxr#show running-config interface |
| 502 |
# interface GigabitEthernet0/0/0/3 |
| 503 |
# description Ansible Network |
| 504 |
# vrf custB |
| 505 |
# ipv4 address 10.10.0.2 255.255.255.0 |
| 506 |
# duplex half |
| 507 |
# shutdown |
| 508 |
# dot1q native vlan 20 |
| 509 |
# ! |
| 510 |
# interface GigabitEthernet0/0/0/4 |
| 511 |
# description Test description |
| 512 |
# dot1q native vlan 40 |
| 513 |
# l2transport |
| 514 |
# l2protocol stp forward |
| 515 |
# ! |
| 516 |
# ! |
| 517 |
# interface GigabitEthernet0/0/0/3.900 l2transport |
| 518 |
# dot1q vlan 20 any |
| 519 |
# ! |
| 520 |
|
| 521 |
# Using overridden |
| 522 |
# |
| 523 |
# Before state: |
| 524 |
# ------------- |
| 525 |
# |
| 526 |
# viosxr#show running-config interface |
| 527 |
# interface GigabitEthernet0/0/0/3 |
| 528 |
# description Ansible Network |
| 529 |
# vrf custB |
| 530 |
# ipv4 address 10.10.0.2 255.255.255.0 |
| 531 |
# duplex half |
| 532 |
# shutdown |
| 533 |
# dot1q native vlan 20 |
| 534 |
# ! |
| 535 |
# interface GigabitEthernet0/0/0/4 |
| 536 |
# description Test description |
| 537 |
# dot1q native vlan 10 |
| 538 |
# l2transport |
| 539 |
# l2protocol stp tunnel |
| 540 |
# ! |
| 541 |
# ! |
| 542 |
# interface GigabitEthernet0/0/0/3.900 l2transport |
| 543 |
# dot1q vlan 20 40 |
| 544 |
# ! |
| 545 |
|
| 546 |
- name: Override device configuration of all interfaces with provided configuration |
| 547 |
cisco.iosxr.iosxr_l2_interfaces: |
| 548 |
config: |
| 549 |
- name: GigabitEthernet0/0/0/4 |
| 550 |
native_vlan: 40 |
| 551 |
l2transport: true |
| 552 |
l2protocol: |
| 553 |
- stp: forward |
| 554 |
- name: GigabitEthernet0/0/0/3.900 |
| 555 |
q_vlan: |
| 556 |
- 20 |
| 557 |
- any |
| 558 |
state: overridden |
| 559 |
|
| 560 |
|
| 561 |
# After state: |
| 562 |
# ------------- |
| 563 |
# |
| 564 |
# viosxr#show running-config interface |
| 565 |
# interface GigabitEthernet0/0/0/3 |
| 566 |
# description Ansible Network |
| 567 |
# vrf custB |
| 568 |
# ipv4 address 10.10.0.2 255.255.255.0 |
| 569 |
# duplex half |
| 570 |
# shutdown |
| 571 |
# ! |
| 572 |
# interface GigabitEthernet0/0/0/4 |
| 573 |
# description Test description |
| 574 |
# dot1q native vlan 40 |
| 575 |
# l2transport |
| 576 |
# l2protocol stp forward |
| 577 |
# ! |
| 578 |
# ! |
| 579 |
# interface GigabitEthernet0/0/0/3.900 |
| 580 |
# dot1q vlan 20 any |
| 581 |
# ! |
| 582 |
|
| 583 |
# Using deleted |
| 584 |
# |
| 585 |
# Before state: |
| 586 |
# ------------- |
| 587 |
# |
| 588 |
# viosxr#show running-config interface |
| 589 |
# interface GigabitEthernet0/0/0/3 |
| 590 |
# description Ansible Network |
| 591 |
# vrf custB |
| 592 |
# ipv4 address 10.10.0.2 255.255.255.0 |
| 593 |
# duplex half |
| 594 |
# shutdown |
| 595 |
# dot1q native vlan 20 |
| 596 |
# ! |
| 597 |
# interface GigabitEthernet0/0/0/4 |
| 598 |
# description Test description |
| 599 |
# dot1q native vlan 10 |
| 600 |
# l2transport |
| 601 |
# l2protocol stp tunnel |
| 602 |
# ! |
| 603 |
# ! |
| 604 |
# |
| 605 |
|
| 606 |
- name: "Delete L2 attributes of given interfaces (Note: This won't delete the interface itself)" |
| 607 |
cisco.iosxr.iosxr_l2_interfaces: |
| 608 |
config: |
| 609 |
- name: GigabitEthernet0/0/0/4 |
| 610 |
state: deleted |
| 611 |
|
| 612 |
# After state: |
| 613 |
# ------------ |
| 614 |
# |
| 615 |
# viosxr#show running-config interface |
| 616 |
# interface GigabitEthernet0/0/0/3 |
| 617 |
# description Ansible Network |
| 618 |
# vrf custB |
| 619 |
# ipv4 address 10.10.0.2 255.255.255.0 |
| 620 |
# duplex half |
| 621 |
# shutdown |
| 622 |
# dot1q native vlan 20 |
| 623 |
# ! |
| 624 |
# interface GigabitEthernet0/0/0/4 |
| 625 |
# description Test description |
| 626 |
# ! |
| 627 |
|
| 628 |
# Using Deleted without any config passed |
| 629 |
# "(NOTE: This will delete all of configured resource module attributes from each configured interface)" |
| 630 |
# |
| 631 |
# Before state: |
| 632 |
# ------------- |
| 633 |
# |
| 634 |
# viosxr#show running-config interface |
| 635 |
# interface GigabitEthernet0/0/0/3 |
| 636 |
# description Ansible Network |
| 637 |
# vrf custB |
| 638 |
# ipv4 address 10.10.0.2 255.255.255.0 |
| 639 |
# duplex half |
| 640 |
# shutdown |
| 641 |
# dot1q native vlan 20 |
| 642 |
# ! |
| 643 |
# interface GigabitEthernet0/0/0/4 |
| 644 |
# description Test description |
| 645 |
# dot1q native vlan 10 |
| 646 |
# l2transport |
| 647 |
# l2protocol stp tunnel |
| 648 |
# ! |
| 649 |
# ! |
| 650 |
|
| 651 |
- name: "Delete L2 attributes of all interfaces (Note: This won't delete the interface itself)" |
| 652 |
cisco.iosxr.iosxr_l2_interfaces: |
| 653 |
state: deleted |
| 654 |
|
| 655 |
# After state: |
| 656 |
# ------------ |
| 657 |
# |
| 658 |
# viosxr#show running-config interface |
| 659 |
# interface GigabitEthernet0/0/0/3 |
| 660 |
# description Ansible Network |
| 661 |
# vrf custB |
| 662 |
# ipv4 address 10.10.0.2 255.255.255.0 |
| 663 |
# duplex half |
| 664 |
# shutdown |
| 665 |
# ! |
| 666 |
# interface GigabitEthernet0/0/0/4 |
| 667 |
# description Test description |
| 668 |
# ! |
| 669 |
|
| 670 |
|
| 671 |
# Using parsed |
| 672 |
# parsed.cfg |
| 673 |
# ------------ |
| 674 |
# |
| 675 |
# interface Loopback888 |
| 676 |
# description test for ansible |
| 677 |
# shutdown |
| 678 |
# ! |
| 679 |
# interface MgmtEth0/0/CPU0/0 |
| 680 |
# ipv4 address 10.8.38.70 255.255.255.0 |
| 681 |
# ! |
| 682 |
# interface GigabitEthernet0/0/0/0 |
| 683 |
# description Configured and Merged by Ansible-Network |
| 684 |
# mtu 110 |
| 685 |
# ipv4 address 172.31.1.1 255.255.255.0 |
| 686 |
# duplex half |
| 687 |
# ! |
| 688 |
# interface GigabitEthernet0/0/0/1 |
| 689 |
# dot1q native vlan 10 |
| 690 |
# l2transport |
| 691 |
# l2protocol cdp forward |
| 692 |
# l2protocol pvst tunnel |
| 693 |
# propagate remote-status |
| 694 |
# ! |
| 695 |
# ! |
| 696 |
# interface GigabitEthernet0/0/0/3 |
| 697 |
# shutdown |
| 698 |
# ! |
| 699 |
# interface GigabitEthernet0/0/0/3.900 |
| 700 |
# encapsulation dot1q 20 second-dot1q 40 |
| 701 |
# ! |
| 702 |
# interface GigabitEthernet0/0/0/4 |
| 703 |
# shutdown |
| 704 |
# dot1q native vlan 40 |
| 705 |
# ! |
| 706 |
- name: Convert L2 interfaces config to argspec without connecting to the appliance |
| 707 |
cisco.iosxr.iosxr_l2_interfaces: |
| 708 |
running_config: "{{ lookup('file', './parsed.cfg') }}" |
| 709 |
state: parsed |
| 710 |
# Task Output (redacted) |
| 711 |
# ----------------------- |
| 712 |
# "parsed": [ |
| 713 |
# { |
| 714 |
# "name": "GigabitEthernet0/0/0/0" |
| 715 |
# }, |
| 716 |
# { |
| 717 |
# "l2protocol": [ |
| 718 |
# { |
| 719 |
# "cdp": "forward" |
| 720 |
# }, |
| 721 |
# { |
| 722 |
# "pvst": "tunnel" |
| 723 |
# } |
| 724 |
# ], |
| 725 |
# "l2transport": true, |
| 726 |
# "name": "GigabitEthernet0/0/0/1", |
| 727 |
# "native_vlan": 10, |
| 728 |
# "propagate": true |
| 729 |
# }, |
| 730 |
# { |
| 731 |
# "name": "GigabitEthernet0/0/0/3" |
| 732 |
# }, |
| 733 |
# { |
| 734 |
# "name": "GigabitEthernet0/0/0/3.900", |
| 735 |
# "q_vlan": [ |
| 736 |
# 20, |
| 737 |
# 40 |
| 738 |
# ] |
| 739 |
# }, |
| 740 |
# { |
| 741 |
# "name": "GigabitEthernet0/0/0/4", |
| 742 |
# "native_vlan": 40 |
| 743 |
# } |
| 744 |
# ] |
| 745 |
|
| 746 |
|
| 747 |
# Using rendered |
| 748 |
- name: Render platform specific commands from task input using rendered state |
| 749 |
cisco.iosxr.iosxr_l2_interfaces: |
| 750 |
config: |
| 751 |
- name: GigabitEthernet0/0/0/1 |
| 752 |
native_vlan: 10 |
| 753 |
l2transport: true |
| 754 |
l2protocol: |
| 755 |
- pvst: tunnel |
| 756 |
- cdp: forward |
| 757 |
propagate: true |
| 758 |
- name: GigabitEthernet0/0/0/3.900 |
| 759 |
q_vlan: |
| 760 |
- 20 |
| 761 |
- 40 |
| 762 |
- name: GigabitEthernet0/0/0/4 |
| 763 |
native_vlan: 40 |
| 764 |
state: rendered |
| 765 |
|
| 766 |
# Task Output (redacted) |
| 767 |
# ----------------------- |
| 768 |
# "rendered": [ |
| 769 |
# "interface GigabitEthernet0/0/0/1", |
| 770 |
# "dot1q native vlan 10", |
| 771 |
# "l2transport l2protocol pvst tunnel", |
| 772 |
# "l2transport l2protocol cdp forward", |
| 773 |
# "l2transport propagate remote-status", |
| 774 |
# "interface GigabitEthernet0/0/0/3.900", |
| 775 |
# "dot1q vlan 20 40", |
| 776 |
# "interface GigabitEthernet0/0/0/4", |
| 777 |
# "dot1q native vlan 40" |
| 778 |
# ] |
| 779 |
|
| 780 |
|
| 781 |
# Using gathered |
| 782 |
# Before state: |
| 783 |
# ------------ |
| 784 |
# |
| 785 |
# RP/0/0/CPU0:an-iosxr-02#show running-config interface |
| 786 |
# interface Loopback888 |
| 787 |
# description test for ansible |
| 788 |
# shutdown |
| 789 |
# ! |
| 790 |
# interface MgmtEth0/0/CPU0/0 |
| 791 |
# ipv4 address 10.8.38.70 255.255.255.0 |
| 792 |
# ! |
| 793 |
# interface GigabitEthernet0/0/0/0 |
| 794 |
# description Configured and Merged by Ansible-Network |
| 795 |
# mtu 110 |
| 796 |
# ipv4 address 172.31.1.1 255.255.255.0 |
| 797 |
# duplex half |
| 798 |
# ! |
| 799 |
# interface GigabitEthernet0/0/0/1 |
| 800 |
# dot1q native vlan 10 |
| 801 |
# l2transport |
| 802 |
# l2protocol cdp forward |
| 803 |
# l2protocol pvst tunnel |
| 804 |
# propagate remote-status |
| 805 |
# ! |
| 806 |
# ! |
| 807 |
# interface GigabitEthernet0/0/0/3 |
| 808 |
# shutdown |
| 809 |
# ! |
| 810 |
# interface GigabitEthernet0/0/0/3.900 |
| 811 |
# encapsulation dot1q 20 second-dot1q 40 |
| 812 |
# ! |
| 813 |
# interface GigabitEthernet0/0/0/4 |
| 814 |
# shutdown |
| 815 |
# dot1q native vlan 40 |
| 816 |
# ! |
| 817 |
- name: Gather IOSXR l2 interfaces as in given arguments |
| 818 |
cisco.iosxr.iosxr_l2_interfaces: |
| 819 |
config: |
| 820 |
state: gathered |
| 821 |
# Task Output (redacted) |
| 822 |
# ----------------------- |
| 823 |
# |
| 824 |
# "gathered": [ |
| 825 |
# { |
| 826 |
# "name": "GigabitEthernet0/0/0/0" |
| 827 |
# }, |
| 828 |
# { |
| 829 |
# "l2protocol": [ |
| 830 |
# { |
| 831 |
# "cdp": "forward" |
| 832 |
# }, |
| 833 |
# { |
| 834 |
# "pvst": "tunnel" |
| 835 |
# } |
| 836 |
# ], |
| 837 |
# "l2transport": true, |
| 838 |
# "name": "GigabitEthernet0/0/0/1", |
| 839 |
# "native_vlan": 10, |
| 840 |
# "propagate": true |
| 841 |
# }, |
| 842 |
# { |
| 843 |
# "name": "GigabitEthernet0/0/0/3" |
| 844 |
# }, |
| 845 |
# { |
| 846 |
# "name": "GigabitEthernet0/0/0/3.900", |
| 847 |
# "q_vlan": [ |
| 848 |
# 20, |
| 849 |
# 40 |
| 850 |
# ] |
| 851 |
# }, |
| 852 |
# { |
| 853 |
# "name": "GigabitEthernet0/0/0/4", |
| 854 |
# "native_vlan": 40 |
| 855 |
# } |
| 856 |
# ] |
| 857 |
# After state: |
| 858 |
# ------------ |
| 859 |
# |
| 860 |
# RP/0/0/CPU0:an-iosxr-02#show running-config interface |
| 861 |
# interface Loopback888 |
| 862 |
# description test for ansible |
| 863 |
# shutdown |
| 864 |
# ! |
| 865 |
# interface MgmtEth0/0/CPU0/0 |
| 866 |
# ipv4 address 10.8.38.70 255.255.255.0 |
| 867 |
# ! |
| 868 |
# interface GigabitEthernet0/0/0/0 |
| 869 |
# description Configured and Merged by Ansible-Network |
| 870 |
# mtu 110 |
| 871 |
# ipv4 address 172.31.1.1 255.255.255.0 |
| 872 |
# duplex half |
| 873 |
# ! |
| 874 |
# interface GigabitEthernet0/0/0/1 |
| 875 |
# dot1q native vlan 10 |
| 876 |
# l2transport |
| 877 |
# l2protocol cdp forward |
| 878 |
# l2protocol pvst tunnel |
| 879 |
# propagate remote-status |
| 880 |
# ! |
| 881 |
# ! |
| 882 |
# interface GigabitEthernet0/0/0/3 |
| 883 |
# shutdown |
| 884 |
# ! |
| 885 |
# interface GigabitEthernet0/0/0/3.900 |
| 886 |
# encapsulation dot1q 20 second-dot1q 40 |
| 887 |
# ! |
| 888 |
# interface GigabitEthernet0/0/0/4 |
| 889 |
# shutdown |
| 890 |
# dot1q native vlan 40 |
| 891 |
# ! |
| 892 |
|
| 893 |
|
| 894 |
|
| 895 |
Return Values |
| 896 |
------------- |
| 897 |
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: |
| 898 |
|
| 899 |
.. raw:: html |
| 900 |
|
| 901 |
<table border=0 cellpadding=0 class="documentation-table"> |
| 902 |
<tr> |
| 903 |
<th colspan="1">Key</th> |
| 904 |
<th>Returned</th> |
| 905 |
<th width="100%">Description</th> |
| 906 |
</tr> |
| 907 |
<tr> |
| 908 |
<td colspan="1"> |
| 909 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 910 |
<b>after</b> |
| 911 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 912 |
<div style="font-size: small"> |
| 913 |
<span style="color: purple">list</span> |
| 914 |
</div> |
| 915 |
</td> |
| 916 |
<td>when changed</td> |
| 917 |
<td> |
| 918 |
<div>The configuration as structured data after module completion.</div> |
| 919 |
<br/> |
| 920 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 921 |
<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> |
| 922 |
</td> |
| 923 |
</tr> |
| 924 |
<tr> |
| 925 |
<td colspan="1"> |
| 926 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 927 |
<b>before</b> |
| 928 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 929 |
<div style="font-size: small"> |
| 930 |
<span style="color: purple">list</span> |
| 931 |
</div> |
| 932 |
</td> |
| 933 |
<td>always</td> |
| 934 |
<td> |
| 935 |
<div>The configuration as structured data prior to module invocation.</div> |
| 936 |
<br/> |
| 937 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 938 |
<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> |
| 939 |
</td> |
| 940 |
</tr> |
| 941 |
<tr> |
| 942 |
<td colspan="1"> |
| 943 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 944 |
<b>commands</b> |
| 945 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 946 |
<div style="font-size: small"> |
| 947 |
<span style="color: purple">list</span> |
| 948 |
</div> |
| 949 |
</td> |
| 950 |
<td>always</td> |
| 951 |
<td> |
| 952 |
<div>The set of commands pushed to the remote device</div> |
| 953 |
<br/> |
| 954 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 955 |
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['interface GigabitEthernet0/0/0/2', 'l2transport l2protocol pvst tunnel']</div> |
| 956 |
</td> |
| 957 |
</tr> |
| 958 |
</table> |
| 959 |
<br/><br/> |
| 960 |
|
| 961 |
|
| 962 |
Status |
| 963 |
------ |
| 964 |
|
| 965 |
|
| 966 |
Authors |
| 967 |
~~~~~~~ |
| 968 |
|
| 969 |
- Sumit Jaiswal (@justjais) |
| 970 |
- Rohit Thakur (@rohitthakur2590) |