-
Notifications
You must be signed in to change notification settings - Fork 6
/
meraki.yml
195 lines (167 loc) · 5.97 KB
/
meraki.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
---
# https://github.com/CiscoDevNet/ansible-meraki
# https://galaxy.ansible.com/cisco/meraki
# ansible-galaxy collection install cisco.meraki
# ansible-playbook meraki.yml
- name: Meraki Test
hosts: localhost
gather_facts: false
tasks:
- name: Query information about all organizations associated to the API user
cisco.meraki.meraki_organization:
auth_key: "{{ api_key }}"
state: query
delegate_to: localhost
register: orgs
- name: Print name of all available organizations
ansible.builtin.debug:
var: item.name
loop: "{{ orgs.data }}"
- name: Select one organization
ansible.builtin.set_fact:
organization: "{{ orgs.data[0].name }}"
cacheable: yes
- name: Print orn name test {{ organization }}
ansible.builtin.debug:
var: organization
- name: Query all devices in organization {{ org_name }}
cisco.meraki.meraki_device:
auth_key: "{{ api_key }}"
org_name: "{{ org_name }}"
state: query
register: devices
- name: Print all devices in organization {{ org_name }}
ansible.builtin.debug:
var: devices
# - name: Query management information
# cisco.meraki.meraki_management_interface:
# auth_key: "{{ api_key }}"
# org_name: "{{ org_name }}"
# state: query
# net_id: "{{ devices.data[16].network_id }}"
# serial: "{{ devices.data[16].serial }}"
# register: mgmt
# - ansible.builtin.debug:
# var: mgmt
# - name: Create a new organization named {{ org_name }}
# meraki_organization:
# auth_key: "{{ api_key }}"
# org_name: "{{ org_name }}"
# state: present
# delegate_to: localhost
- name: Query information about all administrators associated to the organization {{ org_name }}
cisco.meraki.meraki_admin:
auth_key: "{{ api_key }}"
org_name: "{{ org_name }}"
state: query
register: admins
- ansible.builtin.debug:
msg: "{{ admins }}"
# msg: " {{ admins.data[3].name }} at {{ admins.data[3].email }} has API Key -> {{ admins.data[3].has_api_key }}"
- name: Query SNMP settings in the {{ org_name }} organization
cisco.meraki.meraki_snmp:
auth_key: "{{ api_key }}"
org_name: "{{ org_name }}"
state: query
register: snmp
- ansible.builtin.debug:
var: snmp
- name: List all networks associated to the {{ org_name }} organization
cisco.meraki.meraki_network:
auth_key: "{{ api_key }}"
org_name: "{{ org_name }}"
state: query
register: nets
- name: Print out one network
ansible.builtin.debug:
var: nets.data[0]
- name: Query network named {{ nets.data[0].name }} in the {{ org_name }} organization
cisco.meraki.meraki_network:
auth_key: "{{ api_key }}"
org_name: "{{ org_name }}"
net_name: "{{ nets.data[0].name }}"
state: query
register: net
- name: Print out network data
ansible.builtin.debug:
var: net
- name: Query syslog configurations on network named {{ nets.data[0].name }} in the {{ org_name }} organization
cisco.meraki.meraki_syslog:
auth_key: "{{ api_key }}"
org_name: "{{ org_name }}"
net_name: "{{ nets.data[0].name }}"
state: query
register: syslog
- ansible.builtin.debug:
var: syslog
# - name: Enable VLANs on network {{ nets.data[0].name }}
# cisco.meraki.meraki_network:
# auth_key: "{{ api_key }}"
# org_name: "{{ org_name }}"
# net_name: "{{ nets.data[0].name }}"
# state: query
# enable_vlans: yes
# - name: Query all VLANs on network {{ nets.data[0].name }}
# cisco.meraki.meraki_vlan:
# auth_key: "{{ api_key }}"
# org_name: "{{ org_name }}"
# net_name: "{{ nets.data[0].name }}"
# state: query
# register: vlans
# - ansible.builtin.debug:
# var: vlans
- name: List SSID(s) on network {{ nets.data[0].name }}
cisco.meraki.meraki_ssid:
auth_key: "{{ api_key }}"
org_name: "{{ org_name }}"
net_name: "{{ nets.data[0].name }}"
state: query
register: ssids
- ansible.builtin.debug:
var: ssids.data[0]
# - name: Enable click-through splash page on {{ ssids.data[0].name }}
# cisco.meraki.meraki_ssid:
# auth_key: "{{ api_key }}"
# org_name: "{{ org_name }}"
# net_name: "{{ nets.data[0].name }}"
# state: present
# name: "{{ ssids.data[0].name }}"
# splash_page: Click-through splash page
# "orgs": {
# "changed": false,
# "data": [
# {
# "id": "681155",
# "name": "DeLab",
# "url": "https://n6.meraki.com/o/49Gm_c/manage/organization/overview"
# },
# {
# "id": "566327653141842188",
# "name": "DevNetAssoc",
# "url": "https://n6.meraki.com/o/dcGsWag/manage/organization/overview"
# },
# {
# "id": "549236",
# "name": "DevNet Sandbox",
# "url": "https://n149.meraki.com/o/-t35Mb/manage/organization/overview"
# },
# {
# "id": "52636",
# "name": "Forest City - Other",
# "url": "https://n42.meraki.com/o/E_utnd/manage/organization/overview"
# },
# {
# "id": "865776",
# "name": "Cisco Live US 2019",
# "url": "https://n22.meraki.com/o/CVQqTb/manage/organization/overview"
# },
# {
# "id": "463308",
# "name": "DevNet San Jose",
# "url": "https://n18.meraki.com/o/vB2D8a/manage/organization/overview"
# }
# ],
# "failed": false,
# "response": "OK (unknown bytes)",
# "status": 200
# }