---
- name: Take running config backup of devices
  hosts: localhost
  connection: local
  gather_facts: false  # This space must be "no". It was set to false due to formatting errors.but the correct value is "no".

  vars_files:
    - "{{ CLUSTERFILE }}"

  vars:
    dnac_login: &dnac_login
      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_level: "DEBUG"

  tasks:
    - name: Take backup of a wired 9500 switch
      cisco.dnac.device_configs_backup_workflow_manager:
        <<: *dnac_login
        dnac_log: true
        state: merged
        config_verify: true
        config:
          - hostname: NY-BN-9500.cisco.local
            file_path: /home/admin/madhan_ansible/collections/ansible_collections/cisco/dnac/playbooks/new_tmp

    - name: Take backup of all the switches
      cisco.dnac.device_configs_backup_workflow_manager:
        <<: *dnac_login
        dnac_log: true
        state: merged
        config_verify: true
        config:
          - family: Switches and Hubs
