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

 

License: Attribution-NonCommercial-ShareAlike 4.0 International

本文出自 Suzf Blog。 如未注明,均为 SUZF.NET 原创。

转载请注明:https://suzf.net/post/599

「一键投喂 软糖/蛋糕/布丁/牛奶/冰阔乐!」

Suzf Blog

(๑>ڡ<)☆ 谢谢 ~

使用微信扫描二维码完成支付