Ask Your Question
0

Hiera interaction with Facter and facts

asked 2015-07-20 16:43:27 -0500

mattdan gravatar image

Hi everyone,

I'm currently moving all my datas to hiera, and I want to use facts to dive into my hierarchy. I thinks it's not a special feature...

My use case is like this :

[root@xxx $]# cat /etc/hiera.yaml
---
:backends:
  - yaml
:hierarchy:
  - defaults
  - global
  - site
  - "machine/%{::bios_version}/specific"

:yaml:
  :datadir: /var/lib/hieradata/

the fact bios_setup is defined by default.

[root@xxx $]# facter bios_version
O41

[root@xxx $]# tree /var/lib/hieradata/
/var/lib/hieradata/
└── machine
    └── 041
        └── specific.yaml

But when I ask hiera with the command cli, nothing is returned, and the debug mode shows that we never access to the dynamic path

[root@xxx $]# hiera ports --debug
DEBUG: 2015-07-20 21:27:02 +0000: Hiera YAML backend starting
DEBUG: 2015-07-20 21:27:02 +0000: Looking up ports in YAML backend
DEBUG: 2015-07-20 21:27:02 +0000: Looking for data source defaults
DEBUG: 2015-07-20 21:27:02 +0000: Cannot find datafile /var/lib/hieradata/defaults.yaml, skipping
DEBUG: 2015-07-20 21:27:02 +0000: Looking for data source global
DEBUG: 2015-07-20 21:27:02 +0000: Cannot find datafile /var/lib/hieradata/global.yaml, skipping
DEBUG: 2015-07-20 21:27:02 +0000: Looking for data source site
DEBUG: 2015-07-20 21:27:02 +0000: Cannot find datafile /var/lib/hieradata/site.yaml, skipping
nil

[root@xxx $]# cat /var/lib/hieradata/machine/041/specific.yaml 
---
ipmi: ipmitool
modprobe: ipmi_si
type: kcs
ports: '0xca2'

I thought that was a simple behavior of hiera/facter with puppet.

This is my configuration :

  • puppet 3.8.1
  • hiera 1.3.4
  • facter 2.4.4
  • ruby 2.0.0

Thanks for all of your ideas.

Cheers.

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
0

answered 2015-07-21 07:34:23 -0500

do a:

puppet config print confdir

will probably come up with something like /etc/puppet - the hiera.yaml file should be in there (i set /etc/hiera.yaml as a link to this)

edit flag offensive delete link more
0

answered 2015-07-21 11:13:01 -0500

mattdan gravatar image

updated 2015-07-21 11:13:44 -0500

Of course! That was a simple problem for a simple solution.

For admins using puppetserver => Don't forget to restart the service! :)

[RESOLVED]

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: 2015-07-20 16:43:27 -0500

Seen: 2,255 times

Last updated: Jul 21 '15