hiera and puppet environments ( directory)

350 views
Skip to first unread message

Helen Paterson

unread,
Jun 19, 2015, 4:43:30 AM6/19/15
to puppet...@googlegroups.com
Hi,

I'm trying to set-up puppet environment so that our ymal files can usernames and passwords for Production and test ( dq), modules will be the same. I have run through the documentation but am getting the following error:

client error

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could
not find data item classes in any Hiera data file and no default supplied at /e
tc/puppet/environments/dq/manifests/windows-servers.pp:54 on node hp-test2008r2.


debug from master
Cannot find datafile /var/lib/hiera/


I don't understand why puppet is looking in  /var/lib/hiera/.  before setting up environments hiera was working and looking at /etc/puppethiera.yaml but default


hiera.yaml 
:datadir: '/etc/puppet/environments/%{::environment}/hieradata'




Rob Reynolds

unread,
Jul 6, 2015, 4:02:36 PM7/6/15
to puppet...@googlegroups.com
If this is what you have/had in your yaml file, you've probably realized this is not a valid Windows path, which is necessary for the yaml files on the Windows clients.
 





--
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 puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/220c601e-b537-4d9b-b0d9-3c94bb6d68e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Rob Reynolds
Developer, Puppet Labs

PuppetConf 2015 is coming to Portland, Oregon! Join us October 5-9.
Register now to take advantage of the Early Adopter discount save $349!

PAN

unread,
Jul 8, 2015, 9:23:35 AM7/8/15
to puppet...@googlegroups.com
Hi Rob ,

On the puppet agent node, when I try to install ssh packages it is failing with "Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call,
Could not find data item ssh_packages in any Hiera data file" error.
puppet agent -t works fine when modules does not contain hiera look ups. The issue seems hiera looksups is not working for puppet client/agent node.

However hiera lookups and ssh_packages working fine on master node when I use puppet apply -e 'include openssh:sshclient' module

Both puppet master and puppet client are using
# puppet --version
3.8.0 (Puppet Enterprise 3.8.0),

# hiera -v
1.3.4

On master node:
_______________

[root@pupmaster manifests]# puppet apply -e 'include openssh::sshclient'
Notice: Compiled catalog for pupmaster-dpallipa.idc.oracle.com in environment production in 5.77 seconds
Notice: /Stage[main]/Openssh::Sshclient/Package[openssh-ldap]/ensure: created
Notice: Finished catalog run in 20.13 seconds
[root@pupmaster manifests]#
__

# cat /etc/hiera.yaml
#### Hiera to search yaml files #####
:backends:
     - yaml

:hierarchy:
#     - "%{operatingsystem}"
     - "%{osfamily}"
     - common
     - defaults
:yaml:
    :datadir: /var/lib/hiera/
__
# cd /var/lib/hiera/
# ls
common.yaml  defaults.yaml  RedHat.yaml
--------------------------------------------
#cat RedHat.yaml
permitt_root_login: 'yes'
ssh_service: 'sshd'
ssh_packages:
    - 'openssh-ldap'
    - 'openssh'
    - 'openssh-clients'
    - 'openssh-server'
__
# cat common.yaml
permit_root_login: 'no'
-----
# cat defaults.yaml
environment: production
-------------------

My ssh package instal module:
# cat sshclient.pp
class openssh::sshclient {
        $ssh_packages=hiera('ssh_packages')
        $permit_root_login=hiera('permitt_root_login')
         $sshservice=hiera('ssh_service')

        package {$ssh_packages:
                ensure => 'present',
                before => File['/etc/ssh/sshd_config'],
                }

        file {'/etc/ssh/sshd_config':
                ensure => present,
                owner => 'root',
                group => 'root',
                mode => '0600',
                content => template('openssh/sshd_config.erb'),
                }

        service {$sshservice:
                subscribe => File['/etc/ssh/sshd_config'],
                ensure => running,
                enable => true,
                hasstatus => true,
                hasrestart => true,
                }
}
____________________________________________________

On puppetclient/agent node:
---------------------------

[root@pupclient2
....
.....
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, Could not find data item ssh_packages in any Hiera data file and no default supplied at /etc/puppetlabs/puppet/environments/production/modules/openssh/manifests/sshclient.pp:2:16 on node pupclient2.
Error: Could not retrieve catalog; skipping run
[root@pupclient2
-----

Is there anything I am missing here /any thing I need to enable to make puppet agent to work fine with hiera.

Thanks,

Rob Reynolds

unread,
Jul 8, 2015, 2:50:06 PM7/8/15
to puppet...@googlegroups.com
What do you get when you run facter operatingsystem and facter osfamily on pupclient2?

 

Thanks,


On Friday, June 19, 2015 at 2:13:30 PM UTC+5:30, Helen Paterson wrote:
Hi,

I'm trying to set-up puppet environment so that our ymal files can usernames and passwords for Production and test ( dq), modules will be the same. I have run through the documentation but am getting the following error:

client error

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could
not find data item classes in any Hiera data file and no default supplied at /e
tc/puppet/environments/dq/manifests/windows-servers.pp:54 on node hp-test2008r2.


debug from master
Cannot find datafile /var/lib/hiera/


I don't understand why puppet is looking in  /var/lib/hiera/.  before setting up environments hiera was working and looking at /etc/puppethiera.yaml but default


hiera.yaml 
:datadir: '/etc/puppet/environments/%{::environment}/hieradata'




--
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 puppet-users...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Rob Reynolds

unread,
Jul 8, 2015, 2:53:47 PM7/8/15
to puppet...@googlegroups.com
On Mon, Jul 6, 2015 at 3:02 PM, Rob Reynolds <r...@puppetlabs.com> wrote:


On Fri, Jun 19, 2015 at 3:43 AM, Helen Paterson <helen.p...@gmail.com> wrote:
Hi,

I'm trying to set-up puppet environment so that our ymal files can usernames and passwords for Production and test ( dq), modules will be the same. I have run through the documentation but am getting the following error:

client error

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could
not find data item classes in any Hiera data file and no default supplied at /e
tc/puppet/environments/dq/manifests/windows-servers.pp:54 on node hp-test2008r2.


debug from master
Cannot find datafile /var/lib/hiera/


I don't understand why puppet is looking in  /var/lib/hiera/.  before setting up environments hiera was working and looking at /etc/puppethiera.yaml but default

What version of Puppet?
 


hiera.yaml 
:datadir: '/etc/puppet/environments/%{::environment}/hieradata'

If this is what you have/had in your yaml file, you've probably realized this is not a valid Windows path, which is necessary for the yaml files on the Windows clients.

This may not be correct - Hiera evaluates wherever the catalog is compiled I believe.
 
 





--
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 puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/220c601e-b537-4d9b-b0d9-3c94bb6d68e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Rob Reynolds
Developer, Puppet Labs

PuppetConf 2015 is coming to Portland, Oregon! Join us October 5-9.
Register now to take advantage of the Early Adopter discount save $349!

PAN dheepak kumar

unread,
Jul 8, 2015, 10:38:36 PM7/8/15
to puppet...@googlegroups.com
Hi Rob.
Thanks for the reply.

[root@pupclient2]# facter osfamily
RedHat
[root@pupclient2]# facter operatingsystem
OracleLinux
[root@pupclient2]#
----
[root@pupmaster]# facter osfamily
RedHat
[root@pupmaster]# facter operatingsystem
OracleLinux
[root@pupmaster]#

Both Master and client are running same OS and same version.

[root@pupclient2]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)
[root@pupclient2]#
---
[root@pupmaster]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)
[root@pupmaster]
---

Thanks

PAN dheepak kumar

unread,
Jul 9, 2015, 2:00:00 PM7/9/15
to puppet...@googlegroups.com
Hi Rob,

My bad..Issue with hiera datadir location ownership and permission.
changed to puppet from root ownership. Hiera looks up working fine for puppet agent now..

Thanks
Reply all
Reply to author
Forward
0 new messages