May 2017
Intermediate to advanced
726 pages
15h 38m
English
Chef dynamically configures software and hosts, and a large part of configuring UNIX-based systems and software involves configuration files. Chef provides a straightforward mechanism to generate configuration files that make it easy to combine configuration data with template files to produce the final configuration files on hosts. These templates are stored in the templates directory inside of a cookbook and use the ERB template language, which is a popular and easy-to-use Ruby-based template language.
Without templates, your mechanism to generate configuration files would probably look something like this:
File.open(local_filename, 'w') do |f| f.write("<VirtualHost *:#{node['app]['port']}") ... f.write("</VirtualHost>") ...Read now
Unlock full access