Templating is a method of getting things in a standard format, which can be used in multiple locations
- Template Combine code and data to render a final document(like PHP)
- Useful for complex configuration files you would like to manage with puppet
- Puppet supports Embedded puppet (.epp) or Embedded Ruby Template(.erb)
- Stores templates in the modules templates/ directory
- Reference in your code with <>/<>
For example np/ntp.conf.eppExample
Create a file called test.epp and write below code
<% | String $text, Boolean $bool | -%> Text value is <%= $text %> <% if $bool { -%> bool is set to true <% } -%>
Validate the code
puppet epp validate test.epp
render the code
puppet epp render test.epp --values '{ text => "Hello World", bool => true }'
Comments
Post a Comment