A template is an Embedded Ruby (ERB) file that is used to create configuration files based on variables and logic defined by a cookbook. A template can contain mixed Ruby code or expressions; it provides a great way to manage configuration files on any node.
Templates are used with a template resource, and each resource includes actions, attributes, and file sources. Template resources are very close to file resources; the only difference is that templates are based on Ruby code, and on the other hand, file resources are used to copy files to a particular location.
Templates should have the following two components: