Future Parser: Data Types: Booleans
Included in Puppet Enterprise 3.8. A newer version is available; see the version menu above for details.
Booleans are one-bit values, representing true or false.
The boolean data type has two possible values:
false. Literal booleans must be one of these two bare words (that is, not quoted).
Automatic Conversion to Boolean
If a non-boolean value is used where a boolean is required:
undefvalue is converted to boolean
- All other values are converted to boolean
Notably, this means the string values
"" (zero-length string) and
"false" both resolve to
true. If Puppet is configured to treat all facts as strings, this can cause unexpected behavior; see the docs on fact data types for more info.
If you want to convert other values to booleans with more permissive rules (
0 as false,
"false" as false, etc.), the puppetlabs-stdlib module includes
Boolean Data Type
The data type of boolean values is
It matches only the values
false, and accepts no parameters.
Related Data Types
You can use abstract types to match values that might be boolean or might have some other value. For example,
Optional[Boolean] will match
Variant[Boolean, Enum["true", "false"]] will match stringified booleans as well as true booleans.