On Tuesday, November 4, 2014 9:33:06 AM UTC-6, Mark Rosedale wrote:
>
> So I'm setting up puppet environments. This is what I have in my 
> puppet.conf under the [master] section
> environmentpath = $confdir/environments
>
>
>
> Now if I set environment inside the puppet.conf it will grab the 
> environment I have set up ($confdir/environments/test), but if I set it in 
> hiera it seems to ignore it completely,
>


As it should.  A node's environment is determined by the first of these 
that applies:

   1. the environment specified for the node by an ENC;
   2. the environment requested by the agent, as directed by its local 
   configuration or command-line argument;
   3. the general default environment specified in the master's 
   configuration;
   4. "production" if no environment is otherwise indicated.
   
Hiera plays no part in the determination.

 

> what is really odd is that it compiles a catalog, so it does work, but it 
> is clearly not compiling the correct catalog, since I have a notify in my 
> site.pp to let me know which environment it ran out of. 
>


I don't see what's odd about that.  Whatever environment is chosen 
(probably "production") has a node block that matches the target node, or 
perhaps has no node blocks at all.  If there isn't a node block 
specifically for that node's name, then it could perhaps be matched to a 
regex node block or a default node block.

 

>
> If I set the following in a hiera file I should expect puppet environments 
> to work correct? 
>
> environment: 'test'
>
>

You should not expect that to make Puppet choose the "test" environment for 
any nodes, if that's what you mean.  If you want the master to control to 
which environment each node is assigned, overriding any environment 
requested by the node, then you need an ENC.  If you generally want to rely 
on node blocks for node classification (which is in no way bad), then the 
ENC doesn't need to do much beyond beyond assigning environments.

 

> Any ideas how I can trace what catalog it is compiling? Or why it seems to 
> be ignoring hiera? 
>
>

It is ignoring hiera for this purpose because it should.  If you still want 
to probe what the master is doing then you can find the node's catalog 
cached on the node if you want to examine it after the fact.  You might get 
additional information by running the master with --debug output enabled.  
You can put notice() calls and Notify resources in your manifests, too.


John

-- 
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/566823d9-e7f1-453f-b0a7-4a6a606ec4c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to