Ask Your Question
0

Puppet has caused the error

asked 2014-06-09 19:50:11 -0500

yuuko.h gravatar image

updated 2014-06-10 02:47:27 -0500

Please help...Puppet is causing the error.
I fail then include the module.
I do not know the cause of the error.

Execution result

puppet apply -v site.pp

Warning: Could not retrieve fact fqdn
Warning: Host is missing hostname and/or domain: myserver
Error: Could not find data item classes in any Hiera data file and no default supplied at /etc/puppet/manifests/site.pp:2 on node myserver
Error: Could not find data item classes in any Hiera data file and no default supplied at /etc/puppet/manifests/site.pp:2 on node myserver


site.pp

node 'myserver' {
hiera_include('classes')
}

hiera.yaml

---
:backends:
- yaml
:logger: console
:hierarchy:
- %{::clientcert}
- common
:yaml:
:datadir: /etc/puppet/hieradata

myserver.yaml

---
mymodule::conf::p1:hiera test p1
mymodule::conf::p2:hiera test p2
classes:
- mymodule::conf

---------- ### init.pp###
class mymodule::conf (
$p1,
$p2="p2 default"
) {
file { "/tmp/mymodule.txt":
ensure => present,
mode => 600,
owner => root,
group => root,
content => template("mymodule.txt.template.erb"),
}
}
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-06-10 03:27:39 -0500

walterheck gravatar image

updated 2014-06-12 13:12:31 -0500

ramindk gravatar image

Your host is having trouble retrieving the fqdn fact. What's the output of the following commands?

facter hostname
cat /etc/hosts
hostname -f

If they all return the correct information there's a better chance hiera will work properly also. If you want to see what hiera does exactly, currently all you can do is run the puppetmaster in debug mode.

edit flag offensive delete link more

Comments

I believe that facter also looks in /etc/resolv.conf for the fqdn fact

ptierno gravatar imageptierno ( 2014-06-10 17:55:42 -0500 )edit
0

answered 2014-06-11 20:04:01 -0500

yuuko.h gravatar image

updated 2014-06-12 20:48:52 -0500

Hi Walterheck's
Thank you for answer.

Commands Result

[root@myserver ~]# facter hostname
myserver
[root@myserver ~]# cat /etc/hosts
127.0.0.1 myserver localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.10.100 myserver
[root@myserver ~]# hostname -f
myserver

Setting /etc/resolv.conf, fqdn problem was solved.
So I executed 'debug' and I got the output below:

Debug Result

Debug: hiera(): Hiera YAML backend starting
Debug: hiera(): Looking up classes in YAML backend
Debug: hiera(): Looking for data source myserver
Error: Could not find data item classes in any Hiera data file and no default supplied at /etc/puppet/manifests/site.pp:2 on node myserver
Error: Could not find data item classes in any Hiera data file and no default supplied at /etc/puppet/manifests/site.pp:2 on node myserver

Would you tell me a solution to the Debug Result ?
Best regard.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-06-09 19:50:11 -0500

Seen: 3,083 times

Last updated: Jun 12 '14