Create a hiera.yaml config file

The Hiera config file is called hiera.yaml. Each environment should have its own hiera.yaml file.

  1. In the main directory of one of your environments, create a new file called hiera.yaml. Paste the following contents into it:

    # <ENVIRONMENT>/hiera.yaml
    ---
    version: 5
    
    hierarchy:
      - name: "Per-node data"                   # Human-readable name.
        path: "nodes/%{trusted.certname}.yaml"  # File path, relative to datadir.
                                       # ^^^ IMPORTANT: include the file extension!
    
      - name: "Per-OS defaults"
        path: "os/%{facts.os.family}.yaml"
    
      - name: "Common data"
        path: "common.yaml"
    

Results

This file is in a format called YAML, which is used extensively throughout Hiera.

For more information on YAML, see YAML Cookbook.

Related information