mikewiebe.ndfc.dcnm_rest (2.1.3) — module

Send REST API requests to DCNM controller.

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

Authors: Mike Wiebe (@mikewiebe)

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

Send REST API requests to DCNM controller.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# This module can be used to send any REST API requests that are supported by
# the DCNM controller.
#
# This module is not idempotent but can be used as a stop gap until a feature
# module can be developed for the target DCNM functionality.

- name: Gather List of Fabrics from DCNM
  dcnm_rest:
    method: GET
    path: /rest/control/fabrics
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Set deployment to false in lanAttachList for vrf
  dcnm_rest:
    method: POST
    path: /rest/top-down/fabrics/fabric1/vrfs/attachments
    json_data: '[{"vrfName":"sales66_vrf1","lanAttachList":[{"fabric":"fabric1","vrfName":"sales66_vrf1","serialNumber":"FDO21392QKM","vlan":2000,"freeformConfig":"","deployment":false,"extensionValues":"","instanceValues":"{"loopbackId":"","loopbackIpAddress":"","loopbackIpV6Address":""}"}]}]'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Read payload data from file and validate a template
- set_fact:
    data: "{{ lookup('file', 'validate_payload') }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Validate a template
  cisco.dcnm.dcnm_rest:
    method: POST
    path: /fm/fmrest/config/templates/validate
    json_data: "{{ data }}"
    register: result

Inputs

    
data:
    aliases:
    - json_data
    description:
    - Additional data in JSON or TEXT to include with the REST API call
    required: false
    type: raw

path:
    description:
    - REST API Path Endpoint
    required: true
    type: str

method:
    choices:
    - GET
    - POST
    - PUT
    - DELETE
    description:
    - REST API Method
    required: true
    type: str

Outputs

response:
  description:
  - Success or Error Data retrieved from DCNM
  elements: dict
  returned: always
  type: list