cisco.nxos.nxos_vpc module – VPC 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.

New in cisco.nxos 1.0.0

Synopsis

  • This module manages global VPC domain configuration on devices running Cisco NX-OS.

Note

This module has a corresponding action plugin.

Aliases: vpc

Parameters

Parameter

Comments

config

dictionary

Global VPC domain configuration.

arp_synchronize

boolean

added in cisco.nxos 13.1.0

Enable or disable IP ARP synchronization between VPC peers.

Choices:

  • false

  • true

auto_recovery

boolean

Enable or disable auto-recovery.

Choices:

  • false

  • true

auto_recovery_reload_delay

string

Delay in seconds before auto-recovery after reload.

delay_restore

string

Delay in seconds before VPC comes back up after reload.

delay_restore_interface_vlan

string

Delay in seconds before interface-vlan comes back up after reload.

delay_restore_orphan_port

string

Delay in seconds for orphan port delay restore.

domain

string / required

VPC domain ID.

Valid range is 1–1000; NX-OS rejects values outside this range.

layer3_peer_router

boolean

added in cisco.nxos 13.1.0

Enable or disable Layer 3 peer-router.

Requires terminal dont-ask on NX-OS because the platform prompts for confirmation when this is changed.

Choices:

  • false

  • true

nd_synchronize

boolean

added in cisco.nxos 13.1.0

Enable or disable IPv6 ND synchronization between VPC peers.

Choices:

  • false

  • true

peer_gw

boolean

Enable or disable peer gateway.

Choices:

  • false

  • true

peer_sw

boolean

Enable or disable peer-switch.

Choices:

  • false

  • true

pkl_dest

string

Destination (remote) IP address used for peer keepalive link.

Required whenever any peer keepalive options are used.

pkl_src

string

Source IP address used for peer keepalive link.

pkl_vrf

string

VRF used for peer keepalive link.

NX-OS does not write this to running-config when it is the default management VRF, so an absent VRF is reported as management.

(Note) default is an overloaded term. The default VRF context for peer-keepalive is management; pkl_vrf: default refers to the literal default rib.

role_priority

string

Role priority for device. Lower values are preferred.

system_priority

string

System priority. Must match between VPC peers.

string

added in cisco.nxos 13.1.0

Destination IP address for the virtual peer-link.

string

added in cisco.nxos 13.1.0

DSCP value for virtual peer-link packets (0–63).

NX-OS silently appends dscp 56 to running-config when no value is specified, so omitting this option is idempotent against a device that has the platform default in its running-config.

string

added in cisco.nxos 13.1.0

Source IP address for the virtual peer-link.

running_config

string

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 ‘^vpc domain’.

The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module’s argspec and the value is then returned in the parsed key within the result.

state

string

The state the configuration should be left in.

Choices:

  • "merged" ← (default)

  • "replaced"

  • "overridden"

  • "deleted"

  • "gathered"

  • "rendered"

  • "parsed"

Notes

Note

  • Tested against NX-OS 10.5(5) on N9K-C93180YC-FX3H.

  • Unsupported for Cisco MDS.

  • The feature vpc must be enabled before this module can be used.

  • If not using management vrf, the vrf must be globally configured on the device before using it in the peer-keepalive configuration.

  • Both pkl_src and pkl_dest are needed when changing peer-keepalive VRF.

  • NX-OS does not write default values to running-config, so role_priority, system_priority, delay_restore, delay_restore_interface_vlan, delay_restore_orphan_port and auto_recovery_reload_delay are reset by re-applying the platform default rather than by a no form, which NX-OS rejects for some of these sub-commands.

  • A boolean sub-command that is absent from running-config is reported and treated as false.

  • Only one VPC domain can exist at a time. With state replaced or overridden, supplying a different domain removes the existing domain first, which discards its configuration.

  • Removing a peer-keepalive under state replaced or overridden is disruptive. NX-OS rejects every no peer-keepalive form, so the module deletes the domain and recreates it with only the wanted configuration. This momentarily flaps the VPC peer relationship.

  • When a peer-keepalive removal triggers a domain recreate, the module waits and retries internally for NX-OS to finish the async domain delete before reapplying configuration. This can add up to roughly 30 seconds to the task. If NX-OS has not finished within that window, the task fails and can safely be rerun.

Examples

# Using merged

# Before state:
# -------------
# (no vpc domain configured)

- name: Merge VPC global domain configuration
  cisco.nxos.nxos_vpc:
    config:
      domain: "10"
      role_priority: "150"
      system_priority: "2000"
      pkl_dest: 192.168.2.2
      pkl_src: 192.168.2.1
      pkl_vrf: management
      peer_gw: true
      auto_recovery: true
      delay_restore: "150"
    state: merged

# Task output:
# ------------
# commands:
#   - terminal dont-ask
#   - vpc domain 10
#   - role priority 150
#   - system-priority 2000
#   - delay restore 150
#   - auto-recovery
#   - peer-gateway
#   - peer-keepalive destination 192.168.2.2 source 192.168.2.1 vrf management

# After state:
# ------------
# vpc domain 10
#   role priority 150
#   system-priority 2000
#   peer-keepalive destination 192.168.2.2 source 192.168.2.1
#   delay restore 150
#   peer-gateway
#   auto-recovery

# Using replaced

# Before state:
# -------------
# vpc domain 10
#   role priority 150
#   system-priority 2000
#   peer-keepalive destination 192.168.2.2 source 192.168.2.1
#   delay restore 150
#   peer-gateway
#   auto-recovery

- name: Replace VPC global domain configuration
  cisco.nxos.nxos_vpc:
    config:
      domain: "10"
      pkl_dest: 192.168.2.2
      pkl_src: 192.168.2.1
    state: replaced

# Task output:
# ------------
# commands:
#   - terminal dont-ask
#   - vpc domain 10
#   - role priority 32667
#   - system-priority 32667
#   - delay restore 60
#   - no auto-recovery
#   - no peer-gateway

# After state:
# ------------
# vpc domain 10
#   peer-keepalive destination 192.168.2.2 source 192.168.2.1

# Using overridden

# Before state:
# -------------
# vpc domain 10
#   peer-keepalive destination 192.168.2.2 source 192.168.2.1 vrf orange
#   peer-switch

- name: Override VPC global domain configuration
  cisco.nxos.nxos_vpc:
    config:
      domain: "10"
      role_priority: "150"
    state: overridden

# Task output:
# ------------
# commands:
#   - terminal dont-ask
#   - no vpc domain 10
#   - vpc domain 10
#   - role priority 150
#   - no terminal dont-ask

# After state:
# ------------
# vpc domain 10
#   role priority 150

# Using deleted

# Before state:
# -------------
# vpc domain 10
#   peer-keepalive destination 192.168.2.2 source 192.168.2.1

- name: Delete VPC global domain configuration
  cisco.nxos.nxos_vpc:
    state: deleted

# Task output:
# ------------
# commands:
#   - terminal dont-ask
#   - no vpc domain 10
#   - no terminal dont-ask

# After state:
# ------------
# (no vpc domain configured)

# Using gathered

# Device running-config:
# ----------------------
# vpc domain 10
#   role priority 150
#   system-priority 2000
#   peer-keepalive destination 192.168.2.2 source 192.168.2.1
#   delay restore 150
#   peer-gateway
#   auto-recovery

- name: Gather VPC global domain facts from the device
  cisco.nxos.nxos_vpc:
    state: gathered

# Task output:
# ------------
# gathered:
#   domain: "10"
#   role_priority: "150"
#   system_priority: "2000"
#   pkl_dest: 192.168.2.2
#   pkl_src: 192.168.2.1
#   peer_gw: true
#   auto_recovery: true
#   delay_restore: "150"

# Using rendered

- name: Render VPC configuration (offline, no device connection)
  cisco.nxos.nxos_vpc:
    config:
      domain: "10"
      role_priority: "150"
      peer_gw: true
      pkl_dest: 192.168.2.2
      pkl_src: 192.168.2.1
      pkl_vrf: management
    state: rendered

# Task output:
# ------------
# rendered:
#   - terminal dont-ask
#   - vpc domain 10
#   - role priority 150
#   - peer-gateway
#   - peer-keepalive destination 192.168.2.2 source 192.168.2.1 vrf management

# Using parsed

- name: Parse VPC configuration from provided running-config
  cisco.nxos.nxos_vpc:
    running_config: |
      vpc domain 10
        role priority 150
        peer-keepalive destination 192.168.2.2 source 192.168.2.1 vrf orange
        peer-gateway
        auto-recovery
    state: parsed

# Task output:
# ------------
# parsed:
#   domain: "10"
#   role_priority: "150"
#   pkl_dest: 192.168.2.2
#   pkl_src: 192.168.2.1
#   pkl_vrf: orange
#   peer_gw: true
#   auto_recovery: true

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

after

dictionary

The resulting configuration after module invocation.

Returned: when changed

Sample: "The configuration returned will always be in the same format of the parameters above.\n"

before

dictionary

The configuration prior to the module invocation.

Returned: always

Sample: "The configuration returned will always be in the same format of the parameters above.\n"

commands

list / elements=string

The set of commands pushed to the remote device.

Returned: always

Sample: ["terminal dont-ask", "vpc domain 10", "role priority 150", "peer-gateway", "peer-keepalive destination 192.168.2.2 source 192.168.2.1 vrf management"]

gathered

dictionary

Facts about the network resource gathered from the remote device as structured data.

Returned: when state is gathered

Sample: "This output will always be in the same format as the module argspec.\n"

parsed

dictionary

The device native config provided in running_config option parsed into structured data as per module argspec.

Returned: when state is parsed

Sample: "This output will always be in the same format as the module argspec.\n"

rendered

list / elements=string

The provided configuration rendered in device-native format (offline).

Returned: when state is rendered

Sample: ["terminal dont-ask", "vpc domain 10", "role priority 150", "peer-gateway"]

Authors

  • Jason Edelman (@jedelman8)

  • Gabriele Gerbino (@GGabriele)

  • Jorgen Spange (@jorgenspange)