Chef Templates - Chef (software)

What are Chef Templates?

In infrastructure, configuration management is about how well one configures the hosts. All in all, every one of the configurations are finished utilizing the configuration files. Chef utilizes templates to have the capacity to fill the configuration file with dynamic qualities.

Chef gives templates as an resource which can be utilized in the recipe. Configuration files' dynamic qualities can be recovered from information sacks, attributes or even figure them by passing them into the template.

How to Use It?

Step 1 – Now create the template to the recipe.

Step 2 – Then add ERB Template file.

Step 3 − Upload the modified cookbook to Chef server.

Step 4 – Here validate the content of the uploaded file.


Chef utilizes Erubis as its template language. It provides embedding pure Ruby code which appears inside special symbols in the templates.

  • <%= %> is helpful when you want to print the value of a variable or Ruby expression into the created file.
  • <%- %> is used in the scenario when the embed Ruby logic into your template file. It is also used to loop our expression four times.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Chef (software) Topics