Network Automation with Ansible – Part 3 – Generating Device Configuration with Jinja2 Templates
In this example I generated configuration for two switches, where I configured few VLANs and their interfaces and some DHCP Pools.
I am using Jinja2 templating module to generate the configuration. I am using a tree structure of directory and files to pass the configuration commands and variable required to generate the configuration. I create a role named switch which I called in my playbook.
The directories are structured as
Sample Configuration Generated by Playbook, Template and Variables
I generated configuration for two switches, as I passed the variables for two switches.