On Thursday, July 23, 2015 at 9:01:42 PM UTC-5, Stack Kororā wrote:
>
>
>
> On Thursday, July 23, 2015 at 6:05:27 PM UTC-5, Ellison Marks wrote:
>>
>> 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
>>>
>>>
> OK...that just made my head hurt a bit more. :-)
>
> So that link says that I can do what I am after with an ENC (which that 
> page doesn't tell you what that means...).
> "When writing an ENC, simply ensure that the environment: key is set in 
> the YAML output that the ENC returns. See the documentation on writing 
> ENCs for details. 
> <https://docs.puppetlabs.com/guides/external_nodes.html#environment>"
>
>

More specifically, it says that if what you are after is having the master 
assign nodes to non-default environments (as opposed to accepting nodes' 
self-assignment) then an ENC is the *only* way to accomplish that.

 

> That link takes you here: 
> https://docs.puppetlabs.com/guides/external_nodes.html#environment 
>
> That gives an example of a hiera file.
>


No, it doesn't.  It gives an example ENC output.  ENC output is in YAML 
format, but that doesn't make it an Hiera file.  Perhaps this is part of 
your confusion.

 

> Plus it says " In Puppet 3 and later, this will become the only 
> environment used by the node in its requests for catalogs and files." So 
> if that is the only way things will happen in the future, I should probably 
> do it this way. Things are looking good right? Except that documentation is 
> not quite complete...I have read it like three times and I am still not 
> sure how I am supposed to set that up to get it working...
>
>

>From Puppet's perspective, an ENC is simply an external program that Puppet 
will run to obtain information about how to classify a node.  Puppet will 
provide the node identifier (ordinarily $::clientcert) as the program's 
single command-line argument.  The classification information is expected 
to be returned to Puppet via the ENC's standard output, in YAML format, and 
it can specify both global variables for use during catalog building and 
classes that must be included in the node's catalog (hence "classifier").  
Among the global variables an ENC can specify is $::environment, which is 
special to Puppet.  The documentation link Ellison provided gives a brief 
but complete example of ENC output containing all these elements.

Puppet will combine the classification information provided by any ENC with 
whatever is presented in your manifest set.  Note one potential gotcha 
here: if you use an ENC, and your site manifest directly or indirectly 
contains any node blocks, then Puppet insists on being able to match *every* 
client node to a node block.  That's not hard to accommodate (you can use a 
default node block, for example), but it's important to know.


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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/566a6fa0-eaf8-40c9-a9aa-34d9336633ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to