Puppet: Config file synatx (Hiera.yaml)

0 votes
Can somebody explain the config file syntax, i actually wanted to include a few configurations in hiera.yaml file?
Aug 28 in Puppet by Lilly
128 views

1 answer to this question.

0 votes

Config file syntax:

The hiera.yaml file is a YAML file, containing a hash with up to four top-level keys.

The following keys are in a hiera.yaml file:

  • version - Required. Must be the number 5, with no quotes.

  • defaults - A hash, which can set a default datadir, backend, and options for hierarchy levels.

  • hierarchy - An array of hashes, which configures the levels of the hierarchy.

  • default_hierarchy - An array of hashes, which sets a default hierarchy to be used only if the normal hierarchy entries do not result in a value. Only allowed in a module's hiera.yaml.

version: 5 
defaults: # Used for any hierarchy level that omits these keys. 
datadir: data # This path is relative to hiera.yaml's directory. 
data_hash: yaml_data # Use the built-in YAML backend. 
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-datacenter business group data" # Uses custom facts. 
path: "location/%{facts.whereami}/%{facts.group}.yaml" 
- name: "Global business group data" 
path: "groups/%{facts.group}.yaml" 
- name: "Per-datacenter secret data (encrypted)" 
lookup_key: eyaml_lookup_key # Uses non-default backend. 
path: "secrets/%{facts.whereami}.eyaml" 
options: 
pkcs7_private_key: /etc/puppetlabs/puppet/eyaml/private_key.pkcs7.pem 
pkcs7_public_key: /etc/puppetlabs/puppet/eyaml/public_key.pkcs7.pem 
- name: "Per-OS defaults" 
path: "os/%{facts.os.family}.yaml" 
- name: "Common data" 
path: "common.yaml" 
answered Aug 28 by Sirajul
• 37,480 points

Related Questions In Puppet

0 votes
2 answers

Where do i find the puppet configuration file?

The puppet.conf file is always located at $confdir/puppet.conf. Although ...READ MORE

answered Aug 9 in Puppet by Sirajul
• 37,480 points
58 views
0 votes
1 answer

Vagrant file to bring up VM using Puppet

You vagrant file should look something like ...READ MORE

answered Mar 12 in Puppet by Barbara
47 views
0 votes
1 answer

What is Hiera in puppet and what does it do?

Hiera is a built-in key-value configuration data lookup ...READ MORE

answered Jul 25 in Puppet by Sirajul
• 37,480 points
117 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
212 views
0 votes
1 answer
0 votes
1 answer

Puppet+Docker: How do i configure my docker container to use a NFS volume through a Hiera config file?

If using Hiera, configure the docker::volumes class in the ...READ MORE

answered Aug 14 in Puppet by Sirajul
• 37,480 points
31 views
0 votes
1 answer

Puppet: Loaction of Hiera.yaml file in puppet.

The Hiera configuration file is called hiera.yaml. It configures the ...READ MORE

answered Aug 28 in Puppet by Sirajul
• 37,480 points
24 views