Hi,
I don't know if there's another (or better) way, but I use a custom fact
for the *environment*. Then you can tell hiera to use this new fact in the
hierarchy tree:
As an example:
node:
/etc/facter/facts.d/local.yaml
---
env: "prod"
puppet server:
/etc/puppet/hiera.yaml
---
:backends:
- yaml
- eyaml
:hierarchy:
- "%{environment}/hieradb/%{::env}/cert/%{::clientcert}"
*Notice that %{environment} refers to puppet environemnt
<https://docs.puppet.com/puppet/4.10/environments.html>. (In my case those
are the git branches that I create).*
HTH,
Arnau
2017-05-24 16:17 GMT+02:00 Stephen <[email protected]>:
> Hello,
>
> At the moment I do not use Hiera to store any config at all, but I want to.
>
> Currently, I can use the variable "$mysettings::config::envtype" in my
> classes, as long as I put 'require mysettings::config' at the head of those
> classes.
>
> In my environment, I use this variable to hold "PROD", "DEV", "PERFTEST",
> "QA", etc (It derives this from IP subnet).
>
>
> I have this in my hiera.yaml file, which successfully pulls the data from,
> for example, the *os/RedHat.yaml* file when needed.
> - name: "OS defaults"
> path: "os/%{facts.os.family}.yaml"
>
>
>
> How do I use my variable above in the same way? I've tried the below, and
> a number of other syntaxes, and can't get it working. ie. I want to
> retrieve config from the *envtype/DEV.yaml* file, but it's not returning
> anything.
> - name: "Envtype data"
> path: "envtype/%{'mysettings::config::envtype'}.yaml"
>
>
> Apologies if this is explained in documentation, I have gone over it and
> it's just not clicking for me. Should I be doing it this way, should I be
> using custom facts, should I be doing something else?
>
> I'm on Puppet PE v2017.1.0.
>
> Thanks for any help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/puppet-users/c569bc63-69b5-481c-8f38-7e3388ea49a3%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/c569bc63-69b5-481c-8f38-7e3388ea49a3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/CAM69jx-rY2ODWcJx0mesL0-GD6qO_bebrsx%2B%2BT4fDfxi0z8a1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.