Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using hiera to manage hiera #17

Closed
electrical opened this issue Jul 15, 2014 · 5 comments
Closed

Using hiera to manage hiera #17

electrical opened this issue Jul 15, 2014 · 5 comments

Comments

@electrical
Copy link

Hi,

I got the following in a hiera file:

https://gist.github.com/electrical/731539930ef79f48b93a

The issue is now that the values get evaluated and the result of those get passed in the hiera.yaml file instead as is.
Is there a way to avoid that?

Cheers.

@hunner
Copy link
Member

hunner commented Jul 16, 2014

I actually have never been brave enough to declare puppet-hiera using hiera values. The actual template for hiera.yaml doesn't contain any quotes though, so I'm not sure where either your ' or " quotes are coming from.

@electrical
Copy link
Author

Hi

The gist is what I placed in the hiera data file.
The result is that the variables get evaluated and placed in the hiera.yaml
file.
On 16 Jul 2014 22:10, "Hunter Haugen" [email protected] wrote:

I actually have never been brave enough to declare puppet-hiera using
hiera values. The actual template for hiera.yaml doesn't contain any quotes
though, so I'm not sure where either your ' or " quotes are coming from.


Reply to this email directly or view it on GitHub
https://github.com/hunner/puppet-hiera/issues/17#issuecomment-49227576.

@antaflos
Copy link
Contributor

We use Hiera's %{} to escape interpolation, looking somewhat like this:

# In /etc/puppet/hieradata/production/fqdn/puppet01.example.com.yaml
puppet::master::hiera::hierarchy:
  - "fqdn/%%{}{::clientcert}"
  - "stages/%%{}{::stage}"
  - "domains/%%{}{::domain}"
  - "os/%%{}{::operatingsystem}/%%{}{::lsbdistcodename}"
  - "os/%%{}{::operatingsystem}"
  - "virtual/%%{}{::virtual}"
  - #...

The %{} construct is undocumented and should probably not be relied upon. The correct way would be to use the Hiera function literal('%'), which I find a bit unwieldy. See https://tickets.puppetlabs.com/browse/HI-127 for details.

Note that we don't use @hunner's module directly but I have implemented more or less exactly the same thing in our own puppet-puppet module.

@electrical
Copy link
Author

@antaflos ah cool. thanks for the info. Will try the literal('%') function.

@igalic
Copy link
Contributor

igalic commented Nov 7, 2014

pretty sure we can close this one now ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants