42 lines
1.2 KiB
YAML
42 lines
1.2 KiB
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 all Site
|
|
cisco.dnac.site_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: sda_sites
|
|
|
|
- name: Print 1
|
|
ansible.builtin.debug:
|
|
msg: "{{ sda_sites['dnac_response']['response'][1]['siteNameHierarchy'] }}"
|
|
|
|
|
|
- name: Get network device list
|
|
cisco.dnac.sda_virtual_network_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 }}"
|
|
virtualNetworkName: CORP_VN
|
|
# siteNameHierarchy: "{{ sda_sites['dnac_response']['response'][1]['siteNameHierarchy'] }}"
|
|
register: result
|
|
|
|
- name: Print 2
|
|
ansible.builtin.debug:
|
|
msg: "{{ result }}"
|