ansible_cache/dnac/get_device_info.yml

26 lines
836 B
YAML

---
- name: DNAC test playbook - retrieves hostname, MGMT IP and SN for devices in the inventory and displays them
hosts: all
vars_files:
- credentials.yml
gather_facts: no
tasks:
- name: Get network device list
cisco.dnac.network_device_info:
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 }}"
register: result
- name: Print device info
ansible.builtin.debug:
msg: "Device {{ item['hostname'] }} is reachable on {{ item['managementIpAddress'] }} and has SN {{ item['serialNumber'] }}"
loop: "{{ result['dnac_response']['response'] }}"
loop_control:
label: result