Automating site deployments using Network and Switch templates with Ansible or Python+API

WojtekMitus
New here

Automating site deployments using Network and Switch templates with Ansible or Python+API

Hello, we are evaluating using Meraki solutions to deploy networks in office buildings of various sizes, and i would like to do deployments entirely in IaC model, leveraging Network Templates and Switch Templates to reuse standarized configurations as much as possible.

As i was not able to find a guide for such deployments, i would like to ask few questions here.

 

1. What would be proper workflow for defining and applying reusable configuration in dashboard? I'm assuming:

  - Create Network Template and configure all template configurations according to the needs

  - Create and configure Switch Templates inside a Network Template, which could be attached later to real devices

  - Create a Network from a Network Template - an actual site

  - Claim devices into the Network

  - Attach switch templates to devices, define and build switch stacks in the actual deployed Network (there are no stack templates, right?)

  - Configure exceptions on actual switch ports which would have to differ from applied templates

 

  Is this correct?

 

 2. Currently i am trying to map particular dashboard functions to appropriate Ansible modules which would configure that option, and i am not able to find a module for creating a Switch Template inside a Network Template, and configure ports in this template. Which module allows to do this?

 

 3. The same goes for API documentation, i am not able to find which API call would create Switch Templates in a Network Template and configure the ports in newly created Switch Template. I guess there is an API for that?

 

Thanks,

Wojtek

 

 

 

 

4 Replies 4
VivekT
Getting noticed

As far as I know ,currently, Meraki's API does not provide specific endpoints to directly create or manage Switch Templates within Network Templates. The Dashboard API is more focused on device and network-level configurations rather than templates.

 

 

Template Management:

  • You can create and manage templates via the API using the /organizations/{organizationId}/configTemplates endpoint.
  • Example: Creating a new template or binding a network to a template.

     

    Switch Ports Configuration:

    • The /devices/{serial}/switchPorts endpoint lets you configure ports, but this applies to individual switches in deployed networks rather than templates.

       

       

       

       

       

       

      Suggestions and Alternatives

      1. Manual Template Setup:

        • Since templates must be set up manually, you can focus on using APIs or Ansible modules to automate device-specific configurations post-deployment.
      2. Scripted Automation:

        • For now, use scripts or automation workflows to configure networks/devices systematically after applying templates.
      3. Hybrid Approach:

        • Combine manual template creation with automated per-device configuration using Ansible or Python scripts to bridge the gap.
      Please let me know if it helps.
VivekT
Getting noticed

As far as I know ,currently, Meraki's API does not provide specific endpoints to directly create or manage Switch Templates within Network Templates. The Dashboard API is more focused on device and network-level configurations rather than templates.

 

 

Template Management:

  • You can create and manage templates via the API using the /organizations/{organizationId}/configTemplates endpoint.
  • Example: Creating a new template or binding a network to a template.

     

    Switch Ports Configuration:

    • The /devices/{serial}/switchPorts endpoint lets you configure ports, but this applies to individual switches in deployed networks rather than templates.

       

       

       

       

       

      Suggestions and Alternatives

      1. Manual Template Setup:

        • Since templates must be set up manually, you can focus on using APIs or Ansible modules to automate device-specific configurations post-deployment.
      2. Scripted Automation:

        • For now, use scripts or automation workflows to configure networks/devices systematically after applying templates.
      3. Hybrid Approach:

        • Combine manual template creation with automated per-device configuration using Ansible or Python scripts to bridge the gap.
      Please let me know if it help
GreenMan
Meraki Employee
Meraki Employee

If you're going to use the API to manage configuration automation and large-scale change, you would basically not need to use Configuration Templates.    These are generally used as an alternative to the API, for customers who need to be able to make changes at scale and are unaffected by (or can work with) with any of the limitations of Templates and/or maybe don't have available skills in scripting, to make use of the API.   Or they don't wish to purchase an API-driven tool built by one of the many Meraki Ecosystem partners.

Basically you would build the standardised settings in your preferred automation tool and apply them just to your chosen Organizations, Networks, Devices etc. by filtering and iterating appropriately - perhaps through the use of Tags.

JeroenVercoulen
Here to help

We are using Ansible to deploy Meraki switch configuration. This can easily be done. Our main issue with Meraki templates is that for example you cannot set STP values for stacked devices.

 

We are looking to do the templating via Ansible. Also we use Netbox as a Dynamic Inventory. I think the combination of the 2 is very strong. But this is my opinion.

Get notified when there are additional replies to this discussion.