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
2,589 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
• 59,230 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 3,198 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
2,255 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
• 59,230 points
4,453 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
• 59,230 points
1,082 views
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,503 views
+2 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
• 59,230 points
724 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
• 59,230 points
507 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP