# Get data from Cisco Catalyst Center using Ansible

**URL:** <https://forum.ansible.com/t/get-data-from-cisco-catalyst-center-using-ansible/39784>\
**Category:** Get Help\
**Tags:** cisco\
**Created:** [January 23, 2025, 2:05pm UTC](https://forum.ansible.com/t/get-data-from-cisco-catalyst-center-using-ansible/39784 "2025-01-23T14:05:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pusaklazoss](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/pusaklazoss/32/7288_2.png) [@pusaklazoss](https://forum.ansible.com/u/pusaklazoss)\
**Post date:** [January 23, 2025, 2:05pm UTC](https://forum.ansible.com/t/get-data-from-cisco-catalyst-center-using-ansible/39784/1 "2025-01-23T14:05:27Z")

</div>

I am trying to get some info out of Cisco Catalyst center using Ansible. I followed [This tutorial.](https://developer.cisco.com/docs/dna-center/ansible/#ansible-modules-for-dna-center).

As far as I can tell everything is installed correctly.

Im using Cisco sandbox for the Catalyst center and VPN is connected to it.

This is my host file:

```auto
dnac_servers:
  hosts:
    dnac_server:
      dnac_host: xx.xx.xx.xx
      dnac_port: 443
      dnac_username: user
      dnac_password: password

```

This is my playbook:

```auto
- hosts: dnac_servers
  tasks:
  - name: DNA test
    cisco.dnac.device_details_info:
      identifier: string
      searchBy: string
    register: result

```

And the error I get when trying to run:

> ansible-playbook -i hosts.yml playbook.yml

> PLAY [dnac\_servers] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> fatal: [dnac\_server]: UNREACHABLE! =\> {“changed”: false, “msg”: “Failed to connect to the host via ssh: ssh: Could not resolve hostname dnac\_server: Temporary failure in name resolution”, “unreachable”: true}  
> PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> dnac\_server : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0

I see that there is some problem with resolving the server address. But I cant get around it.

I have searched google for different ways how to define host file etc. Yet I don’t get why this is not working after the mentioned tutorial.

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [January 23, 2025, 2:41pm UTC](https://forum.ansible.com/t/get-data-from-cisco-catalyst-center-using-ansible/39784/2 "2025-01-23T14:41:25Z")

</div>

Does it help if you add a `ansible_host` variable pointing to the IP address? I think this might resolve the _“Could not resolve hostname dnac\_server”_ error?

Also the YAML hosts files I have are in the following format, however I realise that what you have [matches the documentation](https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#inventory-basics-formats-hosts-and-groups), so perhaps this isn’t an issue? 🤷

```yaml
all:
  children:
    dnac_servers:
      hosts:
        dnac_server:
          ansible_host: xx.xx.xx.xx
          dnac_host: xx.xx.xx.xx
          dnac_port: 443
          dnac_username: user
          dnac_password: password

```
