| 1 |
.. _cisco.nxos.nxos_vrf_module: |
| 2 |
|
| 3 |
|
| 4 |
******************* |
| 5 |
cisco.nxos.nxos_vrf |
| 6 |
******************* |
| 7 |
|
| 8 |
**(deprecated, removed after 2026-07-25) Manages global VRF configuration.** |
| 9 |
|
| 10 |
|
| 11 |
Version added: 1.0.0 |
| 12 |
|
| 13 |
.. contents:: |
| 14 |
:local: |
| 15 |
:depth: 1 |
| 16 |
|
| 17 |
|
| 18 |
Synopsis |
| 19 |
-------- |
| 20 |
- This module provides declarative management of VRFs on CISCO NXOS network 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="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>admin_state</b> |
| 40 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 41 |
<div style="font-size: small"> |
| 42 |
<span style="color: purple">string</span> |
| 43 |
</div> |
| 44 |
</td> |
| 45 |
<td> |
| 46 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 47 |
<li><div style="color: blue"><b>up</b> ←</div></li> |
| 48 |
<li>down</li> |
| 49 |
</ul> |
| 50 |
</td> |
| 51 |
<td> |
| 52 |
<div>Administrative state of the VRF.</div> |
| 53 |
</td> |
| 54 |
</tr> |
| 55 |
<tr> |
| 56 |
<td colspan="2"> |
| 57 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 58 |
<b>aggregate</b> |
| 59 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 60 |
<div style="font-size: small"> |
| 61 |
<span style="color: purple">list</span> |
| 62 |
/ <span style="color: purple">elements=dictionary</span> |
| 63 |
</div> |
| 64 |
</td> |
| 65 |
<td> |
| 66 |
</td> |
| 67 |
<td> |
| 68 |
<div>List of VRFs definitions.</div> |
| 69 |
</td> |
| 70 |
</tr> |
| 71 |
<tr> |
| 72 |
<td class="elbow-placeholder"></td> |
| 73 |
<td colspan="1"> |
| 74 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 75 |
<b>admin_state</b> |
| 76 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 77 |
<div style="font-size: small"> |
| 78 |
<span style="color: purple">string</span> |
| 79 |
</div> |
| 80 |
</td> |
| 81 |
<td> |
| 82 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 83 |
<li>up</li> |
| 84 |
<li>down</li> |
| 85 |
</ul> |
| 86 |
</td> |
| 87 |
<td> |
| 88 |
<div>Administrative state of the VRF.</div> |
| 89 |
</td> |
| 90 |
</tr> |
| 91 |
<tr> |
| 92 |
<td class="elbow-placeholder"></td> |
| 93 |
<td colspan="1"> |
| 94 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 95 |
<b>associated_interfaces</b> |
| 96 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 97 |
<div style="font-size: small"> |
| 98 |
<span style="color: purple">list</span> |
| 99 |
/ <span style="color: purple">elements=string</span> |
| 100 |
</div> |
| 101 |
</td> |
| 102 |
<td> |
| 103 |
</td> |
| 104 |
<td> |
| 105 |
<div>This is a intent option and checks the operational state of the for given vrf <code>name</code> for associated interfaces. If the value in the <code>associated_interfaces</code> does not match with the operational state of vrf interfaces on device it will result in failure.</div> |
| 106 |
</td> |
| 107 |
</tr> |
| 108 |
<tr> |
| 109 |
<td class="elbow-placeholder"></td> |
| 110 |
<td colspan="1"> |
| 111 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 112 |
<b>delay</b> |
| 113 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 114 |
<div style="font-size: small"> |
| 115 |
<span style="color: purple">integer</span> |
| 116 |
</div> |
| 117 |
</td> |
| 118 |
<td> |
| 119 |
</td> |
| 120 |
<td> |
| 121 |
<div>Time in seconds to wait before checking for the operational state on remote device. This wait is applicable for operational state arguments.</div> |
| 122 |
</td> |
| 123 |
</tr> |
| 124 |
<tr> |
| 125 |
<td class="elbow-placeholder"></td> |
| 126 |
<td colspan="1"> |
| 127 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 128 |
<b>description</b> |
| 129 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 130 |
<div style="font-size: small"> |
| 131 |
<span style="color: purple">string</span> |
| 132 |
</div> |
| 133 |
</td> |
| 134 |
<td> |
| 135 |
</td> |
| 136 |
<td> |
| 137 |
<div>Description of the VRF or keyword 'default'.</div> |
| 138 |
</td> |
| 139 |
</tr> |
| 140 |
<tr> |
| 141 |
<td class="elbow-placeholder"></td> |
| 142 |
<td colspan="1"> |
| 143 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 144 |
<b>interfaces</b> |
| 145 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 146 |
<div style="font-size: small"> |
| 147 |
<span style="color: purple">list</span> |
| 148 |
/ <span style="color: purple">elements=string</span> |
| 149 |
</div> |
| 150 |
</td> |
| 151 |
<td> |
| 152 |
</td> |
| 153 |
<td> |
| 154 |
<div>List of interfaces to check the VRF has been configured correctly or keyword 'default'.</div> |
| 155 |
</td> |
| 156 |
</tr> |
| 157 |
<tr> |
| 158 |
<td class="elbow-placeholder"></td> |
| 159 |
<td colspan="1"> |
| 160 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 161 |
<b>name</b> |
| 162 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 163 |
<div style="font-size: small"> |
| 164 |
<span style="color: purple">string</span> |
| 165 |
</div> |
| 166 |
</td> |
| 167 |
<td> |
| 168 |
</td> |
| 169 |
<td> |
| 170 |
<div>Name of VRF to be managed.</div> |
| 171 |
<div style="font-size: small; color: darkgreen"><br/>aliases: vrf</div> |
| 172 |
</td> |
| 173 |
</tr> |
| 174 |
<tr> |
| 175 |
<td class="elbow-placeholder"></td> |
| 176 |
<td colspan="1"> |
| 177 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 178 |
<b>rd</b> |
| 179 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 180 |
<div style="font-size: small"> |
| 181 |
<span style="color: purple">string</span> |
| 182 |
</div> |
| 183 |
</td> |
| 184 |
<td> |
| 185 |
</td> |
| 186 |
<td> |
| 187 |
<div>VPN Route Distinguisher (RD). Valid values are a string in one of the route-distinguisher formats (ASN2:NN, ASN4:NN, or IPV4:NN); the keyword 'auto', or the keyword 'default'.</div> |
| 188 |
</td> |
| 189 |
</tr> |
| 190 |
<tr> |
| 191 |
<td class="elbow-placeholder"></td> |
| 192 |
<td colspan="1"> |
| 193 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 194 |
<b>state</b> |
| 195 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 196 |
<div style="font-size: small"> |
| 197 |
<span style="color: purple">string</span> |
| 198 |
</div> |
| 199 |
</td> |
| 200 |
<td> |
| 201 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 202 |
<li>present</li> |
| 203 |
<li>absent</li> |
| 204 |
</ul> |
| 205 |
</td> |
| 206 |
<td> |
| 207 |
<div>Manages desired state of the resource.</div> |
| 208 |
</td> |
| 209 |
</tr> |
| 210 |
<tr> |
| 211 |
<td class="elbow-placeholder"></td> |
| 212 |
<td colspan="1"> |
| 213 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 214 |
<b>vni</b> |
| 215 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 216 |
<div style="font-size: small"> |
| 217 |
<span style="color: purple">string</span> |
| 218 |
</div> |
| 219 |
</td> |
| 220 |
<td> |
| 221 |
</td> |
| 222 |
<td> |
| 223 |
<div>Specify virtual network identifier. Valid values are Integer or keyword 'default'.</div> |
| 224 |
</td> |
| 225 |
</tr> |
| 226 |
|
| 227 |
<tr> |
| 228 |
<td colspan="2"> |
| 229 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 230 |
<b>associated_interfaces</b> |
| 231 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 232 |
<div style="font-size: small"> |
| 233 |
<span style="color: purple">list</span> |
| 234 |
/ <span style="color: purple">elements=string</span> |
| 235 |
</div> |
| 236 |
</td> |
| 237 |
<td> |
| 238 |
</td> |
| 239 |
<td> |
| 240 |
<div>This is a intent option and checks the operational state of the for given vrf <code>name</code> for associated interfaces. If the value in the <code>associated_interfaces</code> does not match with the operational state of vrf interfaces on device it will result in failure.</div> |
| 241 |
</td> |
| 242 |
</tr> |
| 243 |
<tr> |
| 244 |
<td colspan="2"> |
| 245 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 246 |
<b>delay</b> |
| 247 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 248 |
<div style="font-size: small"> |
| 249 |
<span style="color: purple">integer</span> |
| 250 |
</div> |
| 251 |
</td> |
| 252 |
<td> |
| 253 |
<b>Default:</b><br/><div style="color: blue">10</div> |
| 254 |
</td> |
| 255 |
<td> |
| 256 |
<div>Time in seconds to wait before checking for the operational state on remote device. This wait is applicable for operational state arguments.</div> |
| 257 |
</td> |
| 258 |
</tr> |
| 259 |
<tr> |
| 260 |
<td colspan="2"> |
| 261 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 262 |
<b>description</b> |
| 263 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 264 |
<div style="font-size: small"> |
| 265 |
<span style="color: purple">string</span> |
| 266 |
</div> |
| 267 |
</td> |
| 268 |
<td> |
| 269 |
</td> |
| 270 |
<td> |
| 271 |
<div>Description of the VRF or keyword 'default'.</div> |
| 272 |
</td> |
| 273 |
</tr> |
| 274 |
<tr> |
| 275 |
<td colspan="2"> |
| 276 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 277 |
<b>interfaces</b> |
| 278 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 279 |
<div style="font-size: small"> |
| 280 |
<span style="color: purple">list</span> |
| 281 |
/ <span style="color: purple">elements=string</span> |
| 282 |
</div> |
| 283 |
</td> |
| 284 |
<td> |
| 285 |
</td> |
| 286 |
<td> |
| 287 |
<div>List of interfaces to check the VRF has been configured correctly or keyword 'default'.</div> |
| 288 |
</td> |
| 289 |
</tr> |
| 290 |
<tr> |
| 291 |
<td colspan="2"> |
| 292 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 293 |
<b>name</b> |
| 294 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 295 |
<div style="font-size: small"> |
| 296 |
<span style="color: purple">string</span> |
| 297 |
</div> |
| 298 |
</td> |
| 299 |
<td> |
| 300 |
</td> |
| 301 |
<td> |
| 302 |
<div>Name of VRF to be managed.</div> |
| 303 |
<div style="font-size: small; color: darkgreen"><br/>aliases: vrf</div> |
| 304 |
</td> |
| 305 |
</tr> |
| 306 |
<tr> |
| 307 |
<td colspan="2"> |
| 308 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 309 |
<b>purge</b> |
| 310 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 311 |
<div style="font-size: small"> |
| 312 |
<span style="color: purple">boolean</span> |
| 313 |
</div> |
| 314 |
</td> |
| 315 |
<td> |
| 316 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 317 |
<li><div style="color: blue"><b>no</b> ←</div></li> |
| 318 |
<li>yes</li> |
| 319 |
</ul> |
| 320 |
</td> |
| 321 |
<td> |
| 322 |
<div>Purge VRFs not defined in the <em>aggregate</em> parameter.</div> |
| 323 |
</td> |
| 324 |
</tr> |
| 325 |
<tr> |
| 326 |
<td colspan="2"> |
| 327 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 328 |
<b>rd</b> |
| 329 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 330 |
<div style="font-size: small"> |
| 331 |
<span style="color: purple">string</span> |
| 332 |
</div> |
| 333 |
</td> |
| 334 |
<td> |
| 335 |
</td> |
| 336 |
<td> |
| 337 |
<div>VPN Route Distinguisher (RD). Valid values are a string in one of the route-distinguisher formats (ASN2:NN, ASN4:NN, or IPV4:NN); the keyword 'auto', or the keyword 'default'.</div> |
| 338 |
</td> |
| 339 |
</tr> |
| 340 |
<tr> |
| 341 |
<td colspan="2"> |
| 342 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 343 |
<b>state</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 |
<ul style="margin: 0; padding: 0"><b>Choices:</b> |
| 351 |
<li><div style="color: blue"><b>present</b> ←</div></li> |
| 352 |
<li>absent</li> |
| 353 |
</ul> |
| 354 |
</td> |
| 355 |
<td> |
| 356 |
<div>Manages desired state of the resource.</div> |
| 357 |
</td> |
| 358 |
</tr> |
| 359 |
<tr> |
| 360 |
<td colspan="2"> |
| 361 |
<div class="ansibleOptionAnchor" id="parameter-"></div> |
| 362 |
<b>vni</b> |
| 363 |
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> |
| 364 |
<div style="font-size: small"> |
| 365 |
<span style="color: purple">string</span> |
| 366 |
</div> |
| 367 |
</td> |
| 368 |
<td> |
| 369 |
</td> |
| 370 |
<td> |
| 371 |
<div>Specify virtual network identifier. Valid values are Integer or keyword 'default'.</div> |
| 372 |
</td> |
| 373 |
</tr> |
| 374 |
</table> |
| 375 |
<br/> |
| 376 |
|
| 377 |
|
| 378 |
Notes |
| 379 |
----- |
| 380 |
|
| 381 |
.. note:: |
| 382 |
- Tested against NXOSv 7.3.(0)D1(1) on VIRL |
| 383 |
- Unsupported for Cisco MDS |
| 384 |
- Cisco NX-OS creates the default VRF by itself. Therefore, you're not allowed to use default as *vrf* name in this module. |
| 385 |
- ``vrf`` name must be shorter than 32 chars. |
| 386 |
- VRF names are not case sensible in NX-OS. Anyway, the name is stored just like it's inserted by the user and it'll not be changed again unless the VRF is removed and re-created. i.e. ``vrf=NTC`` will create a VRF named NTC, but running it again with ``vrf=ntc`` will not cause a configuration change. |
| 387 |
- For information on using CLI and NX-API see the :ref:`NXOS Platform Options guide <nxos_platform_options>` |
| 388 |
- For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide <network_guide>` |
| 389 |
- For more information on using Ansible to manage Cisco devices see the `Cisco integration page <https://www.ansible.com/integrations/networks/cisco>`_. |
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
Examples |
| 394 |
-------- |
| 395 |
|
| 396 |
.. code-block:: yaml |
| 397 |
|
| 398 |
- name: Ensure ntc VRF exists on switch |
| 399 |
cisco.nxos.nxos_vrf: |
| 400 |
name: ntc |
| 401 |
description: testing |
| 402 |
state: present |
| 403 |
- name: Aggregate definition of VRFs |
| 404 |
cisco.nxos.nxos_vrf: |
| 405 |
aggregate: |
| 406 |
- name: test1 |
| 407 |
description: Testing |
| 408 |
admin_state: down |
| 409 |
- name: test2 |
| 410 |
interfaces: Ethernet1/2 |
| 411 |
- name: Aggregate definitions of VRFs with Purge |
| 412 |
cisco.nxos.nxos_vrf: |
| 413 |
aggregate: |
| 414 |
- name: ntc1 |
| 415 |
description: purge test1 |
| 416 |
- name: ntc2 |
| 417 |
description: purge test2 |
| 418 |
state: present |
| 419 |
purge: true |
| 420 |
- name: Delete VRFs exist on switch |
| 421 |
cisco.nxos.nxos_vrf: |
| 422 |
aggregate: |
| 423 |
- name: ntc1 |
| 424 |
- name: ntc2 |
| 425 |
state: absent |
| 426 |
- name: Assign interfaces to VRF declaratively |
| 427 |
cisco.nxos.nxos_vrf: |
| 428 |
name: test1 |
| 429 |
interfaces: |
| 430 |
- Ethernet2/3 |
| 431 |
- Ethernet2/5 |
| 432 |
- name: Check interfaces assigned to VRF |
| 433 |
cisco.nxos.nxos_vrf: |
| 434 |
name: test1 |
| 435 |
associated_interfaces: |
| 436 |
- Ethernet2/3 |
| 437 |
- Ethernet2/5 |
| 438 |
- name: >- |
| 439 |
Ensure VRF is tagged with interface Ethernet2/5 only (Removes from |
| 440 |
Ethernet2/3) |
| 441 |
cisco.nxos.nxos_vrf: |
| 442 |
name: test1 |
| 443 |
interfaces: |
| 444 |
- Ethernet2/5 |
| 445 |
- name: Delete VRF |
| 446 |
cisco.nxos.nxos_vrf: |
| 447 |
name: ntc |
| 448 |
state: absent |
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
Return Values |
| 453 |
------------- |
| 454 |
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: |
| 455 |
|
| 456 |
.. raw:: html |
| 457 |
|
| 458 |
<table border=0 cellpadding=0 class="documentation-table"> |
| 459 |
<tr> |
| 460 |
<th colspan="1">Key</th> |
| 461 |
<th>Returned</th> |
| 462 |
<th width="100%">Description</th> |
| 463 |
</tr> |
| 464 |
<tr> |
| 465 |
<td colspan="1"> |
| 466 |
<div class="ansibleOptionAnchor" id="return-"></div> |
| 467 |
<b>commands</b> |
| 468 |
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> |
| 469 |
<div style="font-size: small"> |
| 470 |
<span style="color: purple">list</span> |
| 471 |
</div> |
| 472 |
</td> |
| 473 |
<td>always</td> |
| 474 |
<td> |
| 475 |
<div>commands sent to the device</div> |
| 476 |
<br/> |
| 477 |
<div style="font-size: smaller"><b>Sample:</b></div> |
| 478 |
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['vrf context ntc', 'no shutdown', 'interface Ethernet1/2', 'no switchport', 'vrf member test2']</div> |
| 479 |
</td> |
| 480 |
</tr> |
| 481 |
</table> |
| 482 |
<br/><br/> |
| 483 |
|
| 484 |
|
| 485 |
Status |
| 486 |
------ |
| 487 |
|
| 488 |
|
| 489 |
Authors |
| 490 |
~~~~~~~ |
| 491 |
|
| 492 |
- Jason Edelman (@jedelman8) |
| 493 |
- Gabriele Gerbino (@GGabriele) |
| 494 |
- Trishna Guha (@trishnaguha) |