Puppet provides different constructs to manage conditionals inside manifests.
Selectors as we have seen, let us set the value of a variable or an argument inside a resource declaration according to the value of another variable. Selectors, therefore, just return values, and are not used to manage conditionally entire blocks of code.
Here's an example of a selector:
$package_name = $::osfamily ? { 'RedHat' => 'httpd', 'Debian' => 'apache2', default => undef, }
The case
statements are used to execute different blocks of code according to the values of a variable. It's recommended to have a default block for unmatched entries. Case statements can't be used inside resource declarations. We can achieve the same result of the previous selector ...
No credit card required