Debian Codegraph @

ansible_collections/cisco/meraki/README.md

raw
1 # Ansible Modules for Meraki
2
3 The Meraki-Ansible project provides an Ansible collection for managing and automating your Cisco Meraki environment. It consists of a set of modules and roles for performing tasks related to Meraki.
4
5 ## Requirements
6
7 - Ansible >= 2.14
8 - [Python Meraki SDK](https://github.com/meraki/dashboard-api-python) v1.33.0 or newer
9 - Python >= 3.6, as the Meraki SDK doesn't support Python version 2.x
10
11 ## Installation
12
13 1. Install the collection from Ansible Automation Hub or Galaxy:
14
15 ```
16 ansible-galaxy collection install cisco.meraki -f
17 ```
18
19 2. Install the Python Meraki SDK:
20
21 ```
22 pip install meraki
23 ```
24
25 3. Make your Meraki API key available to the playbook. You can use an environment variable:
26
27 ```
28 export MERAKI_DASHBOARD_API_KEY=<your_api_key>
29 ```
30
31 > **Note:** Storing your API key in an unencrypted text file is not recommended for security reasons. Consider using Ansible Vault or AAP credentials.
32
33 4. Create a `hosts` ([example](https://github.com/meraki/dashboard-api-ansible/blob/main/playbooks/hosts)) file:
34
35 ```
36 [meraki_servers]
37 meraki_server
38 ```
39
40 ## Use Cases
41
42 ### 1. Retrieve administrator identity
43
44 Verify which Meraki admin account is being used by the API key:
45
46 ```yaml
47 ---
48 - name: Get administered identities
49 hosts: meraki_servers
50 gather_facts: false
51 tasks:
52 - name: Get my administered identities
53 cisco.meraki.administered_identities_me_info:
54 meraki_api_key: "{{ meraki_api_key }}"
55 register: result
56
57 - name: Show result
58 ansible.builtin.debug:
59 msg: "{{ result }}"
60 ```
61
62 ### 2. Manage network webhooks
63
64 Create an HTTP server webhook for a Meraki network to receive alert notifications:
65
66 ```yaml
67 ---
68 - name: Configure network webhook
69 hosts: meraki_servers
70 gather_facts: false
71 tasks:
72 - name: Create webhook
73 cisco.meraki.networks_webhooks_http_servers:
74 meraki_api_key: "{{ meraki_api_key }}"
75 state: present
76 name: MyWebhook
77 networkId: "{{ network_id }}"
78 payloadTemplate:
79 name: Slack (included)
80 payloadTemplateId: wpt_00001
81 sharedSecret: "{{ webhook_secret }}"
82 url: https://webhook.example.com/
83 ```
84
85 ### 3. Configure wireless settings
86
87 Enable or disable multicast-to-unicast conversion for a network's wireless settings:
88
89 ```yaml
90 ---
91 - name: Update wireless settings
92 hosts: meraki_servers
93 gather_facts: false
94 tasks:
95 - name: Enable multicast-to-unicast conversion
96 cisco.meraki.networks_wireless_settings:
97 meraki_api_key: "{{ meraki_api_key }}"
98 state: present
99 networkId: "{{ network_id }}"
100 ipv6BridgeEnabled: false
101 locationAnalyticsEnabled: false
102 meshingEnabled: true
103 upgradeStrategy: minimizeUpgradeTime
104 ```
105
106 ### 4. Query organization inventory
107
108 Retrieve device inventory for an organization, including End-of-Life status information:
109
110 ```yaml
111 ---
112 - name: Get organization inventory
113 hosts: meraki_servers
114 gather_facts: false
115 tasks:
116 - name: Retrieve inventory devices
117 cisco.meraki.organizations_inventory_devices_info:
118 meraki_api_key: "{{ meraki_api_key }}"
119 organizationId: "{{ org_id }}"
120 register: inventory
121
122 - name: Show inventory
123 ansible.builtin.debug:
124 msg: "{{ inventory }}"
125 ```
126
127 ### 5. Manage organization appliance VPN peers
128
129 Configure third-party VPN peers for an organization's appliances:
130
131 ```yaml
132 ---
133 - name: Configure third-party VPN peers
134 hosts: meraki_servers
135 gather_facts: false
136 tasks:
137 - name: Update VPN peers
138 cisco.meraki.organizations_appliance_vpn_third_party_vpn_peers:
139 meraki_api_key: "{{ meraki_api_key }}"
140 state: present
141 organizationId: "{{ org_id }}"
142 peers:
143 - name: RemoteSite
144 publicIp: 198.51.100.1
145 privateSubnets:
146 - 192.168.100.0/24
147 secret: "{{ vpn_secret }}"
148 ikeVersion: "2"
149 ```
150
151 ## Testing
152
153 This collection has been tested against the following environments:
154
155 | Cisco Meraki Dashboard API | Ansible "cisco.meraki" | Python "meraki" SDK |
156 |----------------------------|------------------------|---------------------|
157 | 1.33.0 | 2.17.0 | 1.33.0 |
158 | 1.44.1 | 2.18.3 | 1.44.1 |
159 | 1.53.0 | 2.20.8 | 1.53.0 |
160 | 1.57.0 | 2.21.2 | 1.57.0 |
161 | 1.68.0 | 2.23.0 | 2.2.0 |
162
163 *Notes*:
164
165 1. The "Python `meraki` SDK version" column shows the minimum recommended version used during testing. Later versions of the SDK may also be used.
166 2. The "Cisco Meraki Dashboard API" column corresponds to the `meraki_version` value you should use with this collection.
167 3. This collection is not compatible with versions of Ansible before v2.14.
168
169 ### Known issues
170
171 **macOS users** may encounter the following error when running playbooks:
172
173 ```
174 objc[34120]: +[__NSCFConstantString initialize] may have been in progress in
175 another thread when fork() was called. We cannot safely call it or ignore it
176 in the fork() child process. Crashing instead.
177 ERROR! A worker was found in a dead state
178 ```
179
180 Set the following environment variable to resolve this:
181
182 ```
183 export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
184 ```
185
186 ## Support
187
188 As Red Hat Ansible Certified Content, this collection is entitled to support through the Ansible Automation Platform (AAP) using the **Create issue** button on the top right corner. If a support case cannot be opened with Red Hat and the collection has been obtained either from Galaxy or GitHub, there may be community help available on the [Ansible Forum](https://forum.ansible.com/).
189
190 ## Release Notes and Roadmap
191
192 See the full [Changelog](https://github.com/meraki/dashboard-api-ansible/blob/main/CHANGELOG.rst) for release history.
193
194 This collection follows [Semantic Versioning](https://semver.org/). More details on versioning can be found [in the Ansible docs](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html#collection-versions).
195
196 New minor and major releases as well as deprecations will follow new releases and deprecations of the Cisco Meraki product, its REST API and the corresponding Python SDK, which this project relies on.
197
198 ## Related Information
199
200 - [Meraki Ansible Collection Documentation](https://docs.ansible.com/ansible/latest/collections/cisco/meraki/index.html)
201 - [Meraki Dashboard API Documentation](https://meraki.io/api)
202 - [DevNet Learning Lab](https://developer.cisco.com/learning/labs/meraki-dashboard-ansible/introduction/)
203 - [DevNet Sandbox](https://devnetsandbox.cisco.com/RM/Diagram/Index/a9487767-deef-4855-b3e3-880e7f39eadc?diagramType=Topology)
204 - [Ansible Galaxy: cisco.meraki](https://galaxy.ansible.com/cisco/meraki)
205
206 ## Contributing to this collection
207
208 Ongoing development efforts and contributions to this collection are tracked as issues in this repository.
209
210 We welcome community contributions to this collection. If you find problems, need an enhancement, or need a new module, please open an issue or create a PR against the [Cisco Meraki Ansible collection repository](https://github.com/meraki/dashboard-api-ansible/issues).
211
212 This collection follows the Ansible project's [Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html). Please read and familiarize yourself with this document.
213
214 ## Module migration
215
216 The modules that were there before, usually with a `meraki` prefix, are maintained until version 2.x.x, with the same structure used in previous versions. The old modules will disappear in the next major release and only the new modules will remain. Each old module has its deprecation marking indicating which is the new equivalent.
217
218 ### Example
219
220 Old module:
221
222 ```yaml
223 - name: Create webhook
224 cisco.meraki.meraki_webhook:
225 auth_key: abc123
226 state: present
227 org_name: YourOrg
228 net_name: YourNet
229 name: Test_Hookx
230 url: https://webhook.url/
231 shared_secret: shhhdonttellanyone
232 payload_template_name: 'Slack (included)'
233 delegate_to: localhost
234 ```
235
236 New module:
237
238 ```yaml
239 - name: Create webhook
240 cisco.meraki.networks_webhooks_http_servers:
241 meraki_api_key: "{{ meraki_api_key }}"
242 state: present
243 name: Test_Hook
244 networkId: "{{ network_id }}"
245 payloadTemplate:
246 name: Slack (included)
247 payloadTemplateId: wpt_00001
248 sharedSecret: shhhdonttellanyone
249 url: https://webhook.url/
250 ```
251
252 ## License
253
254 This project is licensed under the [GNU General Public License](https://github.com/meraki/dashboard-api-ansible/blob/main/LICENSE).