Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't load environment variables from /etc/sysconfig/puppet #87

Open
roy-themachine opened this issue Oct 11, 2023 · 3 comments
Open

Can't load environment variables from /etc/sysconfig/puppet #87

roy-themachine opened this issue Oct 11, 2023 · 3 comments

Comments

@roy-themachine
Copy link

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: puppetserver version: 7.13.0
  • Distribution: Centos9

How to reproduce (e.g Puppet code you use)

I've happened the following lines in /etc/sysconfig/puppet on the puppet server
VAULT_ADDR=https://xxxx:8200/
VAULT_NAMESPACE=admin/puppet
VAULT_AUTH_METHOD=approle
VAULT_ROLE_ID=xxxxxx..xxxx
VAULT_SECRET_ID=xxxx..xxx

What are you seeing

The module does not load the environment variable.

What behaviour did you expect instead

For the module to load these environment variables

@atoy40
Copy link

atoy40 commented Nov 17, 2023

@roy-themachine environment variables have to be set on the puppet client, not the server. Lookup function is executed (defered) on the client.

Btw, I'm also having problem with env vars. On a debian puppet client, I've try :

root@client:~$ VAULT_ADDR=https://my.vault.addr:8200 puppet agent --test

but I got this error : No vault_addr given and VAULT_ADDR env variable not set

It works perfect if I set the vault_addr directly in the lookup call. I've also try to export the env var or to define it into /etc/default/puppet .... but same error here.

Thanks
Anthony.

@none0nfg
Copy link

+1, i'm trying to use function on server instead of agents, and i just have no idea how to add env to puppet's process.
Anything from /etc/default are ignored. Only way it works is to use export ###, and run puppet agent manually.
Also i've tried to add envs directly to systemd unit within Environment=, also didnt help.

@none0nfg
Copy link

I've found the way to add envs to JRuby runtime, it allows to use not deffered methods of lookup, for me it's ok.

https://www.puppet.com/docs/puppetserver/5.3/config_file_puppetserver#

Here in documentation you can file property to set envs for jruby runtime via file puppetserver.conf.
I've added my approle creds here to avoid mentioning it in code. It works !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants