Ask Your Question

Which variables are defined in hiera?

asked 2013-04-20 08:05:20 -0600

deric gravatar image

Is there a way how to dump all variables available to hiera in run-time? And which variables are provided by default?

I've seen in some examples using %{fqdn} or %{hostname} but it doesn't work for my environment.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-04-20 09:53:30 -0600

jonn gravatar image

updated 2013-04-21 06:46:00 -0600

These variables are made available to hiera at runtime; the variables that are available depends on how you are running hiera.

If you're running hiera via Puppet, the variables will be the current set of facts (plus Puppet built-in variables), and things like %{fqdn} should just work. If you're running hiera on the command line, you'll need to provide it with a source for the variables.

You can do this in a variety of ways. The simplest way is to specify them on the command line (assuming the key you're looking up in hiera is named ... (more)

edit flag offensive delete link more


Solid work, jonn :).

Ancillas gravatar imageAncillas ( 2013-04-20 17:24:53 -0600 )edit

Thanks. What about environment variable? I don't see it in facter -y output, I have in /etc/puppet/puppet.conf line environment=production. Should I define it somewhere else?

deric gravatar imagederic ( 2013-04-21 06:26:18 -0600 )edit

Yes - that one is a Puppet built-in. Here's a definitive list of where each variable is set..

You can specify it on the hiera command line (environment=foo), or ...(more)

jonn gravatar imagejonn ( 2013-04-21 06:42:29 -0600 )edit

I've updated my answer to make it clear that Puppet passes its built-in variables as well as the facts :)

jonn gravatar imagejonn ( 2013-04-21 06:47:03 -0600 )edit

ok, and some variables like calling_module are available only at run-time, I guess. There's also calling_class variable and anything else?

deric gravatar imagederic ( 2013-04-21 07:27:58 -0600 )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


Asked: 2013-04-20 08:05:20 -0600

Seen: 600 times

Last updated: Apr 21 '13