Templates separate logic from data. Write a template once, then generate configurations for hundreds of devices by changing variables.
Jinja is standard. Ansible, Python, and most tools use Jinja templating.
Example template:
hostname {{ hostname }}
!
interface {{ uplink_interface }}
description {{ uplink_description }}
ip address {{ uplink_ip }} {{ uplink_mask }}
{% for vlan in vlans %}
vlan {{ vlan.id }}
name {{ vlan.name }}
{% endfor %}
Variables file:
hostname: core-sw-01
vlans:
- id: 100
name: SERVERS
Templates plus variables generate complete configurations.