Building a golden configuration with Jinja2

Most network engineers have a text file that serves as a template for a specific device configuration. This file contains sections of network configuration with many values. When the network engineer wants to provision a new device or change its configuration, they will basically replace specific values from this file with another one to generate a new configuration.

Using Python and Ansible, later in this book we will automate this process efficiently using the Jinja2 template language (http://jinja.pocoo.org). The core concept of and driver for developing Jinja2 is to have a unified syntax across all template files for specific network/system configurations and to separate the data from the actual ...

Get Hands-On Enterprise Automation with Python. now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.