March 2017
Beginner to intermediate
925 pages
18h 11m
English
Although you could write any conditional statement using if, Puppet provides a couple of extra forms to help you express conditionals more easily: the selector and the case statement.
Here are some examples of selector and case statements:
$systemtype = $::operatingsystem ? {
'Ubuntu' => 'debianlike',
'Debian' => 'debianlike',
'RedHat' => 'redhatlike',
'Fedora' => 'redhatlike',
'CentOS' => 'redhatlike',
default => 'unknown',
}
notify { "You have a ${systemtype} system": }class debianlike { notify { 'Special manifest for Debian-like systems': } } class redhatlike { notify { 'Special manifest for RedHat-like systems': } ...Read now
Unlock full access