Configuring a hierarchy level: built-in backends
Hiera has three built-in backends: YAML, JSON, and HOCON. All of these use files as data sources.
You can use any combination of these
backends in a hierarchy, and can also combine them with custom backends. But if most
of your data is in one file format, set default values for the datadir and data_hash keys.
Each YAML/JSON/HOCON hierarchy level needs the following keys:
name— A name for this level, shown in debug messages and--explainoutput.path,paths,glob,globs, ormapped_paths(choose one) — The data files to use for this hierarchy level.- These paths are relative to the
datadir, they support variable interpolation, and they require a file extension. See “Specifying file paths” for more details. mapped_pathsdoes not supportglobexpansion.
- These paths are relative to the
data_hash— Which backend to use. Can be omitted if you set a default. The value must be one of the following:yaml_datafor YAML.json_datafor JSON.hocon_datafor HOCON.
datadir— The directory where data files are kept. Can be omitted if you set a default.- This path is relative to
hiera.yaml's directory: if the config file is at/etc/puppetlabs/code/environments/production/hiera.yamland thedatadiris set to data, the full path to the data directory is/etc/puppetlabs/code/environments/production/data. - In the global layer, you can optionally set the
datadirto an absolute path; in the other layers, it must always be relative. datadirsupports variable interpolation.
- This path is relative to
For more information on built-in backends, see YAML, JSON, HOCON.
Related information
In this section: