Initial test of DNAC module for Ansible - not great...
This commit is contained in:
parent
18b099f5d8
commit
0677bd0255
19
dnac/credentials.yml
Normal file
19
dnac/credentials.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
|
32353864313261346632336363373830643332303964323331346636333034663531646636313737
|
||||||
|
3161656564643166346138643232326431323335323834340a336634323365376633323938613865
|
||||||
|
66663464313534633339303231353636333661363266336131383463613261373563633162303065
|
||||||
|
3862326433316265320a393466356266633464313165383330666237323737633865643763383665
|
||||||
|
63613932353263626531306431373833333666396361633039633363383864653637353161323230
|
||||||
|
33643234323864373434306131376235393363306334303036366232633436643663656139323562
|
||||||
|
65316261383939343363363962623434636239376139336366636166313931393461623863633230
|
||||||
|
38373232303666323661343934313732323865626464383965316562656436666265363939366265
|
||||||
|
64363734663532643636363231373432336435343334633233633236383937363561343334346166
|
||||||
|
30663039353034653066663434633036623563663931333063663337343531626633316263383630
|
||||||
|
39373163303764366533666538393438643764643936636430366334316232323734353561376436
|
||||||
|
31613136363631636662376339393034613831663530373939656236313264373465623930323431
|
||||||
|
36303532616466323031623937333234373938333266393862356639363338316563316462633662
|
||||||
|
61333436323431613266623235343637666435613661636465666538326437333461633664643137
|
||||||
|
66643636313538633165326137383064303331353336636265616265656164623439306562626366
|
||||||
|
35613135393564636562373863653762613130613365653837306539386431383831623133623961
|
||||||
|
62356664333731386336323831346236343466346665613264636630646130346366653237313363
|
||||||
|
3437303231326335646361383131313339643763303130626439
|
||||||
26
dnac/get_device_info.yml
Normal file
26
dnac/get_device_info.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
- 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
|
||||||
4
dnac/inventory.yml
Normal file
4
dnac/inventory.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
all:
|
||||||
|
hosts:
|
||||||
|
dnac.dnaclab.net:
|
||||||
41
dnac/main.yml
Normal file
41
dnac/main.yml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
---
|
||||||
|
- 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 }}"
|
||||||
@ -1,25 +1,25 @@
|
|||||||
---
|
---
|
||||||
all:
|
all:
|
||||||
children:
|
children:
|
||||||
services:
|
services:
|
||||||
hosts:
|
hosts:
|
||||||
ubuntu.dnaclab.net:
|
ubuntu.dnaclab.net:
|
||||||
telemetry:
|
telemetry:
|
||||||
hosts:
|
hosts:
|
||||||
telemetry.dnaclab.net:
|
telemetry.dnaclab.net:
|
||||||
developer:
|
developer:
|
||||||
hosts:
|
hosts:
|
||||||
developer.dnaclab.net:
|
developer.dnaclab.net:
|
||||||
gitlab:
|
gitlab:
|
||||||
hosts:
|
hosts:
|
||||||
gitlab.dnaclab.net:
|
gitlab.dnaclab.net:
|
||||||
test:
|
test:
|
||||||
hosts:
|
hosts:
|
||||||
test.dnaclab.net:
|
test.dnaclab.net:
|
||||||
all_servers:
|
all_servers:
|
||||||
hosts:
|
hosts:
|
||||||
ubuntu.dnaclab.net:
|
ubuntu.dnaclab.net:
|
||||||
telemetry.dnaclab.net:
|
telemetry.dnaclab.net:
|
||||||
developer.dnaclab.net:
|
developer.dnaclab.net:
|
||||||
gitlab.dnaclab.net:
|
gitlab.dnaclab.net:
|
||||||
test.dnaclab.net:
|
test.dnaclab.net:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user