VLAN Jinja2 Template
In this step, we’re going to create a variable called text_file which will contain the content of a jinja2 template. This is a basic python string object which means, at this point, it’s just a bunch of text.
In normal circunstances, we would actually be reading this template from a file located on the hard drive, but for our purposes today, we’ll just put the templatein by hand.
What makes Jinja2 powerful is the control structures that allow it to perform programatic operations. In this example, we’re creating a For loop.
Following the code we will each vlan in the vlans object we created above and then render the template using the ‘id’ key for the first variable, the ‘name’ key for the second variable, and the ‘description’ key for the last variable.
Hopfully, this makes sense, but if not, just hold on and it should become clear before the end.