cisco.nxos.nxos_vpc_interface module – VPC interface resource module.
Note
This module is part of the cisco.nxos collection (version 14.0.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install cisco.nxos.
To use it in a playbook, specify: cisco.nxos.nxos_vpc_interface.
New in cisco.nxos 1.0.0
Synopsis
This module manages VPC-related interface configuration on Cisco NX-OS devices.
Note
This module has a corresponding action plugin.
Aliases: vpc_interface
Parameters
Parameter |
Comments |
|---|---|
A list of VPC interface configurations. |
|
Full name of the interface (e.g. |
|
When Supported on any interface type. Choices:
|
|
When Mutually exclusive with vpc. Choices:
|
|
VPC ID to assign to this port-channel. Mutually exclusive with peer_link. |
|
This option is used only with state parsed. The value of this option should be the output received from the NX-OS device by executing the command show running-config | section ^interface. The state parsed reads the configuration from |
|
The state the configuration should be left in. Choices:
|
Notes
Note
Tested against NX-OS 10.5(5) on N9K-C93180YC-FX3H.
Unsupported for Cisco MDS.
vpcandpeer_linkare mutually exclusive for a given interface. Supplying both in the sameconfigentry fails the task.Setting
peer_linkororphan_port_suspendtofalseremoves the corresponding line under every state, including merged. Omitting an attribute under merged leaves whatever the device already has.orphan_port_suspendapplies to any interface type, including Ethernet interfaces.This module works with connection
network_cliandhttpapi. See https://docs.ansible.com/ansible/latest/network/user_guide/platform_nxos.htmlThe parsed state reads configuration from
running_configand does not connect to the device.For information on using CLI and NX-API see the NXOS Platform Options guide https://docs.ansible.com/ansible/latest/network/user_guide/platform_nxos.html.
For more information on using Ansible to manage network devices see the Ansible Network Guide https://docs.ansible.com/ansible/latest/network/getting_started/index.html.
For more information on using Ansible to manage Cisco devices see the Cisco integration page https://www.ansible.com/integrations/networks/cisco.
Examples
# Using merged
# Before state:
# -------------
# nxos# show running-config | section ^interface port-channel
# interface port-channel10
# switchport
# interface port-channel20
# switchport
- name: Merge the provided configuration with the existing running configuration
cisco.nxos.nxos_vpc_interface:
config:
- name: port-channel10
vpc: 100
- name: port-channel20
peer_link: true
- name: Ethernet1/3
orphan_port_suspend: true
state: merged
# Task output:
# ------------
# before: []
#
# commands:
# - interface port-channel10
# - vpc 100
# - interface port-channel20
# - vpc peer-link
# - interface Ethernet1/3
# - vpc orphan-port suspend
#
# after:
# - name: Ethernet1/3
# orphan_port_suspend: true
# - name: port-channel10
# vpc: "100"
# - name: port-channel20
# peer_link: true
# After state:
# ------------
# interface port-channel10
# vpc 100
# interface port-channel20
# vpc peer-link
# Using merged to remove an attribute
# Before state:
# -------------
# interface port-channel20
# vpc peer-link
# interface Ethernet1/3
# vpc orphan-port suspend
- name: Remove the peer-link and the orphan-port suspend flag
cisco.nxos.nxos_vpc_interface:
config:
- name: port-channel20
peer_link: false
- name: Ethernet1/3
orphan_port_suspend: false
state: merged
# Task output:
# ------------
# commands:
# - interface port-channel20
# - no vpc peer-link
# - interface Ethernet1/3
# - no vpc orphan-port suspend
# Using replaced
# Before state:
# -------------
# interface port-channel10
# vpc 100
# interface port-channel20
# vpc peer-link
- name: Replace the VPC configuration of listed port-channels
cisco.nxos.nxos_vpc_interface:
config:
- name: port-channel10
vpc: 200
state: replaced
# Task output:
# ------------
# before:
# - name: port-channel10
# vpc: "100"
# - name: port-channel20
# peer_link: true
#
# commands:
# - interface port-channel10
# - no vpc
# - vpc 200
#
# after:
# - name: port-channel10
# vpc: "200"
# - name: port-channel20
# peer_link: true
# Note: port-channel20 is unchanged because it is not in the config list.
# Using overridden
# Before state:
# -------------
# interface port-channel10
# vpc 100
# interface port-channel20
# vpc peer-link
# interface port-channel30
# vpc 300
- name: Override all VPC interface configuration with provided configuration
cisco.nxos.nxos_vpc_interface:
config:
- name: port-channel10
vpc: 100
- name: port-channel20
peer_link: true
state: overridden
# Task output:
# ------------
# before:
# - name: port-channel10
# vpc: "100"
# - name: port-channel20
# peer_link: true
# - name: port-channel30
# vpc: "300"
#
# commands:
# - interface port-channel30
# - no vpc
#
# after:
# - name: port-channel10
# vpc: "100"
# - name: port-channel20
# peer_link: true
# Note: port-channel30 is removed because it is not in the want list.
# Using deleted
# Before state:
# -------------
# interface port-channel10
# vpc 100
# interface port-channel20
# vpc peer-link
- name: Delete the VPC configuration of listed port-channels
cisco.nxos.nxos_vpc_interface:
config:
- name: port-channel10
state: deleted
# Task output:
# ------------
# before:
# - name: port-channel10
# vpc: "100"
# - name: port-channel20
# peer_link: true
#
# commands:
# - interface port-channel10
# - no vpc
#
# after:
# - name: port-channel20
# peer_link: true
# Using deleted (no config — removes all VPC interface configuration)
- name: Delete the VPC configuration of all port-channels
cisco.nxos.nxos_vpc_interface:
state: deleted
# Task output:
# ------------
# commands:
# - interface port-channel10
# - no vpc
# - interface port-channel20
# - no vpc peer-link
# Using gathered
# Existing device config:
# -----------------------
# interface port-channel10
# vpc 100
# interface port-channel20
# vpc peer-link
- name: Gather VPC interface facts from the device
cisco.nxos.nxos_vpc_interface:
state: gathered
# Task output:
# ------------
# gathered:
# - name: port-channel10
# vpc: "100"
# - name: port-channel20
# peer_link: true
# Using rendered
- name: Render platform specific configuration lines
cisco.nxos.nxos_vpc_interface:
config:
- name: port-channel10
vpc: 100
- name: port-channel20
peer_link: true
state: rendered
# Task output:
# ------------
# rendered:
# - interface port-channel10
# - vpc 100
# - interface port-channel20
# - vpc peer-link
# Using parsed
# parsed.cfg
# ----------
# interface port-channel10
# vpc 100
# interface port-channel20
# vpc peer-link
- name: Parse externally supplied configuration into structured data
cisco.nxos.nxos_vpc_interface:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Task output:
# ------------
# parsed:
# - name: port-channel10
# vpc: "100"
# - name: port-channel20
# peer_link: true
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The resulting configuration after module execution. Returned: when changed Sample: |
|
The configuration prior to the module execution. Returned: when state is Sample: |
|
The set of commands pushed to the remote device. Returned: when state is Sample: |
|
Facts about the network resource gathered from the remote device as structured data. Returned: when state is Sample: |
|
The device native config provided in running_config option, parsed into structured data. Returned: when state is Sample: |
|
The provided configuration rendered in device-native format (offline). Returned: when state is Sample: |