ruby - Load environment specific variables in puppet template -


i'm trying configure properties file in puppet module. properties file should end content this:

server_url=https://my-login.com/server token_url=https://my-login.com/token client_id=my-application 

we have multiple environments application deployed (development, staging , production), server_url , token_url different in each environment, client_id same. made erb template this:

server_url=<%=@server_url%> token_url=<%=@token_url%> client_id=my-application 

and manifest file this:

# $env dev, stg or prd $server_url = 'https://my-login-dev.com/server' $token_url = 'https://my-login-dev.com/token' ​ file {'/apps/my-application/common/client.properties':   ensure  => 'present',   content => template("common/client.properties.erb"), } 

i want values of server_url , token_url set based on value of env variable. ideally work choosing particular file include. example, have urls.properties file each environment, variables loaded from. urls.properties.dev contain like:

server_url=https://my-login.com/server token_url=https://my-login.com/token 

and include so:

# server_url , token_url set following line include urls.properties.${env}  file {'/apps/my-application/common/client.properties':   ensure  => 'present',   content => template("common/client.properties.erb"), } 

i can't find documentation on how this, , can't find way make work hacking around.

is possible achieve this? there approach should taking solve problem? (i don't want use partial templates, don't want file split lots of chunks).


Comments