Puppet: Environment variables

0 votes

Can somebody tell me what's the best way to set environment variables with puppet?

Using exec and doing export VAR=blah, would only last for the current session.Can i just add it to the EOF of bashrc?  However then it would end up getting added with every run of puppet. Isn't it?

Aug 8, 2019 in Puppet by Danny
82 views

1 answer to this question.

0 votes

*.sh scripts in /etc/profile.d are read at user-login time (as the post says, at the same time /etc/profile is sourced)

Variables export-ed in any script placed in /etc/profile.d will therefore be available to your users.

You can then use a file resource to ensure this action is idempotent. For example:

file { "/etc/profile.d/my_test.sh":
  content => 'export MYVAR="123"'
}
answered Aug 8, 2019 by Sirajul
• 48,520 points

Related Questions In Puppet

0 votes
1 answer

Can I access environment variables with Facter in Puppet?

Hey @Ruth, not directly. However, Facter reads ...READ MORE

answered Feb 15, 2019 in Puppet by Krishti

edited Feb 15, 2019 609 views
0 votes
1 answer

Error saying "Error: Could not parse for environment production" - Puppet

Hey @Nagya, You need to set the ...READ MORE

answered Feb 15, 2019 in Puppet by Kavya
211 views
0 votes
1 answer

Puppet: Error: Could not parse for environment production: Syntax error at '='; expected '}'

This error occurs if puppet apply -e is used ...READ MORE

answered Aug 1, 2019 in Puppet by Sirajul
• 48,520 points
262 views
0 votes
1 answer

Puppet in Docker : Building a Puppet environment in docker.

You can run your Puppet infrastructure on ...READ MORE

answered Aug 19, 2019 in Puppet by Sirajul
• 48,520 points
241 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,400 points
350 views
0 votes
1 answer
0 votes
1 answer

What are the limitations of puppet environment?

Environments limitations Environments have limitations, including leakage and ...READ MORE

answered Jul 25, 2019 in Puppet by Sirajul
• 48,520 points
44 views
0 votes
1 answer

How can i avoid the "environment leakage" in puppet?

Environment leakage is one of the limitations ...READ MORE

answered Jul 25, 2019 in Puppet by Sirajul
• 48,520 points
58 views