cisco.dnac.device_configs_backup_workflow_manager module – Device Configs Backup module for taking configuration backups of reachable devices in the Cisco Catalyst Center.

Note

This module is part of the cisco.dnac collection (version 6.22.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.device_configs_backup_workflow_manager.

New in cisco.dnac 6.14.0

Synopsis

  • Manage operation related to taking the backup of running config, static config and vlan.dat.bat

Requirements

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

  • dnacentersdk == 2.9.2

  • python >= 3.5

Parameters

Parameter

Comments

config

list / elements=dictionary / required

List of details of the devices for which configuration backups need to be taken.

At least one parameter from the suboptions must be provided in the config.

When providing multiple parameters at once (excluding “site_list”), all the filters will be applied together in an AND operation. This means that only the devices matching all the specified criteria will be included in the configuration backup operation. For example, if both `hostname` and `device_type` are provided, only devices matching both the specified hostname and device type will be selected.

Note - Once all devices matching the parameters are retrieved, any device that is not reachable or is an Access Point (AP) will be skipped.

collection_status

string

Specifies the list of collection status of the device(s) as displayed in the inventory GUI of the Cisco Catalyst Center.

For example - [“Managed”]

family

string

Specifies list of families for which device configuration backups need to be taken.

For example - [“Switches and Hubs”, “Routers”]

file_password

string

Optional file password for zipping and unzipping the config file.

Password must meet the following criteria - - Minimum password length is 8 - It should contain atleast one lower case letter, one uppercase letter, - one digit - one special characters from -=\\\\\\\\;,./~!@$%^&*()_+{}[]|:?”

file_path

string

The location or directory where the configuration backups need to be exported on the local system.

If the “file_path” is not provided, the backup file(s) will be stored in a directory named “tmp” in the same directory as the playbook.

Default: "tmp"

hostname_list

string

List of hostnames of the devices for which a configuration backup is to be taken.

The hostnames must be identical to those displayed under the inventory section in the Cisco Catalyst Center GUI.

For example - [“DC-T-9300.cisco.local”, “NY-BN-9300.cisco.local”]

ip_address_list

string

List of IP addresses of the devices for which configuration backups need to be taken.

The IP addresses should match those displayed in the inventory GUI of the Cisco Catalyst Center, specifically the management IP addresses of the devices.

For example - [“204.1.2.2”, “204.1.2.5”, “204.1.2.4”]

mac_address_list

string

Specifies list of MAC addresses of the devices for which configuration backups are to be taken.

serial_number_list

string

Specifies the list of serial numbers of the devices for which configuration backups need to be taken.

For example - [“FCW2225C020”, “FJB2334D06N”, “FJC2327U0S2”, “FJC2721271T”]

series

string

Specifies the list of series of the device(s) for a specific device type for which configuration backups need to be taken.

For example - [“Cisco Catalyst 9300 Series Switches”]

site_list

string

Specifies a list of sites. The module takes a configuration backup of all devices located within the specified site(s).

Each site should be represented as a string value that indicates the complete hierarchical path of the site.

For example - [“Global/USA/San Francisco/Building_2/floor_1”, “Global/USA/New York/Building_3/floor_2”]

Note - When additional parameters are provided along with `site_list`, the operation will include all devices in the specified site(s) and any devices matching the additional criteria (excluding `site_list`). In other words, the operation will be performed on devices within the site(s) and those that meet the additional criteria.

type

string

Specifies the list of types of device(s) from a specific device family for which configuration backups need to be taken.

For example - [“Cisco Catalyst 9300 Switch”, “Cisco Catalyst 9500 Switch”]

config_verify

boolean

Set to True to verify the Cisco Catalyst Center config after applying the playbook config.

Choices:

  • false ← (default)

  • true

dnac_api_task_timeout

integer

Defines the timeout in seconds for API calls to retrieve task details. If the task details are not received within this period, the process will end, and a timeout notification will be logged.

Default: 1200

dnac_debug

boolean

Indicates whether debugging is enabled in the Cisco Catalyst Center SDK.

Choices:

  • false ← (default)

  • true

dnac_host

string / required

The hostname of the Cisco Catalyst Center.

dnac_log

boolean

Flag to enable/disable playbook execution logging.

When true and dnac_log_file_path is provided, - Create the log file at the execution location with the specified name.

When true and dnac_log_file_path is not provided, - Create the log file at the execution location with the name ‘dnac.log’.

When false, - Logging is disabled.

If the log file doesn’t exist, - It is created in append or write mode based on the “dnac_log_append” flag.

If the log file exists, - It is overwritten or appended based on the “dnac_log_append” flag.

Choices:

  • false ← (default)

  • true

dnac_log_append

boolean

Determines the mode of the file. Set to True for ‘append’ mode. Set to False for ‘write’ mode.

Choices:

  • false

  • true ← (default)

dnac_log_file_path

string

Governs logging. Logs are recorded if dnac_log is True.

If path is not specified, - When ‘dnac_log_append’ is True, ‘dnac.log’ is generated in the current Ansible directory; logs are appended. - When ‘dnac_log_append’ is False, ‘dnac.log’ is generated; logs are overwritten.

If path is specified, - When ‘dnac_log_append’ is True, the file opens in append mode. - When ‘dnac_log_append’ is False, the file opens in write (w) mode. - In shared file scenarios, without append mode, content is overwritten after each module execution. - For a shared log file, set append to False for the 1st module (to overwrite); for subsequent modules, set append to True.

Default: "dnac.log"

dnac_log_level

string

Sets the threshold for log level. Messages with a level equal to or higher than this will be logged. Levels are listed in order of severity [CRITICAL, ERROR, WARNING, INFO, DEBUG].

CRITICAL indicates serious errors halting the program. Displays only CRITICAL messages.

ERROR indicates problems preventing a function. Displays ERROR and CRITICAL messages.

WARNING indicates potential future issues. Displays WARNING, ERROR, CRITICAL messages.

INFO tracks normal operation. Displays INFO, WARNING, ERROR, CRITICAL messages.

DEBUG provides detailed diagnostic info. Displays all log messages.

Default: "WARNING"

dnac_password

string

The password for authentication at the Cisco Catalyst Center.

dnac_port

string

Specifies the port number associated with the Cisco Catalyst Center.

Default: "443"

dnac_task_poll_interval

integer

Specifies the interval in seconds between successive calls to the API to retrieve task details.

Default: 2

dnac_username

aliases: user

string

The username for authentication at the Cisco Catalyst Center.

Default: "admin"

dnac_verify

boolean

Flag to enable or disable SSL certificate verification.

Choices:

  • false

  • true ← (default)

dnac_version

string

Specifies the version of the Cisco Catalyst Center that the SDK should use.

Default: "2.2.3.3"

state

string

The state of Cisco Catalyst Center after module completion.

Choices:

  • "merged" ← (default)

validate_response_schema

boolean

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

Choices:

  • false

  • true ← (default)

Notes

Note

  • SDK Methods used are sites.Sites.get_site Site_design.Site_design.get_sites sites.Sites.get_membership site_design.Site_design.get_site_assigned_network_devices devices.Devices.get_device_list devices.Devices.get_device_by_id configuration_archive.ConfigurationsArchive.export_device_configurations file.Files.download_a_file_by_fileid

  • Paths used are get /dna/intent/api/v1/site get /dna/intent/api/v1/membership/${siteId} get /dna/intent/api/v1/network-device post /dna/intent/api/v1/network-device-archive/cleartext get /dna/intent/api/v1/file/${fileId} get /dna/intent/api/v1/networkDevices/assignedToSite get /dna/intent/api/v1/sites get /dna/intent/api/v1/network-device/${id}

  • Does not support check_mode

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

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

Examples

- name: Take backup of all devices in the Cisco Catalyst Center
  cisco.dnac.device_configs_backup_workflow_manager:
    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}}"
    dnac_log: true
    dnac_log_level: "{{dnac_log_level}}"
    state: merged
    config:
        - file_password: qsaA12!asdasd

- name: Take backup of device(s) using hostname(s)
  cisco.dnac.device_configs_backup_workflow_manager:
    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}}"
    dnac_log: true
    dnac_log_level: "{{dnac_log_level}}"
    state: merged
    config:
        - hostname_list: ["DC-T-9300.cisco.local", "NY-BN-9300.cisco.local"]
          file_path: backup

- name: Take backup of device(s) using hostname(s) and provide file password
  cisco.dnac.device_configs_backup_workflow_manager:
    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}}"
    dnac_log: true
    dnac_log_level: "{{dnac_log_level}}"
    state: merged
    config:
        - hostname_list: ["DC-T-9300.cisco.local"]
          file_path: backup
          file_password: qsaA12!asdasd

- name: Take backup of all devices in a site(s)
  cisco.dnac.device_configs_backup_workflow_manager:
    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}}"
    dnac_log: true
    dnac_log_level: "{{dnac_log_level}}"
    state: merged
    config:
        - site_list: ["Global/USA/RTP/BLD10", "Global/USA/New York/BLDNYC/FLOOR1"]
          file_path: backup

- name: Take backup of device(s) using IP Address List
  cisco.dnac.device_configs_backup_workflow_manager:
    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}}"
    dnac_log: true
    dnac_log_level: "{{dnac_log_level}}"
    state: merged
    config:
        - ip_address_list: ["204.1.2.5", "204.1.2.4", "204.1.2.2"]
          file_path: backup

- name: Take backup of device(s) using MAC Address List
  cisco.dnac.device_configs_backup_workflow_manager:
    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}}"
    dnac_log: true
    dnac_log_level: "{{dnac_log_level}}"
    state: merged
    config:
        - mac_address_list: ["d4:ad:bd:c1:67:00", " 00:b6:70:32:b8:00", "0c:75:bd:42:c3:80", "90:88:55:07:59:00"]
          file_path: backup

- name: Take backup of device(s) using Serial Number List
  cisco.dnac.device_configs_backup_workflow_manager:
    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}}"
    dnac_log: true
    dnac_log_level: "{{dnac_log_level}}"
    state: merged
    config:
        - serial_number_list: ["FCW2225C020", "FJB2334D06N", "FJC2327U0S2", "FJC2721271T"]
          file_path: backup

- name: Take backup of device(s) using Family List
  cisco.dnac.device_configs_backup_workflow_manager:
    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}}"
    dnac_log: true
    dnac_log_level: "{{dnac_log_level}}"
    state: merged
    config:
        - family_list: ["Switches and Hubs", "Routers"]
          file_path: backup

- name: Take backup of device(s) using Device Family Type List
  cisco.dnac.device_configs_backup_workflow_manager:
    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}}"
    dnac_log: true
    dnac_log_level: "{{dnac_log_level}}"
    state: merged
    config:
        - type_list: ["Cisco Catalyst 9300 Switch"]
          file_path: backup

- name: Take backup of device(s) using Device Series
  cisco.dnac.device_configs_backup_workflow_manager:
    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}}"
    dnac_log: true
    dnac_log_level: "{{dnac_log_level}}"
    state: merged
    config:
        - series_list: ["Cisco Catalyst 9300 Series Switches"]
          file_path: backup

- name: Take backup of devices with certain Collection Status
  cisco.dnac.device_configs_backup_workflow_manager:
    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}}"
    dnac_log: true
    dnac_log_level: "{{dnac_log_level}}"
    state: merged
    config:
        - collection_status_list: ["Managed"]
          file_path: backup

- name: Take backup of device(s) in a site and also that meet other parameters
  cisco.dnac.device_configs_backup_workflow_manager:
    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}}"
    dnac_log: true
    dnac_log_level: "{{dnac_log_level}}"
    state: merged
    config:
        - site_list: ["Global"]
          family_list: ["Switches and Hubs"]
          series_list: ["Cisco Catalyst 9300 Series Switches"]
          ip_address_list: ["204.1.2.5"]
          file_path: backup

Return Values

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

Key

Description

response_1

dictionary

A dictionary with with the response returned by the Cisco Catalyst Center Python SDK

Returned: always

Sample: "{\n  \"response\":\n    {\n      \"response\": String,\n      \"version\": String\n    },\n  \"msg\": String\n}\n"

response_2

list / elements=string

A string with the response returned by the Cisco Catalyst Center Python SDK

Returned: always

Sample: ["{\n  \"response\": []", "\n  \"msg\": String\n}\n"]

Authors

  • Abinash Mishra (@abimishr) Rugvedi Kapse (@rukapse) Madhan Sankaranarayanan (@madhansansel) Sonali Deepthi Kesali (@skesali)