Jinja2 Templates.
First of all, in Ansible terminology,
a template is a file that contains your configuration parameters,
but it contains dynamic data.
That dynamic data is being powered by the Jinja2 Python templating language.
For example,
you may need to create config files for a whole bunch of website servers.
Each of those config files is likely to have host‑specific information.
By creating an Ansible template using Jinja2,
when the playbook is run, Ansible will, on the fly,
create each appropriate personalized configuration file and place them
as long as the logic in the playbook is correct.
Here's an example of Ansible templating where we've got the
Jinja2 markup syntax here defining the basic structure of an
Apache webserver config file.
And notice the standard is to give the name of the
file and then use the j2 file type.
And notice also the double curly braces denotes a Jinja interpolation event
where we're going to populate the server name from that variable and
document root from another variable or property.
And then, upon playbook execution,
you can see in the playbook file we've got a task
called Generate Apache config file,
and it's going into the built‑in ansible.windows.win_template.
And notice that the source file is the template,
the j2 file,
and the destination will be the actual httpd.conf
that's personalized for that host.