Ask Your Question
0

how can i access fact hashes in hiera hierarchies

asked 2016-01-07 09:20:48 -0500

relativemedia gravatar image

using puppet open source 3.8.4, hiera 1.3.4 and I am trying to figure out how to access a custom structured data fact to build out my hiera yaml hierarchy.

when i run puppet in debug mode it doesn't find the component hierarchy, it just finds environment/common and common.

As soon as i switch the fact from a hash to basic individual string variables and update the hierarchy to be %{::component} it finds the path.

At what version did hiera support hashed facts in its config file, or am i missing something. note I have tried various different syntaxes of ::sapenvs:component i.e; ::sapenvs[component], ::sapenvs.component.

/etc/facter/facts.d/kickstart.yaml

---
sapenvs:
  component: 'ECC'

hiera.yaml

---
:backends:
  - yaml
:yaml:
  :datadir: /opt/puppet/hieradata
:hierarchy:
  - "%{::environment}/%{::sapenvs:component}/common"
  - "%{::environment}/common"
  - "common"
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-02-07 19:27:18 -0500

Henrik Lindberg gravatar image

Since Hiera 2.0.0 you can work with structured facts. Here is the documentation: https://docs.puppetlabs.com/hiera/2.0...

edit flag offensive delete link more

Comments

Is there any way to work with these in Hiera 1.3?

otheus gravatar imageotheus ( 2017-02-15 12:45:48 -0500 )edit

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: 2016-01-07 09:20:48 -0500

Seen: 594 times

Last updated: Jan 07 '16