Struggling with hiera 5 and puppet 4.10

162 views
Skip to first unread message

Sean

unread,
May 26, 2017, 4:59:15 PM5/26/17
to Puppet Users
Hi,

I'm working to prototype an upgrade of our environment to puppet 4.10 and use hiera 5 data layers.  Today, we're running puppet 3, and I've refactored a our main modules to use hiera module data instead of params.pp.  It better suits our needs to have the data layers setup this way.  This prototype is also leveraging r10k, so the environment data is stored in a control repo branch for each puppet environment.

Anyway, I'm struggling because the when I run puppet lookup on the puppet master, I get a value for a parameter that hiera should be serving data.  In the module data layer, the parameter defaults to facts.hostname.  When I run puppet agent or puppet lookup on a node that this module is applied to, I get nothing...e.g. if I use that piece of data in an apache::vhost define, the config file in /etc/httpd/conf.d/ is 25-.mydomain.com.conf where it should be 25-www.mydomain.com.conf because www is the value parameter hiera is looking up.  The same result holds true even when I override the default value with something specific at the environment layer, the lookup on the puppet master produces the right value but the lookup on the agent returns nothing.

I'm something at a loss of what could cause this with out any errors or useful information produced.  Might anyone have an idea where I've gone wrong?

Thanks!

Angel L. Mateo

unread,
May 29, 2017, 2:58:18 AM5/29/17
to puppet...@googlegroups.com
Take a look at https://puppet.com/blog/debugging-hiera for help
debuggin hiera problems.

El 26/05/17 a las 22:59, Sean escribió:
> --
> 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
> <mailto:puppet-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/31f68898-9b99-4b8b-8362-b588c5ea0eae%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/31f68898-9b99-4b8b-8362-b588c5ea0eae%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

--
Angel L. Mateo Martínez
Sección de Telemática
Área de Tecnologías de la Información
y las Comunicaciones Aplicadas (ATICA)
http://www.um.es/atica
Tfo: 868889150
Fax: 868888337

Sean

unread,
Jun 1, 2017, 11:19:38 AM6/1/17
to Puppet Users
Thanks for that, I have read that blog plus the more recent followup.  I also have tried using the --explain flag for the lookup function.

Again if I run puppet lookup --node test.demo.local --explain demo::webhost on the puppet master, it produces a value for demo::webhost.  If I run on the agent node, it complains that hiera.yaml is using version 3 and that's deprecated, then produces no resulting value.

When puppet runs on the demo webserver with the class (that uses the demo::webhost value to configure an apache vhost resource), the demo::webhost value appears to be empty.  It produces a apache vhost config file in /etc/httpd/conf.d which has no hostname, no vhost name, no server name.  Everywhere in the resource where demo::webhost is used, there is no value in the resulting apache config file.

So perhaps the problem is in configuring hiera on the agents?  I guess I need to deploy the puppet/hiera module and try to ensure that all the agents are configured to use Hiera 5?  I haven't read anywhere that I need to deploy hiera.yaml files to agents, is that what I'm missing?

Sean

unread,
Jun 1, 2017, 12:49:53 PM6/1/17
to Puppet Users
Ok, I think I discovered the issues.

1.  for the r10k control repo, I cloned puppetlabs example, which has a directory called hieradata, but not hiera.yaml starter file.  So I think when I copied from the example of a hiera 5 config file, it uses the default data dir as "data", I needed this to be "hieradata".

2.  for my demo module, it appears I wasn't handling params correctly, and it seems that I can't fully qualify parameters in my code.  using $::demo::webhost produced an undefined variable warning.

Fixing these two things up and now I have working data.
Reply all
Reply to author
Forward
0 new messages