mikewiebe.ndfc.dcnm_inventory (2.1.3) — module

Add and remove Switches from a DCNM managed VXLAN fabric.

| "added in version" 0.9.0 of mikewiebe.ndfc"

Authors: Karthik Babu Harichandra Babu(@kharicha)

This plugin has a corresponding action plugin.

Install collection

Install with ansible-galaxy collection install mikewiebe.ndfc:==2.1.3


Add to requirements.yml

  collections:
    - name: mikewiebe.ndfc
      version: 2.1.3

Description

Add and remove Switches from a DCNM managed VXLAN fabric.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# This module supports the following states:
#
# Merged:
#   Switches defined in the playbook will be merged into the target fabric.
#     - If the switch does not exist it will be added.
#     - Switches that are not specified in the playbook will be untouched.
#
# Overridden:
#   The playbook will serve as source of truth for the target fabric.
#     - If the switch does not exist it will be added.
#     - If the switch is not defined in the playbook but exists in DCNM it will be removed.
#     - If the switch exists, properties that need to be modified and can be modified will be modified.
#
# Deleted:
#   Deletes the list of switches specified in the playbook.
#   If no switches are provided in the playbook, all the switches present on that DCNM fabric will be deleted.
#
# Query:
#   Returns the current DCNM state for the switches listed in the playbook.


# The following two switches will be merged into the existing fabric
- name: Merge switch into fabric
  cisco.dcnm.dcnm_inventory:
    fabric: vxlan-fabric
    state: merged # merged / deleted / overridden / query
    config:
    - seed_ip: 192.168.0.1
      auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES]
      user_name: switch_username
      password: switch_password
      max_hops: 0
      role: spine
      preserve_config: False # boolean, default is  true
    - seed_ip: 192.168.0.2
      auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES]
      user_name: switch_username
      password: switch_password
      max_hops: 0
      role: leaf
      preserve_config: False # boolean, default is true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# The following two switches will be added or updated in the existing fabric and all other
# switches will be removed from the fabric
- name: Override Switch
  cisco.dcnm.dcnm_inventory:
    fabric: vxlan-fabric
    state: overridden # merged / deleted / overridden / query
    config:
    - seed_ip: 192.168.0.1
      auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES]
      user_name: switch_username
      password: switch_password
      max_hops: 0
      role: spine
      preserve_config: False # boolean, default is  true
    - seed_ip: 192.168.0.2
      auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES]
      user_name: switch_username
      password: switch_password
      max_hops: 0
      role: leaf
      preserve_config: False # boolean, default is true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# The following two switches will be deleted in the existing fabric
- name: Delete selected switches
  cisco.dcnm.dcnm_inventory:
    fabric: vxlan-fabric
    state: deleted # merged / deleted / overridden / query
    config:
    - seed_ip: 192.168.0.1
      auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES]
      user_name: switch_username
      password: switch_password
      max_hops: 0
      role: spine
      preserve_config: False # boolean, default is  true
    - seed_ip: 192.168.0.2
      auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES]
      user_name: switch_username
      password: switch_password
      max_hops: 0
      role: leaf
      preserve_config: False # boolean, default is  true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# All the switches will be deleted in the existing fabric
- name: Delete all the switches
  cisco.dcnm.dcnm_inventory:
    fabric: vxlan-fabric
    state: deleted # merged / deleted / overridden / query
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# The following two switches information will be queried in the existing fabric
- name: Query switch into fabric
  cisco.dcnm.dcnm_inventory:
    fabric: vxlan-fabric
    state: query # merged / deleted / overridden / query
    config:
    - seed_ip: 192.168.0.1
      role: spine
    - seed_ip: 192.168.0.2
      role: leaf
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# All the existing switches will be queried in the existing fabric
- name: Query all the switches in the fabric
  cisco.dcnm.dcnm_inventory:
    fabric: vxlan-fabric
    state: query # merged / deleted / overridden / query

Inputs

    
state:
    choices:
    - merged
    - overridden
    - deleted
    - query
    default: merged
    description:
    - The state of DCNM after module completion.
    type: str

config:
    description:
    - List of switches being managed. Not required for state deleted
    elements: dict
    suboptions:
      auth_proto:
        choices:
        - MD5
        - SHA
        - MD5_DES
        - MD5_AES
        - SHA_DES
        - SHA_AES
        description:
        - Name of the authentication protocol to be used
        required: true
        type: str
      max_hops:
        description:
        - Maximum Hops to reach the switch
        required: true
        type: str
      password:
        description:
        - Login password to the switch
        required: true
        type: str
      preserve_configs:
        description:
        - Set this to false for greenfield deployment and true for brownfield deployment
        required: true
        type: str
      role:
        choices:
        - leaf
        - spine
        - border
        - border_spine
        - border_gateway
        - border_gateway_spine
        - super_spine
        - border_super_spine
        - border_gateway_super_spine
        default: leaf
        description:
        - Role which needs to be assigned to the switch
        required: true
        type: str
      seed_ip:
        description:
        - Seed Name(support both IP address and dns_name) of the switch which needs to
          be added to the DCNM Fabric
        required: true
        type: str
      user_name:
        description:
        - Login username to the switch
        required: true
        type: str
    type: list

fabric:
    description:
    - Name of the target fabric for Inventory operations
    required: true
    type: str