cisco.nxos.nxos_fc_interfaces module – Fc Interfaces resource module

Note

This module is part of the cisco.nxos collection (version 5.3.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_fc_interfaces.

New in cisco.nxos 5.2.0

Synopsis

  • This module manages the interface attributes of NX-OS fc interfaces.

Parameters

Parameter

Comments

config

list / elements=dictionary

A dictionary of interface options

analytics

string

Analytics type on the fc interface

Choices:

  • "fc-scsi"

  • "fc-nvme"

  • "fc-all"

description

string

Interface description.

enabled

boolean

Administrative state of the interface. Set the value to true to administratively enable the interface or false to disable it

Choices:

  • false

  • true

mode

string

Port mode of the fc interface

Choices:

  • "auto"

  • "E"

  • "F"

  • "Fx"

  • "NP"

  • "SD"

name

string / required

Full name of interface, e.g. fc1/1, fc18/48

speed

string

Interface link speed.

Choices:

  • "auto"

  • "1000"

  • "2000"

  • "4000"

  • "8000"

  • "10000"

  • "16000"

  • "32000"

  • "64000"

  • "auto max 2000"

  • "auto max 4000"

  • "auto max 8000"

  • "auto max 16000"

  • "auto max 32000"

  • "auto max 64000"

trunk_mode

string

Trunk mode of the fc interface

Choices:

  • "auto"

  • "on"

  • "off"

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 interface

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 of the configuration after module completion

Choices:

  • "merged" ← (default)

  • "replaced"

  • "overridden"

  • "deleted"

  • "gathered"

  • "rendered"

  • "parsed"

Notes

Note

  • Tested against NXOS 9.3(2) on Cisco MDS Switches

Examples

# Using merged

# Before state:
# -------------
#
# switch# show running-config interface all
# interface fc18/10
#     analytics type fc-nvme
#     switchport speed auto max 16000
#     switchport mode auto
#     switchport description $
#     switchport trunk mode on
#     shutdown

- name: Merge provided configuration with device configuration
  cisco.nxos.nxos_fc_interfaces:
    config:
    - name: fc18/10
      analytics: fc-scsi
    state: merged

# Task Output
# -----------
#
# before:
# - name: fc18/10
#   speed: auto max 16000
#   mode: auto
#   trunk_mode: on
#   enabled: False
#   description: $
#   analytics: fc-nvme
# commands:
# - interface fc18/10
# - analytics type fc-scsi
# after:
# - name: fc18/10
#   speed: auto max 16000
#   mode: auto
#   trunk_mode: on
#   enabled: False
#   description: $
#   analytics: fc-all

# After state:
# ------------
#
# switch# show running-config interface all
# interface fc18/10
#     analytics type fc-scsi
#     analytics type fc-nvme
#     switchport speed auto max 16000
#     switchport mode auto
#     switchport description $
#     switchport trunk mode on
#     shutdown

# Using replaced

# Before state:
# -------------
#
# switch# show running-config interface all
# interface fc18/12
#     analytics type fc-scsi
#     analytics type fc-nvme
#     switchport speed auto max 64000
#     switchport mode auto
#     switchport description 1
#     switchport trunk mode on
#     no shutdown

- name: Replaces device configuration of listed interfaces with provided configuration
  cisco.nxos.nxos_fc_interfaces:
    config:
    - name: fc18/12
      speed: auto max 64000
      mode: auto
      trunk_mode: on
      enabled: True
      description: 1
      analytics: fc-scsi
    state: replaced

# Task Output
# -----------
#
# before:
# - name: fc18/12
#   speed: auto max 64000
#   mode: auto
#   trunk_mode: on
#   enabled: True
#   description: 1
#   analytics: fc-all
# commands:
# - interface fc18/12
# - no analytics type fc-all
# - analytics type fc-scsi
# after:
# - name: fc18/12
#   speed: auto max 64000
#   mode: auto
#   trunk_mode: on
#   enabled: True
#   description: 1
#   analytics: fc-scsi

# After state:
# ------------
#
# switch# show running-config interface all
# interface fc18/12
#     analytics type fc-scsi
#     switchport speed auto max 64000
#     switchport mode auto
#     switchport description 1
#     switchport trunk mode on
#     no shutdown


# Using deleted

# Before state:
# -------------
#
# switch# show running-config interface all
# interface fc1/2
#     switchport speed 1000
#     switchport mode E
#     no switchport description
#     switchport trunk mode off
#     no shutdown

- name: Delete or return interface parameters to default settings
  cisco.nxos.nxos_fc_interfaces:
    config:
    - name: fc1/2
    state: deleted

# Task Output
# -----------
#
# before:
# - name: fc1/2
#   speed: 1000
#   mode: E
#   trunk_mode: off
#   enabled: True
# commands:
# - interface fc1/2
# - no switchport speed 1000
# - no switchport mode E
# - switchport trunk mode on
# - shutdown
# after:
# - name: fc1/2
#   speed: auto
#   mode: auto
#   trunk_mode: on
#   enabled: False

# After state:
# ------------
#
# switch# show running-config interface all
# interface fc1/2
#     switchport speed auto
#     switchport mode auto
#     no switchport description
#     switchport trunk mode on
#     shutdown

# Using overridden

# Before state:
# -------------
#
# switch# show running-config interface all
# interface fc18/12
#     analytics type fc-scsi
#     analytics type fc-nvme
#     switchport speed auto max 64000
#     switchport mode auto
#     switchport description 1
#     switchport trunk mode on
#     no shutdown
# interface fc18/13
#     analytics type fc-scsi
#     analytics type fc-nvme
#     switchport speed auto max 64000
#     switchport mode auto
#     switchport description 1
#     switchport trunk mode on
#     no shutdown

- name: Replaces device configuration of listed interfaces with provided configuration
  cisco.nxos.nxos_fc_interfaces:
    config:
    - name: fc18/12
      speed: auto max 64000
      mode: auto
      trunk_mode: on
      enabled: True
      description: 1
      analytics: fc-scsi
    state: overridden

# Task Output
# -----------
#
# before:
# - name: fc18/12
#   speed: auto max 64000
#   mode: auto
#   trunk_mode: on
#   enabled: True
#   description: 1
#   analytics: fc-all
# - name: fc18/13
#   speed: auto max 64000
#   mode: auto
#   trunk_mode: on
#   enabled: True
#   description: 1
#   analytics: fc-all
# commands:
# - interface fc18/12
#   no analytics type fc-all
#   analytics type fc-scsi
# - interface fc18/13
#   no switchport description
#   no switchport speed auto max 64000
#   no switchport mode auto
#   switchport trunk mode on
#   shutdown
# after:
# - name: fc18/12
#   speed: auto max 64000
#   mode: auto
#   trunk_mode: on
#   enabled: True
#   description: 1
#   analytics: fc-scsi
# - name: fc18/13
#   speed: auto max 64000
#   mode: auto
#   trunk_mode: on
#   enabled: False

# After state:
# ------------
#
# switch# show running-config interface all
# interface fc18/12
#     analytics type fc-scsi
#     switchport speed auto max 64000
#     switchport mode auto
#     switchport description 1
#     switchport trunk mode on
#     no shutdown
# interface fc18/13
#     switchport mode auto
#     switchport trunk mode on
#     shutdown







# Using rendered

- name: Use rendered state to convert task input to device specific commands
  cisco.nxos.nxos_fc_interfaces:
    config:
    - name: fc1/1
      speed: auto
      mode: auto
      trunk_mode: on
      enabled: True
      description: This is a sample line
    - name: fc1/2
      speed: 1000
      mode: E
      trunk_mode: off
      enabled: True
      state: rendered

# Task Output
# -----------
#
# rendered:
# interface fc1/1
#     switchport speed auto
#     switchport mode auto
#     switchport description This is a sample line
#     switchport trunk mode on
#     no shutdown
#
# interface fc1/2
#     switchport speed 1000
#     switchport mode E
#     no switchport description
#     switchport trunk mode off
#     no shutdown

# Using parsed

# parsed.cfg
# ------------
#
# interface fc1/1
#     switchport speed auto
#     switchport mode auto
#     switchport description This is a sample line
#     switchport trunk mode on
#     no shutdown
#
# interface fc1/2
#     switchport speed 1000
#     switchport mode E
#     no switchport description
#     switchport trunk mode off
#     no shutdown

- name: Use parsed state to convert externally supplied config to structured format
  cisco.nxos.nxos_fc_interfaces:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed

# Task output
# -----------
#
#  parsed:
# - name: fc1/1
#   speed: auto
#   mode: auto
#   trunk_mode: on
#   enabled: True
#   description: This is a sample line
# - name: fc1/2
#   speed: 1000
#   mode: E
#   trunk_mode: off
#   enabled: True

# Using gathered

# Before state:
# -------------
#
# switch# show running-config | section interface
# interface fc1/1
#     switchport speed auto
#     switchport mode auto
#     switchport description This is a sample line
#     switchport trunk mode on
#     no shutdown
#
# interface fc1/2
#     switchport speed 1000
#     switchport mode E
#     no switchport description
#     switchport trunk mode off
#     no shutdown
#
- name: Gather interfaces facts from the device using nxos_fc_interfaces
  cisco.nxos.nxos_fc_interfaces:
    state: gathered
#
# Task output
# -----------
#
# - name: fc1/1
#   speed: auto
#   mode: auto
#   trunk_mode: on
#   enabled: True
#   description: This is a sample line
# - name: fc1/2
#   speed: 1000
#   mode: E
#   trunk_mode: off
#   enabled: 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 execution.

Returned: when changed

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

before

dictionary

The configuration prior to the module execution.

Returned: when state is merged, replaced, overridden, deleted or purged

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

commands

list / elements=string

The set of commands pushed to the remote device.

Returned: when state is merged, replaced, overridden, deleted or purged

Sample: ["interface fc1/1", "description sample description", "shutdown"]

gathered

list / elements=string

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

list / elements=string

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 in the task rendered in device-native format (offline).

Returned: when state is rendered

Sample: ["interface fc1/1", "description sample description", "shutdown"]

Authors

  • Suhas Bharadwaj (@srbharadwaj)