diff --git a/manifests/init.pp b/manifests/init.pp index ad9d59df..5c40ad6b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -320,6 +320,10 @@ # # $server_jruby_gem_home:: Where jruby gems are located for puppetserver # +# $server_environment_vars:: A hash of environment variables and their values +# which the puppetserver is allowed to see. +# To pass an existing variable use {'MYVAR': '${MYVAR}'}. +# # $allow_any_crl_auth:: Allow any authentication for the CRL. This # is needed on the puppet CA to accept clients # from a the puppet CA proxy. @@ -699,6 +703,7 @@ Optional[Variant[String,Array[String]]] $server_jvm_extra_args = $puppet::params::server_jvm_extra_args, Optional[String] $server_jvm_cli_args = $puppet::params::server_jvm_cli_args, Optional[Stdlib::Absolutepath] $server_jruby_gem_home = $puppet::params::server_jruby_gem_home, + Hash[String, String] $server_environment_vars = $puppet::params::server_environment_vars, Integer[1] $server_max_active_instances = $puppet::params::server_max_active_instances, Integer[0] $server_max_requests_per_instance = $puppet::params::server_max_requests_per_instance, Integer[0] $server_max_queued_requests = $puppet::params::server_max_queued_requests, diff --git a/manifests/params.pp b/manifests/params.pp index 2c813626..9ff10202 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -409,6 +409,7 @@ $server_ca_allow_auth_extensions = false $server_ca_enable_infra_crl = false $server_max_open_files = undef + $server_environment_vars = {} $server_puppetserver_version = undef diff --git a/templates/server/puppetserver/conf.d/puppetserver.conf.erb b/templates/server/puppetserver/conf.d/puppetserver.conf.erb index f22c4055..06c4da90 100644 --- a/templates/server/puppetserver/conf.d/puppetserver.conf.erb +++ b/templates/server/puppetserver/conf.d/puppetserver.conf.erb @@ -73,6 +73,20 @@ jruby-puppet: { # (optional) enable or disable environment class cache environment-class-cache-enabled: <%= @server_environment_class_cache_enabled %> + + # (optional) A map of environment variables which are made visible to + # Ruby code running within JRuby, for example, via the Ruby ENV class. + # By default, the only environment variables whose values are set into JRuby from the shell are HOME and PATH. + # The default value for the GEM_HOME environment variable in JRuby is set from the value provided for the + # jruby-puppet.gem-home key. + # Any variable set from the map for the environment-vars key overrides these defaults. + # Avoid overriding HOME, PATH, or GEM_HOME here because these values are already configurable via the shell + # or jruby-puppet.gem-home. + environment-vars: { + <%- @server_environment_vars.each do |env_key, env_val| -%> + "<%= env_key %>" : <%= env_val %> + <%- end -%> + } <%- if @compile_mode %> compile-mode: <%= @compile_mode %>