puppet server 4: hiera set up?

39 views
Skip to first unread message

dkoleary

unread,
May 20, 2016, 3:11:19 PM5/20/16
to Puppet Users
Hey;

Before dumping a bunch of data into hiera data files, I wanted to run a quick check to verify functionality.  This seems to be set up so I'm suspecting my test isn't valid.  Could someone take a peek and confirm for me?

This is the set up:

# h
pm

# puppet config print hiera_config
/etc/puppetlabs/puppet/hiera.yaml

# cat /etc/puppetlabs/puppet/hiera.yaml
---
:backends:
  - yaml
:hierarchy:
  - "hosts/%{facts.hostname}"
  - "environments/%{facts.environment}"
  - "host_env/%{facts.env}"
  - "os/%{facts.osfamily}"
  - common
:yaml:
  :datadir: /etc/puppetlabs/code/hieradata

# facter hostname
pm

# cat /etc/puppetlabs/code/hieradata/hosts/pm
---
puppet::status: 'running'

but the tests aren't showing anything:

# hiera puppet::status
nil
# puppet lookup puppet::status

The hiera call makes sense because it doesn't have access to host fact, as I understand it.  The puppet lookup command should have worked, though, right?

Any hints/tips/suggestions greatly appreciated.

Doug O'Leary

Rob Nelson

unread,
May 20, 2016, 3:36:32 PM5/20/16
to puppet...@googlegroups.com
Doug,

You could add --trace to see where it's looking. I would also try tossing something into common, which requires NO facts, to ensure base hiera functionality before moving on to tiers dependent upon fact values.

--
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/d7754606-219a-49f3-9065-4f3bd52855b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

R.I.Pienaar

unread,
May 20, 2016, 3:42:40 PM5/20/16
to puppet-users
my guess is this should be pm.yaml

dkoleary

unread,
May 20, 2016, 3:48:41 PM5/20/16
to Puppet Users
Unbelievable.  I'm a dumb-a##.  That was it.  Thank you very much.

# mv pm pm.yaml
# puppet lookup puppet::status
--- running
...

Rudy Gevaert

unread,
May 24, 2016, 4:04:24 PM5/24/16
to Puppet Users
Hi 

Can you tell me how you set facts.env ?

Thanks

dkoleary

unread,
May 24, 2016, 6:09:31 PM5/24/16
to Puppet Users
I haven't yet in this particular run; however, in my puppet ver 2 days, I created custom facts on the client nodes. I find it hard to believe that was taken out of mix. A search of puppet docs has this url. https://docs.puppet.com/facter/3.1/custom_facts.html

I'll probably be trying that one tonight or tomorrow depending on my ability to troubleshoot what should be a laughably simple class. De-rustifying my PDL ability is a pain.

If anyone's interested, there are a couple of reasons why I'm having ${::environment} different from $facts['env']. First, when designing their sdlc process, my company went nuts with different environments - way more than just the standard dev, qa, uat, prd and those environments won't match the puppet environments at least while we're rolling it out. Second, I'd like to be able to get the env from the box when I'm on it. Our naming convention isn't universal so getting that information is sometimes hit or miss "$ faster env" will be a lot easier than a MySQL query.

So, short answer and a longer story. Thanks

Doug

Reply all
Reply to author
Forward
0 new messages