mikewiebe.ndfc.dcnm_network (2.1.3) — module

Add and remove Networks from a DCNM managed VXLAN fabric.

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

Authors: Chris Van Heuveln(@chrisvanheuveln), Shrishail Kariyappanavar(@nkshrishail) Praveen Ramoorthy(@praveenramoorthy)

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 Networks from a DCNM managed VXLAN fabric.

In Multisite fabrics, Networks can be created only on Multisite fabric

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# This module supports the following states:
#
# Merged:
#   Networks defined in the playbook will be merged into the target fabric.
#     - If the network does not exist it will be added.
#     - If the network exists but properties managed by the playbook are different
#       they will be updated if possible.
#     - Networks that are not specified in the playbook will be untouched.
#
# Replaced:
#   Networks defined in the playbook will be replaced in the target fabric.
#     - If the Networks does not exist it will be added.
#     - If the Networks exists but properties managed by the playbook are different
#       they will be updated if possible.
#     - Properties that can be managed by the module but are not specified
#       in the playbook will be deleted or defaulted if possible.
#     - Networks that are not specified in the playbook will be untouched.
#
# Overridden:
#   Networks defined in the playbook will be overridden in the target fabric.
#     - If the Networks does not exist it will be added.
#     - If the Networks exists but properties managed by the playbook are different
#       they will be updated if possible.
#     - Properties that can be managed by the module but are not specified
#       in the playbook will be deleted or defaulted if possible.
#     - Networks that are not specified in the playbook will be deleted.
#
# Deleted:
#   Networks defined in the playbook will be deleted.
#   If no Networks are provided in the playbook, all Networks present on that DCNM fabric will be deleted.
#
# Query:
#   Returns the current DCNM state for the Networks listed in the playbook.

- name: Merge networks
  cisco.dcnm.dcnm_network:
    fabric: vxlan-fabric
    state: merged
    config:
    - net_name: ansible-net13
      vrf_name: Tenant-1
      net_id: 7005
      net_template: Default_Network_Universal
      net_extension_template: Default_Network_Extension_Universal
      vlan_id: 150
      gw_ip_subnet: '192.168.30.1/24'
      attach:
      - ip_address: 192.168.1.224
        ports: [Ethernet1/13, Ethernet1/14]
        deploy: true
      - ip_address: 192.168.1.225
        ports: [Ethernet1/13, Ethernet1/14]
        deploy: true
      deploy: true
    - net_name: ansible-net12
      vrf_name: Tenant-2
      net_id: 7002
      net_template: Default_Network_Universal
      net_extension_template: Default_Network_Extension_Universal
      vlan_id: 151
      gw_ip_subnet: '192.168.40.1/24'
      attach:
      - ip_address: 192.168.1.224
        ports: [Ethernet1/11, Ethernet1/12]
        deploy: true
      - ip_address: 192.168.1.225
        ports: [Ethernet1/11, Ethernet1/12]
        deploy: true
      deploy: false
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Replace networks
  cisco.dcnm.dcnm_network:
    fabric: vxlan-fabric
    state: replaced
    config:
      - net_name: ansible-net13
        vrf_name: Tenant-1
        net_id: 7005
        net_template: Default_Network_Universal
        net_extension_template: Default_Network_Extension_Universal
        vlan_id: 150
        gw_ip_subnet: '192.168.30.1/24'
        attach:
        - ip_address: 192.168.1.224
          # Replace the ports with new ports
          # ports: [Ethernet1/13, Ethernet1/14]
          ports: [Ethernet1/16, Ethernet1/17]
          deploy: true
          # Delete this attachment
        # - ip_address: 192.168.1.225
        #   ports: [Ethernet1/13, Ethernet1/14]
        #   deploy: true
        deploy: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
        # Dont touch this if its present on DCNM
        # - net_name: ansible-net12
        #   vrf_name: Tenant-2
        #   net_id: 7002
        #   net_template: Default_Network_Universal
        #   net_extension_template: Default_Network_Extension_Universal
        #   vlan_id: 151
        #   gw_ip_subnet: '192.168.40.1/24'
        #   attach:
        #     - ip_address: 192.168.1.224
        #       ports: [Ethernet1/11, Ethernet1/12]
        #       deploy: true
        #     - ip_address: 192.168.1.225
        #       ports: [Ethernet1/11, Ethernet1/12]
        #       deploy: true
        #   deploy: false

- name: Override networks
  cisco.dcnm.dcnm_network:
    fabric: vxlan-fabric
    state: overridden
    config:
    - net_name: ansible-net13
      vrf_name: Tenant-1
      net_id: 7005
      net_template: Default_Network_Universal
      net_extension_template: Default_Network_Extension_Universal
      vlan_id: 150
      gw_ip_subnet: '192.168.30.1/24'
      attach:
      - ip_address: 192.168.1.224
        # Replace the ports with new ports
        # ports: [Ethernet1/13, Ethernet1/14]
        ports: [Ethernet1/16, Ethernet1/17]
        deploy: true
        # Delete this attachment
        # - ip_address: 192.168.1.225
        #   ports: [Ethernet1/13, Ethernet1/14]
        #   deploy: true
      deploy: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
      # Delete this network
      # - net_name: ansible-net12
      #   vrf_name: Tenant-2
      #   net_id: 7002
      #   net_template: Default_Network_Universal
      #   net_extension_template: Default_Network_Extension_Universal
      #   vlan_id: 151
      #   gw_ip_subnet: '192.168.40.1/24'
      #   attach:
      #   - ip_address: 192.168.1.224
      #     ports: [Ethernet1/11, Ethernet1/12]
      #     deploy: true
      #   - ip_address: 192.168.1.225
      #     ports: [Ethernet1/11, Ethernet1/12]
      #     deploy: true
      #   deploy: false

- name: Delete selected networks
  cisco.dcnm.dcnm_network:
    fabric: vxlan-fabric
    state: deleted
    config:
    - net_name: ansible-net13
      vrf_name: Tenant-1
      net_id: 7005
      net_template: Default_Network_Universal
      net_extension_template: Default_Network_Extension_Universal
      vlan_id: 150
      gw_ip_subnet: '192.168.30.1/24'
    - net_name: ansible-net12
      vrf_name: Tenant-2
      net_id: 7002
      net_template: Default_Network_Universal
      net_extension_template: Default_Network_Extension_Universal
      vlan_id: 151
      gw_ip_subnet: '192.168.40.1/24'
      deploy: false
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete all the networkss
  cisco.dcnm.dcnm_network:
    fabric: vxlan-fabric
    state: deleted
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Query Networks
  cisco.dcnm.dcnm_network:
    fabric: vxlan-fabric
    state: query
    config:
    - net_name: ansible-net13
    - net_name: ansible-net12

Inputs

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

config:
    description:
    - List of details of networks being managed. Not required for state deleted
    elements: dict
    suboptions:
      arp_suppress:
        default: false
        description:
        - ARP suppression
        - ARP suppression is only supported if SVI is present when Layer-2-Only is not
          enabled
        required: false
        type: bool
      attach:
        description:
        - List of network attachment details
        elements: dict
        suboptions:
          deploy:
            default: true
            description:
            - Per switch knob to control whether to deploy the attachment
            - This knob has been deprecated from Ansible NDFC Collection Version 2.1.0
              onwards. There will not be any functional impact if specified in playbook.
            type: bool
          ip_address:
            description:
            - IP address of the switch where the network will be attached or detached
            required: true
            type: str
          ports:
            description:
            - List of switch interfaces where the network will be attached
            required: true
            type: str
        type: list
      deploy:
        default: true
        description:
        - Global knob to control whether to deploy the attachment
        - Ansible NDFC Collection Behavior for Version 2.0.1 and earlier
        - This knob will create and deploy the attachment in DCNM only when set to "True"
          in playbook
        - Ansible NDFC Collection Behavior for Version 2.1.0 and later
        - Attachments specified in the playbook will always be created in DCNM. This knob,
          when set to "True",  will deploy the attachment in DCNM, by pushing the configs
          to switch. If set to "False", the attachments will be created in DCNM, but will
          not be deployed
        type: bool
      dhcp_loopback_id:
        description:
        - Loopback ID for DHCP Relay interface
        - Configured ID value should be in range 0-1023
        required: false
        type: int
      dhcp_srvr1_ip:
        description:
        - DHCP relay IP address of the first DHCP server
        required: false
        type: str
      dhcp_srvr1_vrf:
        description:
        - VRF ID of first DHCP server
        required: false
        type: str
      dhcp_srvr2_ip:
        description:
        - DHCP relay IP address of the second DHCP server
        required: false
        type: str
      dhcp_srvr2_vrf:
        description:
        - VRF ID of second DHCP server
        required: false
        type: str
      dhcp_srvr3_ip:
        description:
        - DHCP relay IP address of the third DHCP server
        required: false
        type: str
      dhcp_srvr3_vrf:
        description:
        - VRF ID of third DHCP server
        required: false
        type: str
      gw_ip_subnet:
        description:
        - Gateway with subnet for the network
        required: false
        type: str
      int_desc:
        description:
        - Description for the interface
        required: false
        type: str
      is_l2only:
        default: false
        description:
        - Layer 2 only network
        - If specified as true, VRF Name(vrf_name) should not be specified or can be specified
          as ""
        required: false
        type: bool
      mtu_l3intf:
        description:
        - MTU for Layer 3 interfaces
        - Configured MTU value should be in range 68-9216
        required: false
        type: int
      net_extension_template:
        default: Default_Network_Extension_Universal
        description:
        - Name of the extension config template to be used
        type: str
      net_id:
        description:
        - ID of the network being managed
        - If not specified in the playbook, DCNM will auto-select an available net_id
        required: false
        type: int
      net_name:
        description:
        - Name of the network being managed
        required: true
        type: str
      net_template:
        default: Default_Network_Universal
        description:
        - Name of the config template to be used
        type: str
      routing_tag:
        default: 12345
        description:
        - Routing Tag for the network profile
        required: false
        type: int
      vlan_id:
        description:
        - VLAN ID for the network.
        - If not specified in the playbook, DCNM will auto-select an available vlan_id
        required: false
        type: int
      vlan_name:
        description:
        - Name of the vlan configured
        - if > 32 chars enable, system vlan long-name on switch
        required: false
        type: str
      vrf_name:
        description:
        - Name of the VRF to which the network belongs to
        - This field is required for L3 Networks. VRF name should not be specified or
          may be specified as "" for L2 networks
        type: str
    type: list

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