Starting Small

Let's learn how to take a modular approach to network configuration management.

The approach taken to network configuration management may very well determine its success. Do not try to solve everything at once. Break the network down into small, modular templates that can easily be read, understood, and updated by others. The templates should cover specific functions and features. These small templates can and will be assembled later at runtime, so do not be afraid to make very small, very specific templates as opposed to large one size fits all templates.

Use check mode extensively, refactor code, and start making manual updates and corrections to the network. Try to achieve idempotency.

Coverage by configuration

Prior to building templates, create and name empty files in the approximate order the templated configurations are to be executed. It might not be possible to mirror the exact top to bottom configurations of a network device, but that is not the goal. The goal is to ensure all the configurations match and will execute in functional order. The exact line-by-line configurations do not need to match sequentially.

The number of templates created largely depends on the number of technologies and features deployed to the network. There are, however, some common configurations to every network. Here is an example library of small, modular templates that can be used for a standard campus network. Use this structure to start a dynamic template library. The entire repository is available for cloning, using Git, locally to examine the logic in each template.

Remember if platform_ or group_ prepends a variable, it is stored in a group_vars YAML file and applies to a group of devices. If host_ prepends the variable, it is stored in a host_vars YAML file.

Below are some sample template files:

Get hands-on with 1200+ tech skills courses.