Fork me on GitHub
Suzf  Blog

Puppet erb template

puppet templates follow the erb templating standard.

The puppet documentation contains an example of how to do a simple if statement.

<% if broadcast != "NONE" %>       
    broadcast <%= broadcast %>
<% end %>

To do an if/else statement, simply add <% else %>

<% if @someclass::someparameter != true %>
    bar = 42
<% else %>
    bar = 0
<% end %>

--  for dynamic content use: <%= %>
--  for another content use: <% %>
-- eg: <% if 1>2 %>

 

http://stackoverflow.com/questions/6932663/whats-wrong-with-my-simple-if-else

https://docs.puppetlabs.com/puppet/latest/reference/lang_template_erb.html