| 1 |
.. _cisco.nxos.nxos_lag_interfaces_module: |
| 2 |
|
| 3 |
|
| 4 |
****************************** |
| 5 |
cisco.nxos.nxos_lag_interfaces |
| 6 |
****************************** |
| 7 |
|
| 8 |
**LAG 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 attributes of link aggregation groups 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="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 list of link aggregation group configurations.</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>members</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>The list of interfaces that are part of the group.</div> |
| 67 |
</td> |
| 68 |
</tr> |
| 69 |
<tr> |
| 70 |
<td class="elbow-placeholder"></td> |
| 71 |
<td class="elbow-placeholder"></td> |
| 72 |
<td colspan="1"> |
| 73 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 74 |
<b>force</b> |
| 75 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 76 |
<div style="font-size: small"> |
| 77 |
<span style="color: purple">boolean</span> |
| 78 |
</div> |
| 79 |
</td> |
| 80 |
<td> |
| 81 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 82 |
<li>no</li> |
| 83 |
<li>yes</li> |
| 84 |
</ul> |
| 85 |
</td> |
| 86 |
<td> |
| 87 |
<div>When true it forces link aggregation group members to match what is declared in the members param. This can be used to remove members.</div> |
| 88 |
</td> |
| 89 |
</tr> |
| 90 |
<tr> |
| 91 |
<td class="elbow-placeholder"></td> |
| 92 |
<td class="elbow-placeholder"></td> |
| 93 |
<td colspan="1"> |
| 94 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 95 |
<b>member</b> |
| 96 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 97 |
<div style="font-size: small"> |
| 98 |
<span style="color: purple">string</span> |
| 99 |
</div> |
| 100 |
</td> |
| 101 |
<td> |
| 102 |
</td> |
| 103 |
<td> |
| 104 |
<div>The interface name.</div> |
| 105 |
</td> |
| 106 |
</tr> |
| 107 |
<tr> |
| 108 |
<td class="elbow-placeholder"></td> |
| 109 |
<td class="elbow-placeholder"></td> |
| 110 |
<td colspan="1"> |
| 111 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 112 |
<b>mode</b> |
| 113 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 114 |
<div style="font-size: small"> |
| 115 |
<span style="color: purple">string</span> |
| 116 |
</div> |
| 117 |
</td> |
| 118 |
<td> |
| 119 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 120 |
<li>active</li> |
| 121 |
<li>on</li> |
| 122 |
<li>passive</li> |
| 123 |
</ul> |
| 124 |
</td> |
| 125 |
<td> |
| 126 |
<div>Link aggregation group (LAG).</div> |
| 127 |
</td> |
| 128 |
</tr> |
| 129 |
|
| 130 |
<tr> |
| 131 |
<td class="elbow-placeholder"></td> |
| 132 |
<td colspan="2"> |
| 133 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 134 |
<b>name</b> |
| 135 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 136 |
<div style="font-size: small"> |
| 137 |
<span style="color: purple">string</span> |
| 138 |
/ <span style="color: red">required</span> |
| 139 |
</div> |
| 140 |
</td> |
| 141 |
<td> |
| 142 |
</td> |
| 143 |
<td> |
| 144 |
<div>Name of the link aggregation group (LAG).</div> |
| 145 |
</td> |
| 146 |
</tr> |
| 147 |
|
| 148 |
<tr> |
| 149 |
<td colspan="3"> |
| 150 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 151 |
<b>running_config</b> |
| 152 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 153 |
<div style="font-size: small"> |
| 154 |
<span style="color: purple">string</span> |
| 155 |
</div> |
| 156 |
</td> |
| 157 |
<td> |
| 158 |
</td> |
| 159 |
<td> |
| 160 |
<div>This option is used only with state <em>parsed</em>.</div> |
| 161 |
<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> |
| 162 |
<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> |
| 163 |
</td> |
| 164 |
</tr> |
| 165 |
<tr> |
| 166 |
<td colspan="3"> |
| 167 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 168 |
<b>state</b> |
| 169 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 170 |
<div style="font-size: small"> |
| 171 |
<span style="color: purple">string</span> |
| 172 |
</div> |
| 173 |
</td> |
| 174 |
<td> |
| 175 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 176 |
<li><div style="color: blue"><b>merged</b> ←</div></li> |
| 177 |
<li>replaced</li> |
| 178 |
<li>overridden</li> |
| 179 |
<li>deleted</li> |
| 180 |
<li>gathered</li> |
| 181 |
<li>rendered</li> |
| 182 |
<li>parsed</li> |
| 183 |
</ul> |
| 184 |
</td> |
| 185 |
<td> |
| 186 |
<div>The state of the configuration after module completion.</div> |
| 187 |
</td> |
| 188 |
</tr> |
| 189 |
</table> |
| 190 |
<br/> |
| 191 |
|
| 192 |
|
| 193 |
Notes |
| 194 |
----- |
| 195 |
|
| 196 |
.. note:: |
| 197 |
- Tested against NXOS 7.3.(0)D1(1) on VIRL. |
| 198 |
- Unsupported for Cisco MDS |
| 199 |
- This module works with connection ``network_cli``. |
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
Examples |
| 204 |
-------- |
| 205 |
|
| 206 |
.. code-block:: yaml |
| 207 |
|
| 208 |
# Using merged |
| 209 |
|
| 210 |
# Before state: |
| 211 |
# ------------- |
| 212 |
# |
| 213 |
# interface Ethernet1/4 |
| 214 |
|
| 215 |
- name: Merge provided configuration with device configuration. |
| 216 |
cisco.nxos.nxos_lag_interfaces: |
| 217 |
config: |
| 218 |
- name: port-channel99 |
| 219 |
members: |
| 220 |
- member: Ethernet1/4 |
| 221 |
state: merged |
| 222 |
|
| 223 |
# After state: |
| 224 |
# ------------ |
| 225 |
# |
| 226 |
# interface Ethernet1/4 |
| 227 |
# channel-group 99 |
| 228 |
|
| 229 |
|
| 230 |
# Using replaced |
| 231 |
|
| 232 |
# Before state: |
| 233 |
# ------------- |
| 234 |
# |
| 235 |
# interface Ethernet1/4 |
| 236 |
# channel-group 99 mode active |
| 237 |
|
| 238 |
- name: Replace device configuration of specified LAG attributes of given interfaces |
| 239 |
with provided configuration. |
| 240 |
cisco.nxos.nxos_lag_interfaces: |
| 241 |
config: |
| 242 |
- name: port-channel10 |
| 243 |
members: |
| 244 |
- member: Ethernet1/4 |
| 245 |
state: replaced |
| 246 |
|
| 247 |
# After state: |
| 248 |
# ------------ |
| 249 |
# |
| 250 |
# interface Ethernet1/4 |
| 251 |
# channel-group 10 |
| 252 |
|
| 253 |
|
| 254 |
# Using overridden |
| 255 |
|
| 256 |
# Before state: |
| 257 |
# ------------- |
| 258 |
# |
| 259 |
# interface Ethernet1/4 |
| 260 |
# channel-group 10 |
| 261 |
# interface Ethernet1/2 |
| 262 |
# channel-group 99 mode passive |
| 263 |
|
| 264 |
- name: Override device configuration of all LAG attributes of given interfaces on |
| 265 |
device with provided configuration. |
| 266 |
cisco.nxos.nxos_lag_interfaces: |
| 267 |
config: |
| 268 |
- name: port-channel20 |
| 269 |
members: |
| 270 |
- member: Ethernet1/6 |
| 271 |
force: true |
| 272 |
state: overridden |
| 273 |
|
| 274 |
# After state: |
| 275 |
# ------------ |
| 276 |
# interface Ethernet1/2 |
| 277 |
# interface Ethernet1/4 |
| 278 |
# interface Ethernet1/6 |
| 279 |
# channel-group 20 force |
| 280 |
|
| 281 |
|
| 282 |
# Using deleted |
| 283 |
|
| 284 |
# Before state: |
| 285 |
# ------------- |
| 286 |
# |
| 287 |
# interface Ethernet1/4 |
| 288 |
# channel-group 99 mode active |
| 289 |
|
| 290 |
- name: Delete LAG attributes of given interface (This won't delete the port-channel |
| 291 |
itself). |
| 292 |
cisco.nxos.nxos_lag_interfaces: |
| 293 |
config: |
| 294 |
- port-channel: port-channel99 |
| 295 |
state: deleted |
| 296 |
|
| 297 |
- name: Delete LAG attributes of all the interfaces |
| 298 |
cisco.nxos.nxos_lag_interfaces: |
| 299 |
state: deleted |
| 300 |
|
| 301 |
# After state: |
| 302 |
# ------------ |
| 303 |
# |
| 304 |
# interface Ethernet1/4 |
| 305 |
# no channel-group 99 |
| 306 |
|
| 307 |
# Using rendered |
| 308 |
|
| 309 |
- name: Use rendered state to convert task input to device specific commands |
| 310 |
cisco.nxos.nxos_lag_interfaces: |
| 311 |
config: |
| 312 |
- name: port-channel10 |
| 313 |
members: |
| 314 |
- member: Ethernet1/800 |
| 315 |
mode: active |
| 316 |
- member: Ethernet1/801 |
| 317 |
- name: port-channel11 |
| 318 |
members: |
| 319 |
- member: Ethernet1/802 |
| 320 |
mode: passive |
| 321 |
state: rendered |
| 322 |
|
| 323 |
# Task Output (redacted) |
| 324 |
# ----------------------- |
| 325 |
|
| 326 |
# rendered: |
| 327 |
# - "interface Ethernet1/800" |
| 328 |
# - "channel-group 10 mode active" |
| 329 |
# - "interface Ethernet1/801" |
| 330 |
# - "channel-group 10" |
| 331 |
# - "interface Ethernet1/802" |
| 332 |
# - "channel-group 11 mode passive" |
| 333 |
|
| 334 |
# Using parsed |
| 335 |
|
| 336 |
# parsed.cfg |
| 337 |
# ------------ |
| 338 |
|
| 339 |
# interface port-channel10 |
| 340 |
# interface port-channel11 |
| 341 |
# interface port-channel12 |
| 342 |
# interface Ethernet1/800 |
| 343 |
# channel-group 10 mode active |
| 344 |
# interface Ethernet1/801 |
| 345 |
# channel-group 10 mode active |
| 346 |
# interface Ethernet1/802 |
| 347 |
# channel-group 11 mode passive |
| 348 |
# interface Ethernet1/803 |
| 349 |
# channel-group 11 mode passive |
| 350 |
|
| 351 |
- name: Use parsed state to convert externally supplied config to structured format |
| 352 |
cisco.nxos.nxos_lag_interfaces: |
| 353 |
running_config: "{{ lookup('file', 'parsed.cfg') }}" |
| 354 |
state: parsed |
| 355 |
|
| 356 |
# Task output (redacted) |
| 357 |
# ----------------------- |
| 358 |
|
| 359 |
# parsed: |
| 360 |
# - members: |
| 361 |
# - member: Ethernet1/800 |
| 362 |
# mode: active |
| 363 |
# - member: Ethernet1/801 |
| 364 |
# mode: active |
| 365 |
# name: port-channel10 |
| 366 |
# |
| 367 |
# - members: |
| 368 |
# - member: Ethernet1/802 |
| 369 |
# mode: passive |
| 370 |
# - member: Ethernet1/803 |
| 371 |
# mode: passive |
| 372 |
# name: port-channel11 |
| 373 |
# |
| 374 |
# - name: port-channel12 |
| 375 |
|
| 376 |
# Using gathered |
| 377 |
|
| 378 |
# Existing device config state |
| 379 |
# ------------------------------- |
| 380 |
# interface port-channel10 |
| 381 |
# interface port-channel11 |
| 382 |
# interface Ethernet1/1 |
| 383 |
# channel-group 10 mode active |
| 384 |
# interface Ethernet1/2 |
| 385 |
# channel-group 11 mode passive |
| 386 |
# |
| 387 |
|
| 388 |
- name: Gather lag_interfaces facts from the device using nxos_lag_interfaces |
| 389 |
cisco.nxos.nxos_lag_interfaces: |
| 390 |
state: gathered |
| 391 |
|
| 392 |
# Task output (redacted) |
| 393 |
# ----------------------- |
| 394 |
# gathered: |
| 395 |
# - name: port-channel10 |
| 396 |
# members: |
| 397 |
# - member: Ethernet1/1 |
| 398 |
# mode: active |
| 399 |
# - name: port-channel11 |
| 400 |
# members: |
| 401 |
# - member: Ethernet1/2 |
| 402 |
# mode: passive |
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
Return Values |
| 407 |
------------- |
| 408 |
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: |
| 409 |
|
| 410 |
.. raw:: html |
| 411 |
|
| 412 |
<table border=0 cellpadding=0 class="documentation-table"> |
| 413 |
<tr> |
| 414 |
<th colspan="1">Key</th> |
| 415 |
<th>Returned</th> |
| 416 |
<th width="100%">Description</th> |
| 417 |
</tr> |
| 418 |
<tr> |
| 419 |
<td colspan="1"> |
| 420 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 421 |
<b>after</b> |
| 422 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 423 |
<div style="font-size: small"> |
| 424 |
<span style="color: purple">list</span> |
| 425 |
</div> |
| 426 |
</td> |
| 427 |
<td>when changed</td> |
| 428 |
<td> |
| 429 |
<div>The configuration as structured data after module completion.</div> |
| 430 |
<br/> |
| 431 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 432 |
<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 |
| 433 |
of the parameters above.</div> |
| 434 |
</td> |
| 435 |
</tr> |
| 436 |
<tr> |
| 437 |
<td colspan="1"> |
| 438 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 439 |
<b>before</b> |
| 440 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 441 |
<div style="font-size: small"> |
| 442 |
<span style="color: purple">list</span> |
| 443 |
</div> |
| 444 |
</td> |
| 445 |
<td>always</td> |
| 446 |
<td> |
| 447 |
<div>The configuration as structured data prior to module invocation.</div> |
| 448 |
<br/> |
| 449 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 450 |
<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 |
| 451 |
of the parameters above.</div> |
| 452 |
</td> |
| 453 |
</tr> |
| 454 |
<tr> |
| 455 |
<td colspan="1"> |
| 456 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 457 |
<b>commands</b> |
| 458 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 459 |
<div style="font-size: small"> |
| 460 |
<span style="color: purple">list</span> |
| 461 |
</div> |
| 462 |
</td> |
| 463 |
<td>always</td> |
| 464 |
<td> |
| 465 |
<div>The set of commands pushed to the remote device.</div> |
| 466 |
<br/> |
| 467 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 468 |
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['interface Ethernet1/800', 'channel-group 10 mode active', 'interface Ethernet1/801', 'channel-group 10', 'interface Ethernet1/802', 'channel-group 11 mode passive']</div> |
| 469 |
</td> |
| 470 |
</tr> |
| 471 |
</table> |
| 472 |
<br/><br/> |
| 473 |
|
| 474 |
|
| 475 |
Status |
| 476 |
------ |
| 477 |
|
| 478 |
|
| 479 |
Authors |
| 480 |
~~~~~~~ |
| 481 |
|
| 482 |
- Trishna Guha (@trishnaguha) |
| 483 |
- Nilashish Chakraborty (@NilashishC) |