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:
Contents of the common file:
# cat /var/lib/hiera/common.yaml
---
ntp::autoupdate: true
ntp::enable: true
ntp::servers:
- ntp1.example
When debugging on the master:
# puppet master --debug --compile agent1.example.com | grep hiera | grep -v Cannot | grep -v Looking (at grammar.ra:610:in `block in _reduce_190')
Debug: hiera(): Hiera YAML backend starting
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:
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
(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