A template in Ansible is a file that contains all your configuration parameters, but the dynamic values are given as variables. During the playbook execution, depending on the conditions like which cluster you are using, the variables will be replaced with the relevant values. You can go through the below example for your reference.
- hosts: all
- dnsip: "192.168.0.1"