Ask Your Question

Bare with me... I want difficult stuff from Hiera [closed]

asked 2013-12-02 10:35:31 -0500

PorkCharSui gravatar image

Is it possible with Hiera to do different types of lookup? Do a 'hiera' lookup if a match is found in "%{environment}/%{clientcert}/sources", but do 'hiera_hash' lookup if a match isn't found there? For example... if my hiera.yaml looks like this:

  - "%{environment}/%{clientcert}/sources"
  - "%{environment}/%{domain}/sources"
  - "%{environment}/all/sources"

I want to use the hiera lookup if it finds something in "%{environment}/%{clientcert}/sources" and I want to use hiera_hash lookup if it doesn't.

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by PorkCharSui
close date 2014-04-23 10:26:53.690510

1 Answer

Sort by ยป oldest newest most voted

answered 2014-04-19 18:50:28 -0500

solarkennedy gravatar image

What if you organize your hieradata as a hash, and then contain the logic on what to do with it in your manifest.

For example, something like,

# clientcert yaml:
  - client:
    - key1
# domain yaml:
  - domain:
    - key2

And in the manifest:

$hash = hiera_hash(your_key)
if $hash['client'] { use client }
elsif $hash['domain'] { use domain } 
else { fail }

Something like that?

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-12-02 10:35:31 -0500

Seen: 172 times

Last updated: Apr 19 '14