4

Variables and Data Types

This chapter will cover how Puppet handles variables and, in particular, how Puppet differs from most declarative languages in terms of how they are used and declared. We will look at the core data types that are used to define what the value of a variable can contain and how it can be interacted with. Then, we will look at how data types and variables allow the classes we discussed in Chapter 3 to receive external data and handle default values.

Arrays and hashes will be discussed in detail, including how to declare them, access values, and manipulate them with operations. The Sensitive data type will be shown, which you can use to secure values in logs and reports while making the limitations of this data type and ...

Get Puppet 8 for DevOps Engineers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.