No, the environment variable is set in the puppet.conf of every host. I'm not even sure what the effect would be of trying to define environment in hiera.
Please see: https://docs.puppetlabs.com/puppet/latest/reference/environments_assigning.html On Thursday, July 23, 2015 at 3:21:27 PM UTC-7, Stack Kororā wrote: > > Greetings, > > Thanks for the suggestions. I stepped out for a bit, but will try it as > soon as I get back. > > On 07/23/2015 05:15 PM, Ellison Marks wrote: > > As far as I'm aware, in the default setup, there is no top level > > hieradata. as the comment says, the default datadir is > > > > /etc/puppetlabs/code/environments/%{environment}/hieradata > > > > So each environment will have it's own hieradata directory with it's own > > common.yaml. /etc/puppetlabs/code/hieradata will never be looked in. > > OK. I guess I miss understood that. I thought I would be able to define > different types of environments which would be populated by that > %{environment} variable. Thus, I thought there was something in the top > level to tell the nodes which %{environment} variable (and subsequently > which hieradata directory) to use. > > > > I can see some possible ways to accomplish your goal. The braindead one > > is to just link common.yaml into each environment's hieradata. > > So every host would be essentially defined in every common.yaml?? > Doesn't that seem a little weird? > > > A slightly more interesting approach would look like this: > > > > --- > > :backends: > > - yaml > > :hierarchy: > > - "%{::environment}/%{::trusted.certname}" # or however you want files > > organized under the environments > > - common > > > > :yaml: > > # datadir is empty here, so hiera uses its defaults: > > # - /etc/puppetlabs/code/environments/%{environment}/hieradata on *nix > > # - > > %CommonAppData%\PuppetLabs\code\environments\%{environment}\hieradata on > > Windows > > # When specifying a datadir, make sure the directory exists. > > :datadir: /etc/puppetlabs/code/hieradata > > > > Then your hieradata folder would look like this: > > > > /etc/puppetlabs/code/hieradata/ > > common.yaml > > production/ > > node1.example.com > > node2.example.com > > staging/ > > node3.example.com > > dev/ > > node4.example.com > > > > I will gladly give this a try as soon as I get a chance. > > Thanks!! > > > -- 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/89be8506-e94e-48da-a0df-1dce4f3cf962%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.