Cisco MDS 9000 Series Ansible Modules

Ansible is an open source orchestration tool that helps automate device management. For information about installing Ansible and getting started refer to: https://docs.ansible.com/ansible/latest/getting_started/index.html

The modules documented here are MDS-specific NX-OS modules developed by Cisco. For information about other community developed NX-OS modules refer to: https://docs.ansible.com/ansible/latest/collections/cisco/nxos/index.html#modules

nxos_devicealias - Configuration of Device Aliases

Synopsis

Configures device aliases for Cisco MDS NXOS.

Parameters

Parameter

Choices/Defaults

Comments

distribute

bool/False

Enable/Disable device alias distribution

mode

Choices:

  • basic

  • enhanced

Default:

  • basic

Mode of devices alias, basic or enhanced

da

List of device-alias to be added or removed

name

Name of the device alias to be added or removed

pwwn

pwwn to which the name needs to be associated with

remove

bool/False

Removes the device alias if set to True

Notes

Tested against Cisco MDS NX-OS 8.4(1).

Examples

nxos_devicealias:
          distribute: yes
          mode: enhanced
          da:
              - { name: 'test1_add', pwwn: '56:2:22:11:22:88:11:67'}
              - { name: 'test2_add', pwwn: '65:22:22:11:22:22:11:d'}
              - { name: 'dev1', remove: True}
              - { name: 'dev2', remove: True} 
          provider: "{{ creds }}"
      register: result
    - debug: var=result

Return Values

The following common return values are documented:

  • backup_file
  • changed
  • diff
  • failed
  • invocation
  • msg
  • rc
  • results
  • skipped
  • stderr
  • stderr_lines
  • stdout
  • stdout_lines

The following are the fields unique to this module:

Key Description

commands

https://docs.ansible.com/ansible/latest/collections/cisco/nxos/nxos_devicealias_module.html#return-commands

list / elements=string

commands sent to the device

Returned: always

Sample: [“terminal dont-ask”, “device-alias database”, “device-alias name somename pwwn 10:00:00:00:89:a1:01:03”, “device-alias name somename1 pwwn 10:00:00:00:89:a1:02:03”, “device-alias commit”, “no terminal dont-ask”]

Status

This module is supported.

nxos_vsan - Configuration of VSANs

Synopsis

Configures VSANs on Cisco MDS NXOS devices.

Parameters

Parameter

Choices/Defaults

Comments

vsan

List of vsan details to be added or removed.

id

vsan id

name

Name of the vsan

suspend

bool/False

Suspend the vsan if True

remove

bool/False

Removes the vsan if True

interface

List of vsan's interfaces to be added.

Notes

Tested against Cisco MDS NX-OS 8.4(1)

Examples


      nxos_vsan:
        provider: "{{ creds }}"
        vsan:
           - id: 922
             name: vsan-SAN-A
             suspend: False
             interface:
                - fc1/1
                - fc1/2
                - port-channel 1
             remove: False
           - id: 923
             name: vsan-SAN-B
             suspend: True
             interface:
                - fc1/11
                - fc1/21
                - port-channel 2
             remove: False
           - id: 1923
             name: vsan-SAN-Old
             remove: True
      register: result
      - debug: var=result

Return Values

The following common return values are documented:

  • backup_file

  • changed

  • diff

  • failed

  • invocation

  • msg

  • rc

  • results

  • skipped

  • stderr

  • stderr_lines

  • stdout

  • stdout_lines

The following are the fields unique to this module:

Key Description

commands

https://docs.ansible.com/ansible/latest/collections/cisco/nxos/nxos_vsan_module.html#return-commands

list / elements=string

commands sent to the device

Returned: always

Sample: [“terminal dont-ask”, “vsan database”, “vsan 922 interface fc1/40”, “vsan 922 interface port-channel 155”, “no terminal dont-ask”]

Status

This module is supported.

nxos_zone_zoneset - Configuration of Zones/Zonesets

Synopsis

Configures Zones/Zonesets on Cisco MD NXOS devices.

Parameters

Parameter

Choices/Defaults

Comments

zone_zoneset_details

List of zone/zoneset details to be added or removed

vsan

vsan id

mode

Choices:

  • enhanced

  • basic

Default:

  • basic

Mode of the zone for the vsan

default_zone

Choices:

  • permit

  • deny

Default:

  • deny

default zone behaviour for the vsan

smart_zoning

bool/False

Enables smartzoning on the vsan if True.

zone

List of zone options for that vsan.

name

name of the zone

remove

bool/False

Deletes the zone if True

members

Members of the zone that needs to be removed or added

pwwn

pwwn member of the zone, use alias 'device-alias' as option for device-alias member

remove

bool/False

Removes member from the zone if True

devtype

Choices:

  • initiator

  • target

  • both

devtype of the zone member used along with Smart zoning config

zoneset

List of zoneset options for the vsan

name

name of the zoneset

remove

bool/False

Removes zoneset if True

action

Choices:

  • activate

  • deactivate

Default:

  • deactivate

activates/de-activates the zoneset

members

Members of the zoneset that needs to be removed or added

name

name of the zone that needs to be added to the zoneset or removed from the zoneset

remove

bool/False

Removes zone member from the zoneset

Notes

Tested against Cisco MDS NX-OS 8.4(1)

Examples

nxos_zone_zoneset:
        provider: "{{ creds }}"
        zone_zoneset_details:
           - vsan: 22
             mode: enhanced
             zone:
                - name: zoneA
                  members:
                     - {pwwn: '11:11:11:11:11:11:11:11'}
                     - {device-alias: 'test123'}
                     - {pwwn: '61:61:62:62:12:12:12:12', remove: True}
                - name: zoneB
                  members:
                     - {pwwn: '10:11:11:11:11:11:11:11'}
                     - {pwwn: '62:62:62:62:21:21:21:21'}
                - name: zoneC
                  remove: True
             zoneset:
                 - name: zsetname1
                   members:
                      - {name: zoneA}
                      - {name: zoneB}
                      - {name: zoneC, remove: True}
                   action: activate
                 - name: zsetTestExtra
                   remove: True
                   action: deactivate
           - vsan: 21
             mode: basic
             smart_zoning: True
             zone:
                - name: zone21A
                  members:
                     - {pwwn: '11:11:11:11:11:11:11:11',devtype: 'both'}
                     - {pwwn: '62:62:62:62:12:12:12:12'}
                     - {pwwn: '92:62:62:62:12:12:1a:1a',devtype: 'both', remove: True}
                - name: zone21B
                  members:
                     - {pwwn: '10:11:11:11:11:11:11:11'}
                     - {pwwn: '62:62:62:62:21:21:21:21'}
             zoneset:
                 - name: zsetname21
                   members:
                      - {name: zone21A}
                      - {name: zone21B}
                   action: activate
      register: result
      - debug: var=result

Return Values

The following common return values are documented:

  • backup_file
  • changed
  • diff
  • failed
  • invocation
  • msg
  • rc
  • results
  • skipped
  • stderr
  • stderr_lines
  • stdout
  • stdout_lines

The following are the fields unique to this module:

Key Description

commands

https://docs.ansible.com/ansible/latest/collections/cisco/nxos/nxos_zone_zoneset_module.html#return-commands

list / elements=string

commands sent to the device

Returned: always

Sample: [“terminal dont-ask”, “zone name zoneA vsan 923”, “member pwwn 11:11:11:11:11:11:11:11”, “no member device-alias test123”, “zone commit vsan 923”, “no terminal dont-ask”]

messages

https://docs.ansible.com/ansible/latest/collections/cisco/nxos/nxos_zone_zoneset_module.html#return-messages

list / elements=string

debug messages

Returned: always

Sample: [“zone mode is already enhanced ,no change in zone mode configuration for vsan 922”, “zone member \u002711:11:11:11:11:11:11:11\u0027 is already present in zone \u0027zoneA\u0027 in vsan 922 hence nothing to add”, “zone member \u0027test123\u0027 is already present in zone \u0027zoneA\u0027 in vsan 922 hence nothing to add”, “zone member \u002761:61:62:62:12:12:12:12\u0027 is not present in zone \u0027zoneA\u0027 in vsan 922 hence nothing to remove”, “zone member \u002710:11:11:11:11:11:11:11\u0027 is already present in zone \u0027zoneB\u0027 in vsan 922 hence nothing to add”, “zone member \u002762:62:62:62:21:21:21:21\u0027 is already present in zone \u0027zoneB\u0027 in vsan 922 hence nothing to add”, “zone \u0027zoneC\u0027 is not present in vsan 922 , so nothing to remove”]

Status

This module is supported.