Meraki Cheat Sheet Red Hat Developer
Meraki Cheat Sheet Red Hat Developer
Cheat sheet
The example in this cheat sheet configures GitHub to send notifications about events through a Webhook. Typical
events in GitHub include configuration changes and pushes to the repository. The Webhook sends an HTTP POST
request to Ansible to trigger an Ansible automation job.
If you don’t already administer a network with a Meraki account, you can follow the steps in this cheat sheet by
signing up for the Cisco Devnet Sandbox Lab for Meraki Small Business, which allows you an eight-hour reservation
(session) by default. After the reservation is ready, the sandbox lab gives you administrative access to configure
wireless connections and networking for your specific settings.
1. Reserve a Cisco DevNet sandbox if you do not have your own Meraki environment (optional).
2. Configure access through the Cisco Meraki dashboard, to allow provisioning from Ansible.
3. Configure a GitHub repository with your wireless settings.
4. Configure the Ansible organization, project, credentials, and execution environment.
5. Enable a GitHub trigger to invoke Ansible.
6. Test the system by creating an automatic trigger.
The automated process of handling an event passes through the following components in order:
1. GitHub repo (which sends the trigger through a Webhook)
2. Ansible
3. Meraki Dashboard Controller API
4. Network device (access point)
Figure 1: The Meraki Small Business sandbox in the Cisco DevNet web interface.
Once you log in with your Cisco DevNet credentials, click on the Reserve button (Figure 2). After you reconfirm the
reservation, the sandbox triggers a setup job.
Wait about five minutes to get a confirmation mail with the credentials you will use to log into the Cisco Meraki
dashboard. You might get the username and will be asked to reset your password.
When you connect to the Meraki dashboard, a anonymized network is created with a name based on your email
address. In my case, the network name is DNSMB4-dxxxxxlgmail.com . This network grants you write access, and should be
used throughout this entire demo.
Once you find your assigned network, click on it to view its statistics (Figure 4).
Red Hat
developers.redhat.com redhat-developer @rhdevelopers
Developer
Figure 5: Navigate to the Organization configuration page to locate the Dashboard API access setting.
• Click the Profile link from Organization→Configure→Dashboard API access and go to API access.
• Select the user icon from the top right corner. From there, select My profile followed by API access.
Once on this page, click Generate new API key (Figure 7).
Make sure you save the API key, because it will be available for copying only once. When you finish, click Done.
After you generate at least one API key, you can generate additional ones on the same page, or revoke a key (Figure
8). As a general practice, make sure to revoke API keys if you are not using them.
Red Hat
developers.redhat.com redhat-developer @rhdevelopers
Developer
Figure 8: You can generate additional API keys or revoke unused ones.
After every change, make sure to click on the Save Changes button to preserve the changes, or press cancel to
discard them.
The examples in this cheat sheet use this GitHub repository of network tests. Log in to GitHub with your credentials
and clone the repository to replicate the integration in this cheat sheet.
Edit your version of the network_vars.yml to change the first two properties, giving them the following values:
Also edit the SSIDs in network_vars.yml . For my environment, I edited SSIDs 2 and 3 so that the final playbook looked
like this:
Red Hat
developers.redhat.com redhat-developer @rhdevelopers
Developer
In my case, I had previously created a Meraki execution environment following the steps described in this blog and
the requirements.yml file had the following:
Red Hat
developers.redhat.com redhat-developer @rhdevelopers
Developer
collections:
-ansible.units
-cisco.meraki
Once I had the execution environment ready, I uploaded it into Quay to reuse for all my demos using Cisco Meraki
sandboxes. From the Access page, choose Organization (Figure 10).
Figure 12: Create a new Credential Type to add a configuration for the Meraki API key credentials.
Creating a project
Create a project by visiting Resources and choosing Projects. Figure 14 shows typical details for a project. In the
Source Control URL field, this project specifies the GitHub repository you created previously. In my case, I named
the repository https://github.com/dafmendo/gitops_ansible-sdwan.
If you select the Update revision on launch option (Figure 15), Ansible will automatically sync the project with the
latest version of the GitHub repository and import the latest changes.
Figure 15: Select the Update Revision on Launch option to enable automatically syncing.
I am enabling the PAT to track all changes in the repository (Figure 17), but GitHub allows a deeper granularity of
choices.
Figure 17: Defining the scope for tracking changes in the repository.
Once the PAT is created, make sure to copy it and save it, because you will not be able to view it in cleartext once you
leave the page.
Red Hat
developers.redhat.com redhat-developer @rhdevelopers
Developer
Figure 19: Create a new template in the Red Hat Ansible Automation Platform interface.
Red Hat
developers.redhat.com redhat-developer @rhdevelopers
Developer
Fill out the settings to use the “Configure SSID” playbook as shown in Figure 20.
Before you save your settings, enable a Webhook to execute the job template by checking the Enable Webhook
checkbox. Choose GitHub as the Webhook service as shown in Figure 21. A Webhook URL will be created.
Copy the URL of the Webhook, because you will use that URL later to configure the Webhook from GitHub.
Further down on the same page, configure the Webhook Credential (Figure 22).
Red Hat
developers.redhat.com redhat-developer @rhdevelopers
Developer
A Webhook key is automatically generated by Ansible once you press Save in the job template. Figure 23 shows the
details of the template, including the Webhook key.
Figure 23: The job template details with the Webhook key.
Choose Settings→Code and automation→Webhooks (Figure 25) and click Add webhook.
Complete the Payload URL and Secret fields with the information generated by Ansible after you created your job
template (Figure 26). The Content Type should be application/json . For the sake of simplicity I have disabled SSL
verification, but SSL verification is strongly recommended for production environments due to security concerns.
Red Hat
developers.redhat.com redhat-developer @rhdevelopers
Developer
Depending on your security settings, the Webhook addition might require two-step approval.
Red Hat
developers.redhat.com redhat-developer @rhdevelopers
Developer
In the Ansible dashboard, you can select Views→Jobs to observe the job execution.