Archive for the puppet Category

Puppet supports “if” and “unless” statements, case statements, and selectors.

if $is_virtual {
  warning('Tried to include class ntp on virtual machine; this node may be misclassified.')
}
elsif $operatingsystem == 'Darwin' {
  warning('This NTP module does not yet work on our Mac laptops.')
}
else {
  include ntp
}

more »

Some conditional statements that you can use on puppet templates:

<% if @hostname == ("srv01") then -%>
... ... ...
<% end -%>
<% if @hostname != ("srv01") then -%>
... ... ...
<% end -%>
<% if @hostname == ("srv01" or "srv02") then -%>
... ... ... 
<% end -%>