When values for class parameters aren’t explicitly provided, Puppet automatically looks them up in Hiera, using the fully-qualified name of the parameter (like
myclass::parameter_one) as a lookup key.
Most classes need some amount of configuration, and they can specify parameters to request the data they need.
There are three ways to set values for class parameters, and Puppet tries each of them in order when the class is declared or assigned by an ENC:
<CLASS NAME>::<PARAMETER NAME>as the lookup key (for example,
Thus, you can set servers for the NTP class like this:
# /etc/puppetlabs/code/production/data/nodes/web01.example.com.yaml --- ntp::servers: - time.example.com - 0.pool.ntp.org
That’s automatic class parameter lookup.
Automatic class parameter lookup is powerful, but you probably use thousands of class parameters to describe your infrastructure, and putting them all in Hiera is an invitation to chaos. The best way to manage that is to use the roles and profiles method, which allows you to store a smaller amount of more meaningful data in Hiera. For more details, see our documentation on the roles and profiles method.