Chef template - Conditionally inserting a block of text Chef template - Conditionally inserting a block of text nginx nginx

Chef template - Conditionally inserting a block of text


assuming you have an attribute

node[:test][:bool] = true

in the template would have to do

<% if node[:apache][:bool] -%>  ServerAlias ​​<% = node[:apache][:aliasl]%><% end -%>

another option is to check if the attribute is null

<% unless node [:icinga][:core][:server_alias].nil? %>  ServerAlias ​​<% = node[:icinga][:core][:server_alias]%><% end%>