nxos_vlans – Create VLAN and manage VLAN configurations on NX-OS Interfaces
New in version 2.9.
Synopsis
- This module creates and manages VLAN configurations on Cisco NX-OS Interfaces.
Parameters
| Parameter | Choices/Defaults | Comments | |
|---|---|---|---|
| config list | A dictionary of Vlan options | ||
| enabled boolean |
| Manage administrative state of the vlan. | |
| mapped_vni integer | The Virtual Network Identifier (VNI) ID that is mapped to the VLAN. | ||
| mode string |
| Set vlan mode to classical ethernet or fabricpath. This is a valid option for Nexus 5000, 6000 and 7000 series. | |
| name string | Name of VLAN. | ||
| state string |
| Manage operational state of the vlan. | |
| vlan_id integer / required | Vlan ID. | ||
| state string |
| The state of the configuration after module completion. | |
Notes
Note
- Tested against NXOS 7.3.(0)D1(1) on VIRL
Examples
# Using merged
# Before state:
# -------------
# vlan 1
- name: Merge provided configuration with device configuration.
nxos_vlans:
config:
- vlan_id: 5
name: test-vlan5
- vlan_id: 10
enabled: False
state: merged
# After state:
# ------------
# vlan 5
# name test-vlan5
# state active
# no shutdown
# vlan 10
# state active
# shutdown
# Using replaced
# Before state:
# -------------
# vlan 1
# vlan 5
# name test-vlan5
# vlan 10
# shutdown
- name: Replace device configuration of specified vlan with provided configuration.
nxos_vlans:
config:
- vlan_id: 5
name: test-vlan
enabled: False
- vlan_id: 10
enabled: False
state: replaced
# After state:
# ------------
# vlan 1
# vlan 5
# name test-vlan
# state active
# shutdown
# vlan 10
# state active
# shutdown
# Using overridden
# Before state:
# -------------
# vlan 1
# vlan 3
# name testing
# vlan 5
# name test-vlan5
# shutdown
# vlan 10
# shutdown
- name: Override device configuration of all vlans with provided configuration.
nxos_vlans:
config:
- vlan_id: 5
name: test-vlan
- vlan_id: 10
state: active
state: overridden
# After state:
# ------------
# vlan 1
# vlan 5
# name test-vlan
# state active
# no shutdown
# vlan 10
# state active
# no shutdown
# Using deleted
# Before state:
# -------------
# vlan 1
# vlan 5
# vlan 10
- name: Delete vlans.
nxos_vlans:
config:
- vlan_id: 5
- vlan_id: 10
state: deleted
# After state:
# ------------
# vlan 1
Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description |
|---|---|---|
| after list | when changed | The configuration as structured data after module completion. Sample: The configuration returned will always be in the same format of the parameters above. |
| before list | always | The configuration as structured data prior to module invocation. Sample: The configuration returned will always be in the same format of the parameters above. |
| commands list | always | The set of commands pushed to the remote device. Sample: ['vlan 5', 'name test-vlan5', 'state suspend'] |
Status
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Network Team. [network]
Red Hat Support
More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.
Authors
- Trishna Guha (@trishnaguha)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.9/modules/nxos_vlans_module.html