March 2017
Beginner to intermediate
925 pages
18h 11m
English
Templates are a powerful way of using
Embedded Ruby (ERB) to help build config files dynamically. You can also use ERB syntax directly without having to use a separate file by calling the inline_template function. ERB allows you to use conditional logic, iterate over arrays, and include variables.
Here's an example of how to use inline_template:
Pass your Ruby code to inline_template within Puppet manifest, as follows:
cron { 'chkrootkit':
command => '/usr/sbin/chkrootkit >
/var/log/chkrootkit.log 2>&1',
hour => inline_template('<%= @hostname.sum % 24 %>'),
minute => '00',
}Anything inside the string passed to inline_template is executed as if it were an ERB template. That is, anything inside the ...
Read now
Unlock full access