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 configuration. This allows us to use the same template multiple times but with a different set of data. Also, as shown on the Jinja2 web page, it has some unique features that make it stand out from the other template languages.
The following are some...