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 --explain output.
  • path, paths, glob, globs, or mapped_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_paths does not support glob expansion.
  • data_hash — Which backend to use. Can be omitted if you set a default. The value must be one of the following:
    • yaml_data for YAML.
    • json_data for JSON.
    • hocon_data for 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.yaml and the datadir is 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 datadir to an absolute path; in the other layers, it must always be relative.
    • datadir supports variable interpolation.

For more information on built-in backends, see YAML, JSON, HOCON.

Related information

In this section: