cisco.dnac.network_profile_switching_workflow_manager module – Resource module for managing switch profiles in Cisco Catalyst Center

Note

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

New in cisco.dnac 6.31.0

Synopsis

  • This module facilitates the creation and deletion of network switch profiles in Cisco Catalyst Center. - Supports creating and deleting switch profiles. - Enables assignment of profiles to sites, onboarding templates, and Day-N templates.

Requirements

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

  • dnacentersdk >= 2.8.6

  • python >= 3.9

Parameters

Parameter

Comments

config

list / elements=dictionary / required

A list containing the details required for network switch profile creation.

day_n_templates

list / elements=string

A list of Day-N template names assigned to the profile.

onboarding_templates

list / elements=string

A list of onboarding template names assigned to the profile. Note: Onboarding templates are currently unavailable due to SDK/API constraints.

profile_name

string / required

The name of the switch profile to be created.

site_names

list / elements=string

A list of site names specified in the full site hierarchy format. For example: ‘Global/Country/City/Building’.

config_verify

boolean

Set to `True` to enable configuration verification on Cisco Catalyst Center after applying the playbook configuration. This ensures that the system validates the configuration state after the changes are applied.

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

Specifies the desired state for the configuration. If set to `merged`, the module will create or update the configuration by adding new settings or modifying existing ones. If set to `deleted`, the module will remove the specified settings.

Choices:

  • "merged" ← (default)

  • "deleted"

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

  • This module utilizes the following SDK methods site_design.retrieves_the_list_of_sites_that_the_given_network_profile_for_sites_is_assigned_to_v1 site_design.assign_sites site_design.retrieves_the_list_of_network_profiles_for_sites_v1 site_design.assign_a_network_profile_for_sites_to_the_given_site_v1 site_design.unassigns_a_network_profile_for_sites_from_multiple_sites_v1 site_design.deletes_a_network_profile_for_sites_v1 configuration_templates.gets_the_templates_available_v1 network_settings.retrieve_cli_templates_attached_to_a_network_profile_v1

  • The following API paths are used GET /dna/intent/api/v1/networkProfilesForSites GET /dna/intent/api/v1/template-programmer/template GET /dna/intent/api/v1/networkProfilesForSites/{profileId}/templates POST /dna/intent/api/v1/networkProfilesForSites/{profileId}/siteAssignments POST /dna/intent/api/v1/networkProfilesForSites/{profileId}/siteAssignments/bulk POST /api/v1/siteprofile

  • 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

---
- hosts: dnac_servers
  vars_files:
    - credentials.yml
  gather_facts: false
  connection: local
  tasks:
    - name: Create network profile for switch
      cisco.dnac.network_profile_switching_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: DEBUG
        config_verify: true
        dnac_api_task_timeout: 1000
        dnac_task_poll_interval: 1
        state: merged
        config:
          - profile_name: "Campus_Switching_Profile"
            day_n_templates:
              - "Campus_Switch_Config_Update"
            site_names:
              - "Global/Chennai"
              - "Global/Abc"
    - name: Update network profile for switch
      cisco.dnac.network_profile_switching_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: DEBUG
        config_verify: true
        dnac_api_task_timeout: 1000
        dnac_task_poll_interval: 1
        state: merged
        config:
          - profile_name: "Enterprise_Switching_Profile"
            day_n_templates:
              - "Periodic_Config_Audit"
            site_names:
              - "Global/India/Chennai/Main_Office"
              - "Global/India/Madurai/Branch_Office"
              - "Global/USA/San Francisco/Regional_HQ"
    - name: Idempotent redelete multiple switching profile
      cisco.dnac.network_profile_switching_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: DEBUG
        config_verify: true
        dnac_api_task_timeout: 1000
        dnac_task_poll_interval: 1
        state: deleted
        config:
          - profile_name: Enterprise_Switching_Profile
          - profile_name: Local_Switching_Profile

    # Delete a switching profile by providing its profile name
    - name: Delete Specified Switching Profile
      cisco.dnac.network_profile_switching_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: DEBUG
        config_verify: true
        dnac_api_task_timeout: 1000
        dnac_task_poll_interval: 1
        state: deleted
        config:
          - profile_name: Enterprise_Switching_Profile

    # Unassign sites from a switching profile but do not delete the profile
    - name: Unassign Sites from Switching Profile
      cisco.dnac.network_profile_switching_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: DEBUG
        config_verify: true
        dnac_api_task_timeout: 1000
        dnac_task_poll_interval: 1
        state: deleted
        config:
          - profile_name: Enterprise_Switching_Profile
            site_names:
              - Global/India/Chennai/Main_Office

    # Unassign a template from a switching profile but do not delete the profile
    - name: Unassign Template from Switching Profile
      cisco.dnac.network_profile_switching_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: DEBUG
        config_verify: true
        dnac_api_task_timeout: 1000
        dnac_task_poll_interval: 1
        state: deleted
        config:
          - profile_name: Enterprise_Switching_Profile
            day_n_templates:
              - Periodic_Config_Audit

Return Values

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

Key

Description

response_create

dictionary

A dictionary or list containing the response returned by the Cisco Catalyst Center Python SDK when a switch profile is successfully created. The response confirms the successful creation of the profile and provides details about the profile, including its name and status.

Returned: always

Sample: {"msg": "Profile created/updated are verified successfully for '['Enterprise_Access_Switch']'.", "response": [{"profile_name": "Enterprise_Access_Switch", "status": "Network Profile [487bf1e8-b014-4cc7-9e33-1ea7c2805b4c] Successfully Created"}], "status": "success"}

response_delete_idempotent

dictionary

A dictionary or list containing the response returned by the Cisco Catalyst Center Python SDK. This response is provided when attempting to delete switching profiles in an idempotent manner. If the profiles are already deleted, the response indicates that no changes were required.

Returned: always

Sample: {"msg": "No changes required, profile(s) are already deleted.", "response": "No changes required, profile(s) are already deleted.", "status": "success"}

response_delete_profile

dictionary

A dictionary or list containing the response returned by the Cisco Catalyst Center Python SDK when a switch profile is successfully deleted or unassigned. The response confirms the deletion/unassignment and provides details of the profile and its associated operations.

Returned: always

Sample: {"msg": "Switch profile(s) deleted/unassigned and verified successfully for '['Enterprise_Switching_Profile']'.", "response": [{"profile_name": "Enterprise_Switching_Profile", "site_unassign_status": "Site(s) are unassigned successfully.", "status": "Network profile [740ebd91-4f82-42ac-bbca-94393f0cc799] successfully deleted"}], "status": "success"}

response_unassign_site

dictionary

A dictionary or list containing the response returned by the Cisco Catalyst Center Python SDK when a site is successfully unassigned from a switch profile. The response confirms the unassignment and provides details about the profile and site(s) affected.

Returned: always

Sample: {"msg": "Switch profile(s) deleted/unassigned and verified successfully for '['Enterprise_Switching_Profile']'.", "response": [{"profile_name": "Enterprise_Switching_Profile", "site_unassign_status": "Site(s) '['Global/India/Chennai/Main_Office']' unassigned successfully."}], "status": "success"}

response_unassign_template

dictionary

A dictionary or list containing the response returned by the Cisco Catalyst Center Python SDK when a template is successfully unassigned from a switch profile. The response confirms the unassignment and provides details about the profile and the template(s) affected.

Returned: always

Sample: {"msg": "Switch profile(s) deleted/unassigned and verified successfully for '['Enterprise_Switching_Profile']'.", "response": [{"profile_name": "Enterprise_Switching_Profile", "template_unassign_status": "Template(s) '['Periodic_Config_Audit']' unassigned successfully."}], "status": "success"}

response_update

dictionary

A dictionary or list containing the response returned by the Cisco Catalyst Center Python SDK when a switch profile is successfully updated. The response confirms the successful update of the profile and provides details about the profile, including its name and status.

Returned: always

Sample: {"msg": "Profile created/updated are verified successfully for '['Campus_Core_Switch_Profile']'.", "response": [{"profile_name": "Campus_Core_Switch_Profile", "status": "Network profile 'Campus_Core_Switch_Profile' updated successfully"}], "status": "success"}

Authors

  • A Mohamed Rafeek (@mabdulk2)

  • Madhan Sankaranarayanan (@madhansansel)