cisco.dnac.discovery module – Resource module for Discovery

Note

This module is part of the cisco.dnac collection (version 6.16.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.dnac. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: cisco.dnac.discovery.

New in cisco.dnac 3.1.0

Synopsis

  • Manage operations create, update and delete of the resource Discovery.

  • Initiates discovery with the given parameters.

  • Stops all the discoveries and removes them.

  • Stops the discovery for the given Discovery ID and removes it. Discovery ID can be obtained using the “Get Discoveries by range” API.

  • Stops or starts an existing discovery.

Note

This module has a corresponding action plugin.

Requirements

The below requirements are needed on the host that executes this module.

  • dnacentersdk >= 2.7.1

  • python >= 3.5

Parameters

Parameter

Comments

attributeInfo

dictionary

Deprecated.

cdpLevel

integer

CDP level to which neighbor devices to be discovered.

deviceIds

string

Ids of the devices discovered in a discovery.

discoveryCondition

string

To indicate the discovery status. Available options Complete or In Progress.

discoveryStatus

string

Status of the discovery. Available options are active, inactive, edit.

discoveryType

string

Type of the discovery. ‘SINGLE’, ‘RANGE’, ‘MULTI RANGE’, ‘CDP’, ‘LLDP’, ‘CIDR’.

dnac_debug

boolean

Flag for Cisco DNA Center SDK to enable debugging.

Choices:

  • false ← (default)

  • true

dnac_host

string / required

The Cisco DNA Center hostname.

dnac_password

string

The Cisco DNA Center password to authenticate.

dnac_port

integer

The Cisco DNA Center port.

Default: 443

dnac_username

aliases: user

string

The Cisco DNA Center username to authenticate.

Default: "admin"

dnac_verify

boolean

Flag to enable or disable SSL certificate verification.

Choices:

  • false

  • true ← (default)

dnac_version

string

Informs the SDK which version of Cisco DNA Center to use.

Default: "2.3.7.6"

enablePasswordList

string

Enable Password of the devices to be discovered.

globalCredentialIdList

list / elements=string

List of global credential ids to be used.

httpReadCredential

dictionary

Discovery’s httpReadCredential.

comments

string

Comments to identify the credential.

credentialType

string

Credential type to identify the application that uses the credential.

description

string

Description of the credential.

id

string

Credential Id.

instanceTenantId

string

Credential Tenant Id.

instanceUuid

string

Credential Id.

password

string

HTTP(S) password.

port

integer

HTTP(S) port.

secure

boolean

Flag for HTTPS.

Choices:

  • false

  • true

username

string

HTTP(S) username.

httpWriteCredential

dictionary

Discovery’s httpWriteCredential.

comments

string

Comments to identify the credential.

credentialType

string

Credential type to identify the application that uses the credential.

description

string

Description of the credential.

id

string

Credential Id.

instanceTenantId

string

Credential Tenant Id.

instanceUuid

string

Credential Id.

password

string

HTTP(S) password.

port

integer

HTTP(S) port.

secure

boolean

Flag for HTTPS.

Choices:

  • false

  • true

username

string

HTTP(S) username.

id

string

Unique Discovery Id.

ipAddressList

string

List of IP address of the devices to be discovered.

ipFilterList

string

IP addresses of the devices to be filtered.

isAutoCdp

boolean

Flag to mention if CDP discovery or not.

Choices:

  • false

  • true

lldpLevel

integer

LLDP level to which neighbor devices to be discovered.

name

string

Name for the discovery.

netconfPort

string

Netconf port on the device. Netconf will need valid sshv2 credentials for it to work.

numDevices

integer

Number of devices discovered in the discovery.

parentDiscoveryId

string

Parent Discovery Id from which the discovery was initiated.

passwordList

string

Password of the devices to be discovered.

preferredMgmtIPMethod

string

Preferred management IP method. Available options are ‘None’ and ‘UseLoopBack’.

protocolOrder

string

Order of protocol (ssh/telnet) in which device connection will be tried. Ex ‘telnet’ only telnet; ‘ssh,telnet’ ssh with higher order than telnet.

retry

integer

Number of times to try establishing connection to device.

retryCount

integer

Number of times to try establishing connection to device.

snmpAuthPassphrase

string

Auth passphrase for SNMP.

snmpAuthProtocol

string

SNMP auth protocol. SHA’ or ‘MD5’.

snmpMode

string

Mode of SNMP. ‘AUTHPRIV’ or ‘AUTHNOPRIV’ or ‘NOAUTHNOPRIV’.

snmpPrivPassphrase

string

Passphrase for SNMP privacy.

snmpPrivProtocol

string

SNMP privacy protocol. ‘AES128’.

snmpROCommunity

string

SNMP RO community of the devices to be discovered.

snmpRoCommunity

string

SNMP RO community of the devices to be discovered.

snmpROCommunityDesc

string

Description for SNMP RO community.

snmpRoCommunityDesc

string

Description for SNMP RO community.

snmpRWCommunity

string

SNMP RW community of the devices to be discovered.

snmpRwCommunity

string

SNMP RW community of the devices to be discovered.

snmpRWCommunityDesc

string

Description for SNMP RW community.

snmpRwCommunityDesc

string

Description for SNMP RW community.

snmpUserName

string

SNMP username of the device.

snmpVersion

string

Version of SNMP. V2 or v3.

timeOut

integer

Time to wait for device response.

timeout

integer

Time to wait for device response in seconds.

updateMgmtIp

boolean

Updates Management IP if multiple IPs are available for a device. If set to true, when a device is rediscovered with a different IP, the management IP is updated. Default value is false.

Choices:

  • false

  • true

userNameList

string

Username of the devices to be discovered.

validate_response_schema

boolean

Flag for Cisco DNA Center SDK to enable the validation of request bodies against a JSON schema.

Choices:

  • false

  • true ← (default)

Notes

Note

  • SDK Method used are discovery.Discovery.delete_discovery_by_id, discovery.Discovery.start_discovery, discovery.Discovery.updates_discovery_by_id,

  • Paths used are post /dna/intent/api/v1/discovery, delete /dna/intent/api/v1/discovery, delete /dna/intent/api/v1/discovery/{id}, put /dna/intent/api/v1/discovery,

  • Does not support check_mode

  • The plugin runs on the control node and does not use any ansible connection plugins, but instead the embedded connection manager from Cisco DNAC SDK

  • The parameters starting with dnac_ are used by the Cisco DNAC Python SDK to establish the connection

See Also

See also

Cisco DNA Center documentation for Discovery StartDiscovery

Complete reference of the StartDiscovery API.

Cisco DNA Center documentation for Discovery DeleteAllDiscovery

Complete reference of the DeleteAllDiscovery API.

Cisco DNA Center documentation for Discovery DeleteDiscoveryById

Complete reference of the DeleteDiscoveryById API.

Cisco DNA Center documentation for Discovery UpdatesAnExistingDiscoveryBySpecifiedId

Complete reference of the UpdatesAnExistingDiscoveryBySpecifiedId API.

Examples

- name: Delete all
  cisco.dnac.discovery:
    dnac_host: "{{dnac_host}}"
    dnac_username: "{{dnac_username}}"
    dnac_password: "{{dnac_password}}"
    dnac_verify: "{{dnac_verify}}"
    dnac_port: "{{dnac_port}}"
    dnac_version: "{{dnac_version}}"
    dnac_debug: "{{dnac_debug}}"
    state: absent

- name: Update all
  cisco.dnac.discovery:
    dnac_host: "{{dnac_host}}"
    dnac_username: "{{dnac_username}}"
    dnac_password: "{{dnac_password}}"
    dnac_verify: "{{dnac_verify}}"
    dnac_port: "{{dnac_port}}"
    dnac_version: "{{dnac_version}}"
    dnac_debug: "{{dnac_debug}}"
    state: present
    attributeInfo: {}
    cdpLevel: 0
    deviceIds: string
    discoveryCondition: string
    discoveryStatus: string
    discoveryType: string
    enablePasswordList: string
    globalCredentialIdList:
    - string
    httpReadCredential:
      comments: string
      credentialType: string
      description: string
      id: string
      instanceTenantId: string
      instanceUuid: string
      password: string
      port: 0
      secure: true
      username: string
    httpWriteCredential:
      comments: string
      credentialType: string
      description: string
      id: string
      instanceTenantId: string
      instanceUuid: string
      password: string
      port: 0
      secure: true
      username: string
    id: string
    ipAddressList: string
    ipFilterList: string
    isAutoCdp: true
    lldpLevel: 0
    name: string
    netconfPort: string
    numDevices: 0
    parentDiscoveryId: string
    passwordList: string
    preferredMgmtIPMethod: string
    protocolOrder: string
    retryCount: 0
    snmpAuthPassphrase: string
    snmpAuthProtocol: string
    snmpMode: string
    snmpPrivPassphrase: string
    snmpPrivProtocol: string
    snmpRoCommunity: string
    snmpRoCommunityDesc: string
    snmpRwCommunity: string
    snmpRwCommunityDesc: string
    snmpUserName: string
    timeOut: 0
    updateMgmtIp: true
    userNameList: string

- name: Create
  cisco.dnac.discovery:
    dnac_host: "{{dnac_host}}"
    dnac_username: "{{dnac_username}}"
    dnac_password: "{{dnac_password}}"
    dnac_verify: "{{dnac_verify}}"
    dnac_port: "{{dnac_port}}"
    dnac_version: "{{dnac_version}}"
    dnac_debug: "{{dnac_debug}}"
    state: present
    cdpLevel: 0
    discoveryType: string
    enablePasswordList:
    - string
    globalCredentialIdList:
    - string
    httpReadCredential:
      password: string
      port: 0
      secure: true
      username: string
    httpWriteCredential:
      password: string
      port: 0
      secure: true
      username: string
    ipAddressList: string
    ipFilterList:
    - string
    lldpLevel: 0
    name: string
    netconfPort: string
    passwordList:
    - string
    preferredMgmtIPMethod: string
    protocolOrder: string
    retry: 0
    snmpAuthPassphrase: string
    snmpAuthProtocol: string
    snmpMode: string
    snmpPrivPassphrase: string
    snmpPrivProtocol: string
    snmpROCommunity: string
    snmpROCommunityDesc: string
    snmpRWCommunity: string
    snmpRWCommunityDesc: string
    snmpUserName: string
    snmpVersion: string
    timeout: 0
    userNameList:
    - string

- name: Delete by id
  cisco.dnac.discovery:
    dnac_host: "{{dnac_host}}"
    dnac_username: "{{dnac_username}}"
    dnac_password: "{{dnac_password}}"
    dnac_verify: "{{dnac_verify}}"
    dnac_port: "{{dnac_port}}"
    dnac_version: "{{dnac_version}}"
    dnac_debug: "{{dnac_debug}}"
    state: absent
    id: string

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

dnac_response

dictionary

A dictionary or list with the response returned by the Cisco DNAC Python SDK

Returned: always

Sample: {"response": {"taskId": "string", "url": "string"}, "version": "string"}

Authors

  • Rafael Campos (@racampos)