-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Puppet 8 for DevOps Engineers
By :

Every value in Puppet has a data type; in the previous section, for example, the variables had String
values assigned. A data type, when used as a capitalized unquoted string, such as Integer
, can be used to specify what parameters in a class, defined type, or lambda should contain, allowing the data to be validated:
class example ( String example_string = 'hello world', Integer example_integer = 1 ) { }
Data types can also be used to compare a variable’s value, conditionally check values, and take different actions, depending on the result. For example, to confirm that a variable contains an integer, the following match expression can be used. Here, we are confirming that the example_integer
variable contains an integer:
$example_integer =~ Integer
Conditional statements and comparisons will be covered in full in Chapter 7.
The next section will run through the most commonly used core Puppet data types. Unfortunately...