Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Can I use of multiple datadir for hiera?

I want to make use of multiple hiera datadir, so I configured my hiera.yaml file to look like this:

$  cat /etc/puppetlabs/code/hiera.yaml
---
:backends:
  - yaml
:hierarchy:
  - "%{::role}"
  - common

:yaml:
  :datadir:
    - "/etc/puppetlabs/code/environments/%{::environment}/hieradata"
    - "/etc/puppetlabs/code/hieradata/company_wide_hiera_data"

Notice that for 'datadir' I have specified an array. That's because some of my hieredata isn't specific to a particular environment, instead they are general across the whole company.

When I do a puppet run, I get:

# puppet agent -t
Notice: Local environment: 'production' doesn't match server specified node environment 'castle_production', switching agent to 'castle_production'.
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, Lookup of key 'profiles::web_server::sampledata' failed: DataBinding 'hiera': datadir for yaml cannot be an array at /etc/puppetlabs/code/environments/castle_production/site/roles/manifests/web_server_ng.pp:47:3 on node i-77690cff
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

This error message indicates that datadir for yaml cannot be an array.

Is there another way to get round this issue?

Can I use of multiple datadir for hiera?

I want to make use of multiple hiera datadir, so I configured my hiera.yaml file to look like this:

$  cat /etc/puppetlabs/code/hiera.yaml
---
:backends:
  - yaml
:hierarchy:
  - "%{::role}"
  - common

:yaml:
  :datadir:
    - "/etc/puppetlabs/code/environments/%{::environment}/hieradata"
    - "/etc/puppetlabs/code/hieradata/company_wide_hiera_data"

Notice that for 'datadir' I have specified an array. That's because some of my hieredata isn't specific to a particular environment, instead they are general across the whole company.

When I do a puppet run, I get:

# puppet agent -t
Notice: Local environment: 'production' doesn't match server specified node environment 'castle_production', switching agent to 'castle_production'.
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, Lookup of key 'profiles::web_server::sampledata' failed: DataBinding 'hiera': datadir for yaml cannot be an array at /etc/puppetlabs/code/environments/castle_production/site/roles/manifests/web_server_ng.pp:47:3 on node i-77690cff
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

This error message indicates that datadir for yaml cannot be an array.

Is there another way to get round this issue?