-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaci_queries.yml
101 lines (89 loc) · 2.58 KB
/
aci_queries.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# This playbook will use the ACI API REST module.
---
- hosts: 172.16.10.177
gather_facts: no
connection: local
vars:
aci_login: &aci_login
host: 172.16.10.177
username: 'admin'
password: 'MyACILab23!'
validate_certs: false
# API: https://{{apic}}/api/aaaLogin.json
tasks:
- name: Get tenants using password authentication
cisco.aci.aci_rest:
# Manage tenants (fv:Tenant)
# API: https://{{apic}}/api/node/mo/uni/tn-{{TENANT}}.xml
<<: *aci_login
method: get
path: /api/node/class/fvTenant.json
delegate_to: localhost
register: query_result
tags:
- list_tenants
- name: Print tenants
ansible.builtin.debug:
var: query_result
tags:
- list_tenants
- name: Display tenant and subtree
cisco.aci.aci_rest:
# Manage tenants (fv:Tenant)
# API: https://{{apic}}/api/node/mo/uni/tn-{{TENANT}}.json
<<: *aci_login
method: get
path: /api/node/mo/uni/tn-MATLAB.json?query-target=subtree
delegate_to: localhost
register: query_result
tags:
- show_tenant
- name: Print tenants
ansible.builtin.debug:
var: query_result
tags:
- show_tenant
- name: Display Application Profile (AP) and subtree
cisco.aci.aci_rest:
# Manage tenants (fv:Tenant)
# API: https://{{apic}}/api/node/mo/uni/tn-{{tenant}}/ap-App-1_AP.xml?query-target=subtree
<<: *aci_login
method: get
path: /api/node/mo/uni/tn-MATLAB/ap-App-1_AP.xml?query-target=subtree
delegate_to: localhost
register: query_result
tags:
- show_ap
- name: Print tenants
ansible.builtin.debug:
var: query_result
tags:
- show_ap
- name: Query all controllers system information
cisco.aci.aci_system:
<<: *aci_login
state: query
delegate_to: localhost
register: query_result
tags:
- controllers
- name: Print controllers state data
ansible.builtin.debug:
var: query_result
tags:
- controllers
- name: Display all nodes inventory
cisco.aci.aci_rest:
# API: https://{{apic}}/api/node/class/fabricNode.json?query-target=subtree
<<: *aci_login
method: get
path: /api/node/class/fabricNode.json?query-target=subtree
delegate_to: localhost
register: query_result
tags:
- get_nodes
- name: Print tenants
ansible.builtin.debug:
var: query_result
tags:
- get_nodes