voxpupuli / puppet-hiera

Hiera hierarchy module for templating `hiera.yaml`
https://forge.puppet.com/puppet/hiera
Apache License 2.0
33 stars 105 forks source link

hiera.yaml is not created for each environment #230

Open ilvidel opened 6 years ago

ilvidel commented 6 years ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

  class { 'hiera':
    hiera_version    => '5',
    hiera5_defaults  => {
      'datadir' => 'data',
      'data_hash' => 'yaml_data'
    },

    # EYAML
    create_keys      => true,
    eyaml            => true,
    keysdir          => '/etc/puppetlabs/puppet/keys/',

    # GLOBAL HIERARCHY
    hierarchy        => [
      {
        'name'       => 'Secrets and passwords',
        'lookup_key' => 'eyaml_lookup_key', # eyaml backend
        'path'       => 'secure.eyaml',
        'options'    => {
          'pkcs7_private_key' => '/etc/puppetlabs/puppet/keys/private_key.pkcs7.pem',
          'pkcs7_public_key'  => '/etc/puppetlabs/puppet/keys/public_key.pkcs7.pem'
        }
      },
      {
        'name'       => 'Node-specific config',
        'data_hash'  => 'yaml_data', # Standard yaml backend
        'path'       => 'nodes/%{::fqdn}.yaml'
      },
      {
        'name'       => 'Default yaml file',
        'data_hash'  => 'yaml_data', # Standard yaml backend
        'path'       => 'common.yaml'
      }
    ]
  }

What are you seeing

The module creates /etc/puppetlabs/puppet/hiera.yaml correctly, but puppet lookup doesn't find the keys. I need to copy/link that file into /etc/puppetlabs/code/environments/*/hiera.yaml for puppet to be able to find the keys and work properly.

What behaviour did you expect instead

The module should create the hiera.yaml file in the environments directories

Output log

This is the message when environment/hiera.yaml does not exist:

Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Function lookup() did not find a value for the name 'nagios::slack_channel::devel' on node nagios-test.build.nonlive.bcc

Any additional information you'd like to impart

N/A

ZeroPointEnergy commented 5 years ago

The puppet module manages the global hiera.yaml which is in /etc/puppetlabs/puppet/ . Puppet should still read this except if you have set hiera_config to something else in the puppet.conf