Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using a different ENC per environment

I found the ENC must be hard coded in puppet.conf to a single environment, such as:

external_nodes        = $codedir/environments/production/bin/enc.rb

However, I would like to use a different enc for each environment. I read there is a new variable available called "agent_specified_environment", but this only seems available in my modules, I can't find a way to load an enc based on this variable. I was hoping something like this would work:

external_nodes        = $codedir/environments/${::agent_specified_environment}/bin/enc.rb

Or even accessing that $agent_specified_environment variable from inside the ENC to choose which one to load, but nothing outside modules seems to have access to it, which is already too late as the ENC has already run by then.

For background, I use the enc script to set a role name, and other config info for a node, and I want to be able to make changes in a dev branch and test before merging those changes to production.