Hi,

I'm currently testing hiera and I can't make it work.  I get this 
error: Error 400 on SERVER: Could not find data item classes in any Hiera 
data file and no default supplied at /etc/puppet/manifests/site.pp:11 on 
node. I'm trying to do something like 
this: https://docs.puppet.com/hiera/3.0/complete_example.html (puppetlabs 
ntp module).

Client: puppet 3.6.2

On the master:

puppet 3.6.2

# puppet config print | grep hiera_
hiera_config = /etc/puppet/hiera.yaml

Contents of /etc/puppet/hiera.yaml
---
:backends:
#  - regex
  - yaml
:yaml:
  :datadir: /var/lib/hiera
#:regex:
#  :datadir: /var/lib/hiera
:hierarchy:
  - "host/%{fqdn}"
  - "domain/%{domain}"
  - "env/%{::environment}"
  - "os/%{operatingsystem}"
  - "osfamily/%{osfamily}"
  - "virtual/%{::virtual}"
  - common

Contents of /etc/puppet/manifests/site.pp

import "nodes/*"
import "os/*"
import "packages/*"
import "users/*"
import "service-types/*"

# Enable hiera
hiera_include('classes')

#filebitbucket { main: server => puppet }
#File { backup => main }

# The filebucket option allows for file backups to the server
filebucket { main: server => 'puppet' }

# Set global defaults - including backing up all files to the main 
filebucket and adds a global path
File { backup => main }

Contents of the hiera file for this host:

# cat /var/lib/hiera/host/agent1.example.com.yaml
---
classes: ntp
ntp::restrict:
  -
ntp::autoupdate: false
ntp::enable: true
ntp::servers:
  - 0.ca.pool.ntp.org
  - 1.ca.pool.ntp.org
  - 2.ca.pool.ntp.org
  - 3.ca.pool.ntp.org

Contents of the common file:

# cat /var/lib/hiera/common.yaml
---
ntp::autoupdate: true
ntp::enable: true
ntp::servers:
  - ntp1.example
  - ntp2.example.com


When debugging on the master:

# puppet master --debug --compile agent1.example.com | grep hiera | grep -v 
Cannot | grep -v Looking
Warning: The use of 'import' is deprecated at 
/etc/puppet/manifests/site.pp:4. See 
http://links.puppetlabs.com/puppet-import-deprecation
   (at grammar.ra:610:in `block in _reduce_190')
Debug: hiera(): Hiera YAML backend starting
Debug: hiera(): Found classes in host/agent1.example.com
Debug: hiera(): Found ntp::autoupdate in host/agent1.example.com
Debug: hiera(): Found ntp::restrict in host/agent1.example.com
Debug: hiera(): Found ntp::servers in host/agent1.example.com
Warning: Variable access via 'search_domain' is deprecated. Use 
'@search_domain' instead. 
template[/etc/puppet/modules/resolv/templates/resolv.conf.erb]:5
   (at /etc/puppet/modules/resolv/templates/resolv.conf.erb:5:in `block in 
result')
Warning: Variable access via 'dns_servers' is deprecated. Use 
'@dns_servers' instead. 
template[/etc/puppet/modules/resolv/templates/resolv.conf.erb]:7
   (at /etc/puppet/modules/resolv/templates/resolv.conf.erb:7:in `block in 
result')

(I will eventually fix the warnings, I doubt they cause my hiera problem)

hiera debugging on the master:

# hiera ntp::servers clientcert=agen1.example.com --debug
DEBUG: 2016-04-19 13:26:43 -0400: Hiera YAML backend starting
DEBUG: 2016-04-19 13:26:43 -0400: Looking up ntp::servers in YAML backend
DEBUG: 2016-04-19 13:26:43 -0400: Looking for data source common
DEBUG: 2016-04-19 13:26:43 -0400: Found ntp::servers in common
["ntp1.example.com", "ntp2.example.com"]

(should not find the information in common, should use the information in 
/var/lib/hiera/host/agent1.example.com.yaml

Any help would be greatly appreciated.

Thanks,

Ugo

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/11548aff-32cd-4cdb-9886-4cfc079cd5fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to