FAQ
Greetings Corey,

Thank you for your advice.

If it was as simple as the clientcert being wrong, then it should have been
hitting the default hiera option, but it wasn't pulling back anything at
all. I honestly don't think it was even looking at hiera as I saw nothing
about it in the logs.

We actually switched from fqdn to clientcert because we found clientcert
more reliable. We have a significant number of laptops that travel between
networks and would respond back with different fqdn depending on what
wireless hub they were on (don't even get me started on the network
team...we have frequent disagreements on things:-D ).

However, I did get it working and you reaffirmed something I had
discovered. So thank you very much for responding. I do appreciate it.

______________________________________________________________


Greetings all that are following this saga...

For those following along with my code above, I mistyped hieratest in my
first email but in the file it is correct (that's what I get for retyping
instead of mucking with copy/paste from the VM :D ):
$ cat hosts/puppet.test.vm.yaml
---
hieratest::test: yadda



Since the documentation is near rubbish on hiera, I started digging around
in the code itself for the hiera projects that _do_ work for me. I noticed
that there were two methods that seemed to pop up frequently.

1) The method Corey mentioned:
$bar = hiera('myfoo::bar', 'defaultvalue')

However, the puppet docs basically say do this for 2.7 but not for 3+ [
https://docs.puppetlabs.com/hiera/1/puppet.html ]. Also note that there are
two examples on that page which completely fail (silently...at least in my
example code).
THIS DOESN'T WORK:
1.1) class myclass ( $parameter_one = hiera('myclass::parameter_one',
'default text')
1.2) class myclass ($parameter_one = "default text") { ...content =>
$parameter_one, ...}

The first I couldn't get working until I pulled it into the body of the
class as Corey mentioned. Putting it in the class definition wouldn't work
for me as it is listed in the documentation.
The second will /always/ go to 'default text' for me. It has yet to pull
back the hiera data.

2) $ cat modules/testhiera/manifests/init.pp
class testhiera ( $test = $hieratest::test ) {
   file { "/tmp/$test" : ensure => present}
}


Since I started adopting the second method ( shortly after lunch ) it has
been working well. I am migrating a few of the simpler puppet modules I
have written to hiera and I totally get the value of hiera. I kinda wish I
had started sooner. But to spend that much time and effort on such a simple
example, it's no wonder so many people avoid starting with it. I wonder how
many people just give up after the example code doesn't work for them...

But, its working now! Hooray!

~Stack~

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/1bebca03-620e-4bc8-b9ee-cdf5d083490f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 16 | next ›
Discussion Overview
grouppuppet-users @
categoriespuppet
postedOct 8, '14 at 1:44p
activeOct 14, '14 at 7:50a
posts16
users5
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase