Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Configuration Management with Chef-Solo

You're reading from   Configuration Management with Chef-Solo A comprehensive guide to get you up and running with Chef-Solo.

Arrow left icon
Product type Paperback
Published in Jun 2014
Publisher
ISBN-13 9781783982462
Length 116 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Naveed ur Rahman Naveed ur Rahman
Author Profile Icon Naveed ur Rahman
Naveed ur Rahman
Arrow right icon
View More author details
Toc

Exploring templates

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:

  • A template resource, which instructs the chef-client to perform any action
  • A template file in the templates folder

The folder structure of cookbook templates will look similar to the following:

  • default
  • ubuntu-12.04
  • ubuntu-14.04

If we notice our cookbooks directory, we will see that the templates folder is already created by Knife. Let's complete our recipe and...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £16.99/month. Cancel anytime