LOGBOOK

HELP

Quiz Entry - updated: 2026.11.12

What is templating in Ansible, and which engine does it use?

A template is a file with placeholders and logic that Ansible fills in for each host from its variables and facts; Ansible uses the Jinja2 engine, the same syntax as {{ var }} in playbooks.

Instead of editing a configuration file line by line, you write the whole file once, as it should look, and mark the parts that differ per host:

ListenAddress {{ ansible_facts['default_ipv4']['address'] }}

When Ansible deploys the template to a host, it renders it with that host's values, so every host gets a correct, complete file. You already know the expression syntax: every "{{ ... }}" in a playbook is Jinja2. Templates add control structures (for, if) on top.

Jinja2 is a Python templating library, also used by web frameworks such as Flask to render HTML; Ansible uses it to render configuration files.

Go deeper:

From Quiz: ITIA / Ansible: Managing Files and Jinja2 Templates | Updated: Nov 12, 2026