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 in Puppet by Danny
16 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 by Sirajul
• 25,420 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 in Puppet by Krishti

edited Feb 15 263 views
0 votes
1 answer
0 votes
1 answer
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 in Puppet by Sirajul
• 25,420 points
119 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,380 points
150 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 in Puppet by Sirajul
• 25,420 points
19 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 in Puppet by Sirajul
• 25,420 points
26 views